00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef GEOS_OP_POLYGONIZE_POLYGONIZEGRAPH_H
00023 #define GEOS_OP_POLYGONIZE_POLYGONIZEGRAPH_H
00024
00025 #include <geos/export.h>
00026
00027 #include <geos/planargraph/PlanarGraph.h>
00028
00029 #include <vector>
00030
00031
00032 namespace geos {
00033 namespace geom {
00034 class LineString;
00035 class GeometryFactory;
00036 class Coordinate;
00037 class CoordinateSequence;
00038 }
00039 namespace planargraph {
00040 class Node;
00041 class Edge;
00042 class DirectedEdge;
00043 }
00044 namespace operation {
00045 namespace polygonize {
00046 class EdgeRing;
00047 class PolygonizeDirectedEdge;
00048 }
00049 }
00050 }
00051
00052 namespace geos {
00053 namespace operation {
00054 namespace polygonize {
00055
00056
00066 class GEOS_DLL PolygonizeGraph: public planargraph::PlanarGraph {
00067
00068 public:
00069
00074 static void deleteAllEdges(planargraph::Node *node);
00075
00080 PolygonizeGraph(const geom::GeometryFactory *newFactory);
00081
00086 ~PolygonizeGraph();
00087
00093 void addEdge(const geom::LineString *line);
00094
00102 std::vector<EdgeRing*>* getEdgeRings();
00103
00110 std::vector<const geom::LineString*>* deleteCutEdges();
00111
00123 std::vector<const geom::LineString*>* deleteDangles();
00124
00125 private:
00126
00127 static int getDegreeNonDeleted(planargraph::Node *node);
00128
00129 static int getDegree(planargraph::Node *node, long label);
00130
00131 const geom::GeometryFactory *factory;
00132
00133 planargraph::Node* getNode(const geom::Coordinate& pt);
00134
00135 void computeNextCWEdges();
00136
00145 void convertMaximalToMinimalEdgeRings(
00146 std::vector<PolygonizeDirectedEdge*> *ringEdges);
00147
00159 static std::vector<planargraph::Node*>* findIntersectionNodes(
00160 PolygonizeDirectedEdge *startDE,
00161 long label);
00162
00167 static std::vector<PolygonizeDirectedEdge*>* findLabeledEdgeRings(
00168 std::vector<planargraph::DirectedEdge*> &dirEdges);
00169
00170 static void label(std::vector<planargraph::DirectedEdge*> &dirEdges, long label);
00171
00172 static void computeNextCWEdges(planargraph::Node *node);
00173
00181 static void computeNextCCWEdges(planargraph::Node *node, long label);
00182
00192 static std::vector<planargraph::DirectedEdge*>* findDirEdgesInRing(
00193 PolygonizeDirectedEdge *startDE);
00194
00195 EdgeRing* findEdgeRing(PolygonizeDirectedEdge *startDE);
00196
00197
00198 std::vector<planargraph::Edge *>newEdges;
00199 std::vector<planargraph::DirectedEdge *>newDirEdges;
00200 std::vector<planargraph::Node *>newNodes;
00201 std::vector<EdgeRing *>newEdgeRings;
00202 std::vector<geom::CoordinateSequence *>newCoords;
00203 };
00204
00205 }
00206 }
00207 }
00208
00209 #endif // GEOS_OP_POLYGONIZE_POLYGONIZEGRAPH_H
00210
00211
00212
00213
00214
00215
00216