00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef GEOS_OP_BUFFER_BUFFERSUBGRAPH_H
00017 #define GEOS_OP_BUFFER_BUFFERSUBGRAPH_H
00018
00019 #include <vector>
00020 #include <set>
00021
00022 #include <geos/operation/buffer/RightmostEdgeFinder.h>
00023
00024
00025 namespace geos {
00026 namespace geom {
00027 class Coordinate;
00028 class Envelope;
00029 }
00030 namespace algorithm {
00031 class CGAlgorithms;
00032 }
00033 namespace geomgraph {
00034 class DirectedEdge;
00035 class Node;
00036 }
00037 }
00038
00039 namespace geos {
00040 namespace operation {
00041 namespace buffer {
00042
00050 class BufferSubgraph {
00051 private:
00052 RightmostEdgeFinder finder;
00053
00054 std::vector<geomgraph::DirectedEdge*> dirEdgeList;
00055
00056 std::vector<geomgraph::Node*> nodes;
00057
00058 geom::Coordinate *rightMostCoord;
00059
00060 geom::Envelope *env;
00061
00069 void addReachable(geomgraph::Node *startNode);
00070
00072
00076 void add(geomgraph::Node* node, std::vector<geomgraph::Node*>* nodeStack);
00077
00078 void clearVisitedEdges();
00079
00086
00087 void computeDepths(geomgraph::DirectedEdge *startEdge);
00088
00089 void computeNodeDepth(geomgraph::Node *n);
00090
00091 void copySymDepths(geomgraph::DirectedEdge *de);
00092
00093 bool contains(std::set<geomgraph::Node*>& nodes, geomgraph::Node *node);
00094
00095 public:
00096
00097 friend std::ostream& operator<< (std::ostream& os, const BufferSubgraph& bs);
00098
00103 BufferSubgraph(algorithm::CGAlgorithms *cga=NULL);
00104
00105 ~BufferSubgraph();
00106
00107 std::vector<geomgraph::DirectedEdge*>* getDirectedEdges();
00108
00109 std::vector<geomgraph::Node*>* getNodes();
00110
00114 geom::Coordinate* getRightmostCoordinate();
00115
00124 void create(geomgraph::Node *node);
00125
00126 void computeDepth(int outsideDepth);
00127
00139 void findResultEdges();
00140
00155 int compareTo(BufferSubgraph *);
00156
00163 geom::Envelope *getEnvelope();
00164 };
00165
00166 std::ostream& operator<< (std::ostream& os, const BufferSubgraph& bs);
00167
00168
00169 inline geom::Coordinate*
00170 BufferSubgraph::getRightmostCoordinate() {return rightMostCoord;}
00171
00172 inline std::vector<geomgraph::Node*>*
00173 BufferSubgraph::getNodes() { return &nodes; }
00174
00175 inline std::vector<geomgraph::DirectedEdge*>*
00176 BufferSubgraph::getDirectedEdges() {
00177 return &dirEdgeList;
00178 }
00179
00180 bool BufferSubgraphGT(BufferSubgraph *first, BufferSubgraph *second);
00181
00182 }
00183 }
00184 }
00185
00186 #endif // ndef GEOS_OP_BUFFER_BUFFERSUBGRAPH_H
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200