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
00098 void findValidRings(std::vector<EdgeRing*> *edgeRingList,
00099 std::vector<EdgeRing*> *validEdgeRingList,
00100 std::vector<geom::LineString*> *invalidRingList);
00101
00102 void findShellsAndHoles(std::vector<EdgeRing*> *edgeRingList);
00103
00104 static void assignHolesToShells(std::vector<EdgeRing*> *holeList,
00105 std::vector<EdgeRing*> *shellList);
00106
00107 static void assignHoleToShell(EdgeRing *holeER,
00108 std::vector<EdgeRing*> *shellList);
00109
00110 protected:
00111
00112 PolygonizeGraph *graph;
00113
00114
00115 std::vector<const geom::LineString*> *dangles;
00116 std::vector<const geom::LineString*> *cutEdges;
00117 std::vector<geom::LineString*> *invalidRingLines;
00118
00119 std::vector<EdgeRing*> *holeList;
00120 std::vector<EdgeRing*> *shellList;
00121 std::vector<geom::Polygon*> *polyList;
00122
00123 public:
00124
00129 Polygonizer();
00130
00131 ~Polygonizer();
00132
00141 void add(std::vector<geom::Geometry*> *geomList);
00142
00151 void add(std::vector<const geom::Geometry*> *geomList);
00152
00161 void add(geom::Geometry *g);
00162
00171 void add(const geom::Geometry *g);
00172
00180 std::vector<geom::Polygon*>* getPolygons();
00181
00187 std::vector<const geom::LineString*>* getDangles();
00188
00189
00195 std::vector<const geom::LineString*>* getCutEdges();
00196
00206 std::vector<geom::LineString*>* getInvalidRingLines();
00207
00208
00209 friend class Polygonizer::LineStringAdder;
00210 };
00211
00212 }
00213 }
00214 }
00215
00216 #endif // GEOS_OP_POLYGONIZE_POLYGONIZER_H
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226