1 /**********************************************************************
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
6 * Copyright (C) 2006 Refractions Research Inc.
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU Lesser General Public Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
13 **********************************************************************
15 * Last port: noding/SegmentNode.java rev. 1.6 (JTS-1.9)
17 **********************************************************************/
19 #ifndef GEOS_NODING_SEGMENTNODE_H
20 #define GEOS_NODING_SEGMENTNODE_H
22 #include <geos/export.h>
27 #include <geos/inline.h>
29 #include <geos/geom/Coordinate.h>
31 // Forward declarations
34 class NodedSegmentString
;
39 namespace noding
{ // geos.noding
41 /// Represents an intersection point between two NodedSegmentString.
45 class GEOS_DLL SegmentNode
{
47 const NodedSegmentString
& segString
;
53 // Declare type as noncopyable
54 SegmentNode(const SegmentNode
& other
);
55 SegmentNode
& operator=(const SegmentNode
& rhs
);
58 friend std::ostream
& operator<< (std::ostream
& os
, const SegmentNode
& n
);
60 /// the point of intersection (own copy)
61 geom::Coordinate coord
;
63 /// the index of the containing line segment in the parent edge
64 unsigned int segmentIndex
;
66 /// Construct a node on the given NodedSegmentString
68 /// @param ss the parent NodedSegmentString
70 /// @param coord the coordinate of the intersection, will be copied
72 /// @param nSegmentIndex the index of the segment on parent
73 /// NodedSegmentString
74 /// where the Node is located.
76 /// @param nSegmentOctant
78 SegmentNode(const NodedSegmentString
& ss
,
79 const geom::Coordinate
& nCoord
,
80 unsigned int nSegmentIndex
, int nSegmentOctant
);
85 /// Return true if this Node is *internal* (not on the boundary)
86 /// of the corresponding segment. Currently only the *first*
87 /// segment endpoint is checked, actually.
89 bool isInterior() const { return isInteriorVar
; }
91 bool isEndPoint(unsigned int maxSegmentIndex
) const;
94 * @return -1 this EdgeIntersection is located before
95 * the argument location
96 * @return 0 this EdgeIntersection is at the argument location
97 * @return 1 this EdgeIntersection is located after the
100 int compareTo(const SegmentNode
& other
);
102 //string print() const;
105 std::ostream
& operator<< (std::ostream
& os
, const SegmentNode
& n
);
107 struct GEOS_DLL SegmentNodeLT
{
108 bool operator()(SegmentNode
*s1
, SegmentNode
*s2
) const {
109 return s1
->compareTo(*s2
)<0;
114 } // namespace geos.noding
118 //# include "geos/noding/SegmentNode.inl"
121 #endif // GEOS_NODING_SEGMENTNODE_H
123 /**********************************************************************
125 * Revision 1.2 2006/03/24 09:52:41 strk
126 * USE_INLINE => GEOS_INLINE
128 * Revision 1.1 2006/03/09 16:46:49 strk
129 * geos::geom namespace definition, first pass at headers split
131 **********************************************************************/