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>
34 #include <geos/inline.h>
38 #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;
65 class GEOS_DLL Edge:
public GraphComponent{
66 using GraphComponent::updateIM;
73 index::MonotoneChainEdge *mce;
86 void testInvariant()
const {
88 assert(pts->size() > 1);
92 friend std::ostream& operator<< (std::ostream& os,
const Edge& el);
94 static void updateIM(Label *lbl,geom::IntersectionMatrix *im);
97 geom::CoordinateSequence* pts;
99 EdgeIntersectionList eiList;
103 Edge(geom::CoordinateSequence* newPts, Label *newLabel);
105 Edge(geom::CoordinateSequence* newPts);
109 virtual int getNumPoints()
const {
110 return static_cast<int>(pts->getSize());
113 virtual void setName(
const std::string &newName) {
117 virtual const geom::CoordinateSequence* getCoordinates()
const {
122 virtual const geom::Coordinate& getCoordinate(
int i)
const {
124 return pts->getAt(i);
127 virtual const geom::Coordinate& getCoordinate()
const {
129 return pts->getAt(0);
133 virtual Depth &getDepth() {
143 virtual int getDepthDelta()
const {
148 virtual void setDepthDelta(
int newDepthDelta) {
149 depthDelta=newDepthDelta;
153 virtual int getMaximumSegmentIndex()
const {
155 return getNumPoints()-1;
158 virtual EdgeIntersectionList& getEdgeIntersectionList() {
167 virtual index::MonotoneChainEdge* getMonotoneChainEdge();
169 virtual bool isClosed()
const {
171 return pts->getAt(0)==pts->getAt(getNumPoints()-1);
178 virtual bool isCollapsed()
const;
180 virtual Edge* getCollapsedEdge();
182 virtual void setIsolated(
bool newIsIsolated) {
183 isIsolatedVar=newIsIsolated;
187 virtual bool isIsolated()
const {
189 return isIsolatedVar;
196 virtual void addIntersections(algorithm::LineIntersector *li,
int segmentIndex,
204 virtual void addIntersection(algorithm::LineIntersector *li,
int segmentIndex,
205 int geomIndex,
int intIndex);
211 virtual void computeIM(geom::IntersectionMatrix *im) {
217 virtual bool isPointwiseEqual(
const Edge *e)
const;
219 virtual std::string print()
const;
221 virtual std::string printReverse()
const;
230 virtual bool equals(
const Edge& e)
const;
232 virtual bool equals(
const Edge* e)
const {
237 virtual geom::Envelope* getEnvelope();
242 inline bool operator==(
const Edge &a,
const Edge &b) {
246 std::ostream& operator<< (std::ostream& os,
const Edge& el);
260 #endif // ifndef GEOS_GEOMGRAPH_EDGE_H