22 #ifndef GEOS_GEOMGRAPH_EDGE_H
23 #define GEOS_GEOMGRAPH_EDGE_H
25 #include <geos/export.h>
29 #include <geos/geomgraph/GraphComponent.h>
30 #include <geos/geomgraph/Depth.h>
31 #include <geos/geomgraph/EdgeIntersectionList.h>
32 #include <geos/geom/CoordinateSequence.h>
33 #include <geos/geom/Envelope.h>
35 #include <geos/inline.h>
39 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
45 class IntersectionMatrix;
49 class LineIntersector;
57 class MonotoneChainEdge;
66 class GEOS_DLL Edge:
public GraphComponent {
67 using GraphComponent::updateIM;
72 std::unique_ptr<index::MonotoneChainEdge> mce;
88 assert(pts->size() > 1);
91 friend std::ostream& operator<< (std::ostream& os,
const Edge& el);
93 static void updateIM(
const Label& lbl, geom::IntersectionMatrix& im);
96 std::unique_ptr<geom::CoordinateSequence> pts;
98 EdgeIntersectionList eiList;
101 Edge(geom::CoordinateSequence* newPts,
const Label& newLabel);
104 Edge(geom::CoordinateSequence* newPts);
111 return pts->getSize();
114 virtual const geom::CoordinateSequence*
115 getCoordinates()
const
121 virtual const geom::Coordinate&
122 getCoordinate(
size_t i)
const
125 return pts->getAt(i);
128 virtual const geom::Coordinate&
129 getCoordinate()
const
132 return pts->getAt(0);
149 getDepthDelta()
const
156 setDepthDelta(
int newDepthDelta)
158 depthDelta = newDepthDelta;
163 getMaximumSegmentIndex()
const
166 return getNumPoints() - 1;
169 virtual EdgeIntersectionList&
170 getEdgeIntersectionList()
180 virtual index::MonotoneChainEdge* getMonotoneChainEdge();
186 return pts->getAt(0) == pts->getAt(getNumPoints() - 1);
193 virtual bool isCollapsed()
const;
195 virtual Edge* getCollapsedEdge();
198 setIsolated(
bool newIsIsolated)
200 isIsolatedVar = newIsIsolated;
205 isIsolated()
const override
208 return isIsolatedVar;
215 virtual void addIntersections(algorithm::LineIntersector* li,
size_t segmentIndex,
223 virtual void addIntersection(algorithm::LineIntersector* li,
size_t segmentIndex,
224 size_t geomIndex,
size_t intIndex);
239 virtual bool isPointwiseEqual(
const Edge* e)
const;
241 virtual std::string print()
const;
243 virtual std::string printReverse()
const;
252 virtual bool equals(
const Edge& e)
const;
255 equals(
const Edge* e)
const
267 operator==(
const Edge& a,
const Edge& b)
272 std::ostream& operator<< (std::ostream& os,
const Edge& el);
286 #endif // ifndef GEOS_GEOMGRAPH_EDGE_H