00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef GEOS_OP_POLYGONIZE_POLYGONIZEGRAPH_H
00022 #define GEOS_OP_POLYGONIZE_POLYGONIZEGRAPH_H
00023
00024 #include <geos/export.h>
00025
00026 #include <geos/planargraph/PlanarGraph.h>
00027
00028 #include <vector>
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 LineString;
00039 class GeometryFactory;
00040 class Coordinate;
00041 class CoordinateSequence;
00042 }
00043 namespace planargraph {
00044 class Node;
00045 class Edge;
00046 class DirectedEdge;
00047 }
00048 namespace operation {
00049 namespace polygonize {
00050 class EdgeRing;
00051 class PolygonizeDirectedEdge;
00052 }
00053 }
00054 }
00055
00056 namespace geos {
00057 namespace operation {
00058 namespace polygonize {
00059
00060
00070 class GEOS_DLL PolygonizeGraph: public planargraph::PlanarGraph {
00071
00072 public:
00073
00078 static void deleteAllEdges(planargraph::Node *node);
00079
00084 PolygonizeGraph(const geom::GeometryFactory *newFactory);
00085
00090 ~PolygonizeGraph();
00091
00097 void addEdge(const geom::LineString *line);
00098
00107 void getEdgeRings(std::vector<EdgeRing*>& edgeRingList);
00108
00118 void deleteCutEdges(std::vector<const geom::LineString*> &cutLines);
00119
00132 void deleteDangles(std::vector<const geom::LineString*> &dangleLines);
00133
00134 private:
00135
00136 static int getDegreeNonDeleted(planargraph::Node *node);
00137
00138 static int getDegree(planargraph::Node *node, long label);
00139
00140 const geom::GeometryFactory *factory;
00141
00142 planargraph::Node* getNode(const geom::Coordinate& pt);
00143
00144 void computeNextCWEdges();
00145
00155 void convertMaximalToMinimalEdgeRings(
00156 std::vector<PolygonizeDirectedEdge*> &ringEdges);
00157
00168 static void findIntersectionNodes( PolygonizeDirectedEdge *startDE,
00169 long label, std::vector<planargraph::Node*>& intNodes
00170 );
00171
00181 static void findLabeledEdgeRings(
00182 std::vector<planargraph::DirectedEdge*> &dirEdgesIn,
00183 std::vector<PolygonizeDirectedEdge*> &dirEdgesOut);
00184
00185 static void label(std::vector<planargraph::DirectedEdge*> &dirEdges, long label);
00186
00187 static void computeNextCWEdges(planargraph::Node *node);
00188
00196 static void computeNextCCWEdges(planargraph::Node *node, long label);
00197
00208 static void findDirEdgesInRing(PolygonizeDirectedEdge *startDE,
00209 std::vector<planargraph::DirectedEdge*>& edgesInRing);
00210
00211 EdgeRing* findEdgeRing(PolygonizeDirectedEdge *startDE);
00212
00213
00214 std::vector<planargraph::Edge *> newEdges;
00215 std::vector<planargraph::DirectedEdge *> newDirEdges;
00216 std::vector<planargraph::Node *> newNodes;
00217 std::vector<EdgeRing *> newEdgeRings;
00218 std::vector<geom::CoordinateSequence *> newCoords;
00219 };
00220
00221 }
00222 }
00223 }
00224
00225 #ifdef _MSC_VER
00226 #pragma warning(pop)
00227 #endif
00228
00229 #endif // GEOS_OP_POLYGONIZE_POLYGONIZEGRAPH_H
00230
00231
00232
00233
00234
00235
00236