00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef GEOS_GEOMGRAPH_EDGEEND_H
00023 #define GEOS_GEOMGRAPH_EDGEEND_H
00024
00025 #include <geos/export.h>
00026 #include <geos/geom/Coordinate.h>
00027 #include <geos/geomgraph/Label.h>
00028 #include <geos/inline.h>
00029
00030 #include <string>
00031
00032
00033 namespace geos {
00034 namespace algorithm {
00035 class BoundaryNodeRule;
00036 }
00037 namespace geomgraph {
00038 class Edge;
00039 class Node;
00040 }
00041 }
00042
00043 namespace geos {
00044 namespace geomgraph {
00045
00056 class GEOS_DLL EdgeEnd {
00057
00058 public:
00059
00060 friend std::ostream& operator<< (std::ostream&, const EdgeEnd&);
00061
00062 EdgeEnd();
00063
00064 virtual ~EdgeEnd() {}
00065
00073 EdgeEnd(Edge* newEdge, const geom::Coordinate& newP0,
00074 const geom::Coordinate& newP1,
00075 const Label& newLabel);
00076
00083 EdgeEnd(Edge* newEdge, const geom::Coordinate& newP0,
00084 const geom::Coordinate& newP1);
00085
00086 Edge* getEdge() { return edge; }
00087
00088
00089 Label& getLabel() { return label; }
00090
00091 const Label& getLabel() const { return label; }
00092
00093 virtual geom::Coordinate& getCoordinate();
00094
00095 virtual geom::Coordinate& getDirectedCoordinate();
00096
00097 virtual int getQuadrant();
00098
00099 virtual double getDx();
00100
00101 virtual double getDy();
00102
00103 virtual void setNode(Node* newNode);
00104
00105 virtual Node* getNode();
00106
00107 virtual int compareTo(const EdgeEnd *e) const;
00108
00125 virtual int compareDirection(const EdgeEnd *e) const;
00126
00127 virtual void computeLabel(const algorithm::BoundaryNodeRule& bnr);
00128
00129 virtual std::string print();
00130
00131 protected:
00132
00133 Edge* edge;
00134
00135 Label label;
00136
00137 EdgeEnd(Edge* newEdge);
00138
00139 virtual void init(const geom::Coordinate& newP0,
00140 const geom::Coordinate& newP1);
00141
00142 private:
00143
00145 Node* node;
00146
00148 geom::Coordinate p0, p1;
00149
00151 double dx, dy;
00152
00153 int quadrant;
00154 };
00155
00156 std::ostream& operator<< (std::ostream&, const EdgeEnd&);
00157
00158 struct GEOS_DLL EdgeEndLT {
00159 bool operator()(const EdgeEnd *s1, const EdgeEnd *s2) const {
00160 return s1->compareTo(s2)<0;
00161 }
00162 };
00163
00164 }
00165 }
00166
00167
00168
00169
00170
00171 #endif // ifndef GEOS_GEOMGRAPH_EDGEEND_H