00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef GEOS_OP_POLYGONIZE_POLYGONIZER_H
00019 #define GEOS_OP_POLYGONIZE_POLYGONIZER_H
00020
00021 #include <geos/geom/GeometryComponentFilter.h>
00022
00023 #include <vector>
00024
00025
00026 namespace geos {
00027 namespace geom {
00028 class Geometry;
00029 class LineString;
00030 class Polygon;
00031 }
00032 namespace operation {
00033 namespace polygonize {
00034 class EdgeRing;
00035 class PolygonizeGraph;
00036 }
00037 }
00038 }
00039
00040 namespace geos {
00041 namespace operation {
00042 namespace polygonize {
00043
00064 class Polygonizer {
00065 private:
00069 class LineStringAdder: public geom::GeometryComponentFilter {
00070 public:
00071 Polygonizer *pol;
00072 LineStringAdder(Polygonizer *p);
00073
00074 void filter_ro(const geom::Geometry * g);
00075 };
00076
00077
00078 LineStringAdder *lineStringAdder;
00079
00085 void add(const geom::LineString *line);
00086
00090 void polygonize();
00091
00092 void findValidRings(std::vector<EdgeRing*> *edgeRingList,
00093 std::vector<EdgeRing*> *validEdgeRingList,
00094 std::vector<geom::LineString*> *invalidRingList);
00095
00096 void findShellsAndHoles(std::vector<EdgeRing*> *edgeRingList);
00097
00098 static void assignHolesToShells(std::vector<EdgeRing*> *holeList,
00099 std::vector<EdgeRing*> *shellList);
00100
00101 static void assignHoleToShell(EdgeRing *holeER,
00102 std::vector<EdgeRing*> *shellList);
00103
00104 protected:
00105
00106 PolygonizeGraph *graph;
00107
00108
00109 std::vector<const geom::LineString*> *dangles;
00110 std::vector<const geom::LineString*> *cutEdges;
00111 std::vector<geom::LineString*> *invalidRingLines;
00112
00113 std::vector<EdgeRing*> *holeList;
00114 std::vector<EdgeRing*> *shellList;
00115 std::vector<geom::Polygon*> *polyList;
00116
00117 public:
00118
00123 Polygonizer();
00124
00125 ~Polygonizer();
00126
00135 void add(std::vector<geom::Geometry*> *geomList);
00136
00145 void add(std::vector<const geom::Geometry*> *geomList);
00146
00155 void add(geom::Geometry *g);
00156
00165 void add(const geom::Geometry *g);
00166
00174 std::vector<geom::Polygon*>* getPolygons();
00175
00181 std::vector<const geom::LineString*>* getDangles();
00182
00183
00189 std::vector<const geom::LineString*>* getCutEdges();
00190
00200 std::vector<geom::LineString*>* getInvalidRingLines();
00201
00202
00203 friend class Polygonizer::LineStringAdder;
00204 };
00205
00206 }
00207 }
00208 }
00209
00210 #endif // GEOS_OP_POLYGONIZE_POLYGONIZER_H
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220