00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef GEOS_OP_BUFFER_BUFFERSUBGRAPH_H
00021 #define GEOS_OP_BUFFER_BUFFERSUBGRAPH_H
00022
00023 #include <geos/export.h>
00024
00025 #include <vector>
00026 #include <set>
00027
00028 #include <geos/operation/buffer/RightmostEdgeFinder.h>
00029
00030
00031 namespace geos {
00032 namespace geom {
00033 class Coordinate;
00034 class Envelope;
00035 }
00036 namespace algorithm {
00037 class CGAlgorithms;
00038 }
00039 namespace geomgraph {
00040 class DirectedEdge;
00041 class Node;
00042 }
00043 }
00044
00045 namespace geos {
00046 namespace operation {
00047 namespace buffer {
00048
00057 class GEOS_DLL BufferSubgraph {
00058 private:
00059 RightmostEdgeFinder finder;
00060
00061 std::vector<geomgraph::DirectedEdge*> dirEdgeList;
00062
00063 std::vector<geomgraph::Node*> nodes;
00064
00065 geom::Coordinate *rightMostCoord;
00066
00067 geom::Envelope *env;
00068
00076 void addReachable(geomgraph::Node *startNode);
00077
00079
00083 void add(geomgraph::Node* node, std::vector<geomgraph::Node*>* nodeStack);
00084
00085 void clearVisitedEdges();
00086
00093
00094 void computeDepths(geomgraph::DirectedEdge *startEdge);
00095
00096 void computeNodeDepth(geomgraph::Node *n);
00097
00098 void copySymDepths(geomgraph::DirectedEdge *de);
00099
00100 bool contains(std::set<geomgraph::Node*>& nodes, geomgraph::Node *node);
00101
00102 public:
00103
00104 friend std::ostream& operator<< (std::ostream& os, const BufferSubgraph& bs);
00105
00106 BufferSubgraph();
00107
00108 ~BufferSubgraph();
00109
00110 std::vector<geomgraph::DirectedEdge*>* getDirectedEdges();
00111
00112 std::vector<geomgraph::Node*>* getNodes();
00113
00117 geom::Coordinate* getRightmostCoordinate();
00118
00127 void create(geomgraph::Node *node);
00128
00129 void computeDepth(int outsideDepth);
00130
00142 void findResultEdges();
00143
00158 int compareTo(BufferSubgraph *);
00159
00166 geom::Envelope *getEnvelope();
00167 };
00168
00169 std::ostream& operator<< (std::ostream& os, const BufferSubgraph& bs);
00170
00171
00172 inline geom::Coordinate*
00173 BufferSubgraph::getRightmostCoordinate() {return rightMostCoord;}
00174
00175 inline std::vector<geomgraph::Node*>*
00176 BufferSubgraph::getNodes() { return &nodes; }
00177
00178 inline std::vector<geomgraph::DirectedEdge*>*
00179 BufferSubgraph::getDirectedEdges() {
00180 return &dirEdgeList;
00181 }
00182
00183 bool BufferSubgraphGT(BufferSubgraph *first, BufferSubgraph *second);
00184
00185 }
00186 }
00187 }
00188
00189 #endif // ndef GEOS_OP_BUFFER_BUFFERSUBGRAPH_H
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203