00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef GEOS_OP_POLYGONIZE_POLYGONIZEGRAPH_H
00019 #define GEOS_OP_POLYGONIZE_POLYGONIZEGRAPH_H
00020
00021 #include <geos/planargraph/PlanarGraph.h>
00022
00023 #include <vector>
00024
00025
00026 namespace geos {
00027 namespace geom {
00028 class LineString;
00029 class GeometryFactory;
00030 class Coordinate;
00031 class CoordinateSequence;
00032 }
00033 namespace planargraph {
00034 class Node;
00035 class Edge;
00036 class DirectedEdge;
00037 }
00038 namespace operation {
00039 namespace polygonize {
00040 class EdgeRing;
00041 class PolygonizeDirectedEdge;
00042 }
00043 }
00044 }
00045
00046 namespace geos {
00047 namespace operation {
00048 namespace polygonize {
00049
00050
00060 class PolygonizeGraph: public planargraph::PlanarGraph {
00061
00062 public:
00063
00068 static void deleteAllEdges(planargraph::Node *node);
00069
00074 PolygonizeGraph(const geom::GeometryFactory *newFactory);
00075
00080 ~PolygonizeGraph();
00081
00087 void addEdge(const geom::LineString *line);
00088
00096 std::vector<EdgeRing*>* getEdgeRings();
00097
00104 std::vector<const geom::LineString*>* deleteCutEdges();
00105
00117 std::vector<const geom::LineString*>* deleteDangles();
00118
00119 private:
00120
00121 static int getDegreeNonDeleted(planargraph::Node *node);
00122
00123 static int getDegree(planargraph::Node *node, long label);
00124
00125 const geom::GeometryFactory *factory;
00126
00127 planargraph::Node* getNode(const geom::Coordinate& pt);
00128
00129 void computeNextCWEdges();
00130
00139 void convertMaximalToMinimalEdgeRings(
00140 std::vector<PolygonizeDirectedEdge*> *ringEdges);
00141
00153 static std::vector<planargraph::Node*>* findIntersectionNodes(
00154 PolygonizeDirectedEdge *startDE,
00155 long label);
00156
00161 static std::vector<PolygonizeDirectedEdge*>* findLabeledEdgeRings(
00162 std::vector<planargraph::DirectedEdge*> &dirEdges);
00163
00164 static void label(std::vector<planargraph::DirectedEdge*> &dirEdges, long label);
00165
00166 static void computeNextCWEdges(planargraph::Node *node);
00167
00175 static void computeNextCCWEdges(planargraph::Node *node, long label);
00176
00186 static std::vector<planargraph::DirectedEdge*>* findDirEdgesInRing(
00187 PolygonizeDirectedEdge *startDE);
00188
00189 EdgeRing* findEdgeRing(PolygonizeDirectedEdge *startDE);
00190
00191
00192 std::vector<planargraph::Edge *>newEdges;
00193 std::vector<planargraph::DirectedEdge *>newDirEdges;
00194 std::vector<planargraph::Node *>newNodes;
00195 std::vector<EdgeRing *>newEdgeRings;
00196 std::vector<geom::CoordinateSequence *>newCoords;
00197 };
00198
00199 }
00200 }
00201 }
00202
00203 #endif // GEOS_OP_POLYGONIZE_POLYGONIZEGRAPH_H
00204
00205
00206
00207
00208
00209
00210