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 <geos/operation/buffer/RightmostEdgeFinder.h>
00026
00027 #include <vector>
00028 #include <set>
00029
00030 #ifdef _MSC_VER
00031 #pragma warning(push)
00032 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00033 #endif
00034
00035
00036 namespace geos {
00037 namespace geom {
00038 class Coordinate;
00039 class Envelope;
00040 }
00041 namespace algorithm {
00042 class CGAlgorithms;
00043 }
00044 namespace geomgraph {
00045 class DirectedEdge;
00046 class Node;
00047 }
00048 }
00049
00050 namespace geos {
00051 namespace operation {
00052 namespace buffer {
00053
00062 class GEOS_DLL BufferSubgraph {
00063 private:
00064 RightmostEdgeFinder finder;
00065
00066 std::vector<geomgraph::DirectedEdge*> dirEdgeList;
00067
00068 std::vector<geomgraph::Node*> nodes;
00069
00070 geom::Coordinate *rightMostCoord;
00071
00072 geom::Envelope *env;
00073
00081 void addReachable(geomgraph::Node *startNode);
00082
00084
00088 void add(geomgraph::Node* node, std::vector<geomgraph::Node*>* nodeStack);
00089
00090 void clearVisitedEdges();
00091
00098
00099 void computeDepths(geomgraph::DirectedEdge *startEdge);
00100
00101 void computeNodeDepth(geomgraph::Node *n);
00102
00103 void copySymDepths(geomgraph::DirectedEdge *de);
00104
00105 bool contains(std::set<geomgraph::Node*>& nodes, geomgraph::Node *node);
00106
00107 public:
00108
00109 friend std::ostream& operator<< (std::ostream& os, const BufferSubgraph& bs);
00110
00111 BufferSubgraph();
00112
00113 ~BufferSubgraph();
00114
00115 std::vector<geomgraph::DirectedEdge*>* getDirectedEdges();
00116
00117 std::vector<geomgraph::Node*>* getNodes();
00118
00122 geom::Coordinate* getRightmostCoordinate();
00123
00132 void create(geomgraph::Node *node);
00133
00134 void computeDepth(int outsideDepth);
00135
00147 void findResultEdges();
00148
00163 int compareTo(BufferSubgraph *);
00164
00171 geom::Envelope *getEnvelope();
00172 };
00173
00174 std::ostream& operator<< (std::ostream& os, const BufferSubgraph& bs);
00175
00176
00177 inline geom::Coordinate*
00178 BufferSubgraph::getRightmostCoordinate() {return rightMostCoord;}
00179
00180 inline std::vector<geomgraph::Node*>*
00181 BufferSubgraph::getNodes() { return &nodes; }
00182
00183 inline std::vector<geomgraph::DirectedEdge*>*
00184 BufferSubgraph::getDirectedEdges() {
00185 return &dirEdgeList;
00186 }
00187
00188 bool BufferSubgraphGT(BufferSubgraph *first, BufferSubgraph *second);
00189
00190 }
00191 }
00192 }
00193
00194 #ifdef _MSC_VER
00195 #pragma warning(pop)
00196 #endif
00197
00198 #endif // ndef GEOS_OP_BUFFER_BUFFERSUBGRAPH_H
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212