00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef GEOS_PLANARGRAPH_DIRECTEDEDGE_H
00017 #define GEOS_PLANARGRAPH_DIRECTEDEDGE_H
00018
00019 #include <geos/export.h>
00020 #include <geos/planargraph/GraphComponent.h>
00021 #include <geos/geom/Coordinate.h>
00022
00023 #include <vector>
00024 #include <list>
00025
00026
00027 namespace geos {
00028 namespace planargraph {
00029 class Edge;
00030 class Node;
00031 }
00032 }
00033
00034 namespace geos {
00035 namespace planargraph {
00036
00046 class GEOS_DLL DirectedEdge: public GraphComponent {
00047
00048 public:
00049
00050 friend std::ostream& operator << (std::ostream&, const DirectedEdge&);
00051
00052 typedef std::list<DirectedEdge *> NonConstList;
00053 typedef std::list<const DirectedEdge *> ConstList;
00054 typedef std::vector<DirectedEdge *> NonConstVect;
00055
00056 protected:
00057 Edge* parentEdge;
00058 Node* from;
00059 Node* to;
00060 geom::Coordinate p0, p1;
00061 DirectedEdge* sym;
00062 bool edgeDirection;
00063 int quadrant;
00064 double angle;
00065 public:
00066
00067 typedef std::vector<const DirectedEdge *> ConstVect;
00068 typedef std::vector<DirectedEdge *> Vect;
00069
00079 static std::vector<Edge*>* toEdges(
00080 std::vector<DirectedEdge*>& dirEdges);
00081
00090 static void toEdges( std::vector<DirectedEdge*>& dirEdges,
00091 std::vector<Edge*>& parentEdges);
00092
00105 DirectedEdge(Node *newFrom, Node *newTo,
00106 const geom::Coordinate &directionPt,
00107 bool newEdgeDirection);
00108
00113 Edge* getEdge() const;
00114
00119 void setEdge(Edge* newParentEdge);
00120
00125 int getQuadrant() const;
00126
00131 const geom::Coordinate& getDirectionPt() const;
00132
00137 bool getEdgeDirection() const;
00138
00142 Node* getFromNode() const;
00143
00147 Node* getToNode() const;
00148
00153 geom::Coordinate& getCoordinate() const;
00154
00160 double getAngle() const;
00161
00167 DirectedEdge* getSym() const;
00168
00174 void setSym(DirectedEdge *newSym);
00175
00195 int compareTo(const DirectedEdge* obj) const;
00196
00216 int compareDirection(const DirectedEdge *e) const;
00217
00223 std::string print() const;
00224
00225 };
00226
00228 bool pdeLessThan(DirectedEdge *first, DirectedEdge * second);
00229
00231 std::ostream& operator << (std::ostream&, const DirectedEdge&);
00232
00233
00234 }
00235 }
00236
00237 #endif // GEOS_PLANARGRAPH_DIRECTEDEDGE_H