GEOS  3.8.0dev
SegmentNode.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2006 Refractions Research Inc.
7  *
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.
12  *
13  **********************************************************************
14  *
15  * Last port: noding/SegmentNode.java rev. 1.6 (JTS-1.9)
16  *
17  **********************************************************************/
18 
19 #ifndef GEOS_NODING_SEGMENTNODE_H
20 #define GEOS_NODING_SEGMENTNODE_H
21 
22 #include <geos/export.h>
23 
24 #include <vector>
25 #include <iostream>
26 
27 #include <geos/inline.h>
28 
29 #include <geos/geom/Coordinate.h>
30 
31 // Forward declarations
32 namespace geos {
33 namespace noding {
34 class NodedSegmentString;
35 }
36 }
37 
38 namespace geos {
39 namespace noding { // geos.noding
40 
42 //
45 class GEOS_DLL SegmentNode {
46 private:
47  const NodedSegmentString& segString;
48 
49  int segmentOctant;
50 
51  bool isInteriorVar;
52 
53  // Declare type as noncopyable
54  SegmentNode(const SegmentNode& other) = delete;
55  SegmentNode& operator=(const SegmentNode& rhs) = delete;
56 
57 public:
58  friend std::ostream& operator<< (std::ostream& os, const SegmentNode& n);
59 
62 
64  size_t segmentIndex;
65 
67  //
79  const geom::Coordinate& nCoord,
80  size_t nSegmentIndex, int nSegmentOctant);
81 
82  ~SegmentNode() {}
83 
89  bool
90  isInterior() const
91  {
92  return isInteriorVar;
93  }
94 
95  bool isEndPoint(unsigned int maxSegmentIndex) const;
96 
104  int compareTo(const SegmentNode& other);
105 
106  //string print() const;
107 };
108 
109 std::ostream& operator<< (std::ostream& os, const SegmentNode& n);
110 
111 struct GEOS_DLL SegmentNodeLT {
112  bool
113  operator()(SegmentNode* s1, SegmentNode* s2) const
114  {
115  return s1->compareTo(*s2) < 0;
116  }
117 };
118 
119 
120 } // namespace geos.noding
121 } // namespace geos
122 
123 #endif // GEOS_NODING_SEGMENTNODE_H
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Represents a list of contiguous line segments, and supports noding the segments.
Definition: NodedSegmentString.h:57
size_t segmentIndex
the index of the containing line segment in the parent edge
Definition: SegmentNode.h:64
geom::Coordinate coord
the point of intersection (own copy)
Definition: SegmentNode.h:61
bool isInterior() const
Return true if this Node is internal (not on the boundary) of the corresponding segment. Currently only the first segment endpoint is checked, actually.
Definition: SegmentNode.h:90
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
Represents an intersection point between two NodedSegmentString.
Definition: SegmentNode.h:45