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 const geom::Coordinate& getCoordinate() const { return p0; }
00096
00097 virtual geom::Coordinate& getDirectedCoordinate();
00098
00099 virtual int getQuadrant();
00100
00101 virtual double getDx();
00102
00103 virtual double getDy();
00104
00105 virtual void setNode(Node* newNode);
00106
00107 virtual Node* getNode();
00108
00109 virtual int compareTo(const EdgeEnd *e) const;
00110
00127 virtual int compareDirection(const EdgeEnd *e) const;
00128
00129 virtual void computeLabel(const algorithm::BoundaryNodeRule& bnr);
00130
00131 virtual std::string print() const;
00132
00133 protected:
00134
00135 Edge* edge;
00136
00137 Label label;
00138
00139 EdgeEnd(Edge* newEdge);
00140
00141 virtual void init(const geom::Coordinate& newP0,
00142 const geom::Coordinate& newP1);
00143
00144 private:
00145
00147 Node* node;
00148
00150 geom::Coordinate p0, p1;
00151
00153 double dx, dy;
00154
00155 int quadrant;
00156 };
00157
00158 std::ostream& operator<< (std::ostream&, const EdgeEnd&);
00159
00160 struct GEOS_DLL EdgeEndLT {
00161 bool operator()(const EdgeEnd *s1, const EdgeEnd *s2) const {
00162 return s1->compareTo(s2)<0;
00163 }
00164 };
00165
00166 }
00167 }
00168
00169
00170
00171
00172
00173 #endif // ifndef GEOS_GEOMGRAPH_EDGEEND_H