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
00103 void getEdgeRings(std::vector<EdgeRing*>& edgeRingList);
00104
00114 void deleteCutEdges(std::vector<const geom::LineString*> &cutLines);
00115
00128 void deleteDangles(std::vector<const geom::LineString*> &dangleLines);
00129
00130 private:
00131
00132 static int getDegreeNonDeleted(planargraph::Node *node);
00133
00134 static int getDegree(planargraph::Node *node, long label);
00135
00136 const geom::GeometryFactory *factory;
00137
00138 planargraph::Node* getNode(const geom::Coordinate& pt);
00139
00140 void computeNextCWEdges();
00141
00151 void convertMaximalToMinimalEdgeRings(
00152 std::vector<PolygonizeDirectedEdge*> &ringEdges);
00153
00164 static void findIntersectionNodes( PolygonizeDirectedEdge *startDE,
00165 long label, std::vector<planargraph::Node*>& intNodes
00166 );
00167
00177 static void findLabeledEdgeRings(
00178 std::vector<planargraph::DirectedEdge*> &dirEdgesIn,
00179 std::vector<PolygonizeDirectedEdge*> &dirEdgesOut);
00180
00181 static void label(std::vector<planargraph::DirectedEdge*> &dirEdges, long label);
00182
00183 static void computeNextCWEdges(planargraph::Node *node);
00184
00192 static void computeNextCCWEdges(planargraph::Node *node, long label);
00193
00204 static void findDirEdgesInRing(PolygonizeDirectedEdge *startDE,
00205 std::vector<planargraph::DirectedEdge*>& edgesInRing);
00206
00207 EdgeRing* findEdgeRing(PolygonizeDirectedEdge *startDE);
00208
00209
00210 std::vector<planargraph::Edge *> newEdges;
00211 std::vector<planargraph::DirectedEdge *> newDirEdges;
00212 std::vector<planargraph::Node *> newNodes;
00213 std::vector<EdgeRing *> newEdgeRings;
00214 std::vector<geom::CoordinateSequence *> newCoords;
00215 };
00216
00217 }
00218 }
00219 }
00220
00221 #endif // GEOS_OP_POLYGONIZE_POLYGONIZEGRAPH_H
00222
00223
00224
00225
00226
00227
00228