00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef GEOS_PLANARGRAPH_NODE_H
00018 #define GEOS_PLANARGRAPH_NODE_H
00019
00020 #include <geos/export.h>
00021
00022 #include <geos/planargraph/GraphComponent.h>
00023 #include <geos/planargraph/DirectedEdgeStar.h>
00024 #include <geos/geom/Coordinate.h>
00025
00026
00027 namespace geos {
00028 namespace planargraph {
00029
00030 class DirectedEdge;
00031 }
00032 }
00033
00034 namespace geos {
00035 namespace planargraph {
00036
00046 class GEOS_DLL Node: public GraphComponent {
00047 protected:
00048
00050 geom::Coordinate pt;
00051
00053 DirectedEdgeStar *deStar;
00054
00055 public:
00056
00057 friend std::ostream& operator << (std::ostream& os, const Node&);
00058
00066 static std::vector<Edge*>* getEdgesBetween(Node *node0,
00067 Node *node1);
00068
00070 Node(const geom::Coordinate& newPt)
00071 :
00072 pt(newPt)
00073 { deStar=new DirectedEdgeStar(); }
00074
00075 virtual ~Node() {
00076 delete deStar;
00077 }
00078
00085 Node(geom::Coordinate& newPt, DirectedEdgeStar *newDeStar)
00086 :
00087 pt(newPt),
00088 deStar(newDeStar)
00089 {}
00090
00094 geom::Coordinate& getCoordinate() {
00095 return pt;
00096 }
00097
00101 void addOutEdge(DirectedEdge *de) {
00102 deStar->add(de);
00103 }
00104
00109 DirectedEdgeStar* getOutEdges() { return deStar; }
00110 const DirectedEdgeStar* getOutEdges() const { return deStar; }
00111
00115 size_t getDegree() const {
00116 return deStar->getDegree();
00117 }
00118
00124 int getIndex(Edge *edge) {
00125 return deStar->getIndex(edge);
00126 }
00127
00128 };
00129
00131 std::ostream& operator<<(std::ostream& os, const Node& n);
00132
00133
00135
00136
00137 }
00138 }
00139
00140 #endif // GEOS_PLANARGRAPH_NODE_H
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154