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_POLYGONIZER_H
00023 #define GEOS_OP_POLYGONIZE_POLYGONIZER_H
00024
00025 #include <geos/export.h>
00026
00027 #include <geos/geom/GeometryComponentFilter.h>
00028
00029 #include <vector>
00030
00031
00032 namespace geos {
00033 namespace geom {
00034 class Geometry;
00035 class LineString;
00036 class Polygon;
00037 }
00038 namespace operation {
00039 namespace polygonize {
00040 class EdgeRing;
00041 class PolygonizeGraph;
00042 }
00043 }
00044 }
00045
00046 namespace geos {
00047 namespace operation {
00048 namespace polygonize {
00049
00070 class GEOS_DLL Polygonizer {
00071 private:
00075 class LineStringAdder: public geom::GeometryComponentFilter {
00076 public:
00077 Polygonizer *pol;
00078 LineStringAdder(Polygonizer *p);
00079
00080 void filter_ro(const geom::Geometry * g);
00081 };
00082
00083
00084 LineStringAdder *lineStringAdder;
00085
00091 void add(const geom::LineString *line);
00092
00096 void polygonize();
00097
00099 void findValidRings(std::vector<EdgeRing*>& edgeRingList,
00100 std::vector<EdgeRing*> *validEdgeRingList,
00101 std::vector<geom::LineString*> *invalidRingList);
00102
00103 void findShellsAndHoles(std::vector<EdgeRing*> *edgeRingList);
00104
00105 static void assignHolesToShells(std::vector<EdgeRing*> *holeList,
00106 std::vector<EdgeRing*> *shellList);
00107
00108 static void assignHoleToShell(EdgeRing *holeER,
00109 std::vector<EdgeRing*> *shellList);
00110
00111 protected:
00112
00113 PolygonizeGraph *graph;
00114
00115
00116 std::vector<const geom::LineString*> *dangles;
00117 std::vector<const geom::LineString*> *cutEdges;
00118 std::vector<geom::LineString*> *invalidRingLines;
00119
00120 std::vector<EdgeRing*> *holeList;
00121 std::vector<EdgeRing*> *shellList;
00122 std::vector<geom::Polygon*> *polyList;
00123
00124 public:
00125
00130 Polygonizer();
00131
00132 ~Polygonizer();
00133
00142 void add(std::vector<geom::Geometry*> *geomList);
00143
00152 void add(std::vector<const geom::Geometry*> *geomList);
00153
00162 void add(geom::Geometry *g);
00163
00172 void add(const geom::Geometry *g);
00173
00181 std::vector<geom::Polygon*>* getPolygons();
00182
00188 std::vector<const geom::LineString*>* getDangles();
00189
00190
00198 std::vector<const geom::LineString*>* getCutEdges();
00199
00209 std::vector<geom::LineString*>* getInvalidRingLines();
00210
00211
00212 friend class Polygonizer::LineStringAdder;
00213 };
00214
00215 }
00216 }
00217 }
00218
00219 #endif // GEOS_OP_POLYGONIZE_POLYGONIZER_H
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229