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 #include <geos/geom/GeometryComponentFilter.h>
00027
00028 #include <vector>
00029
00030 #ifdef _MSC_VER
00031 #pragma warning(push)
00032 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00033 #endif
00034
00035
00036 namespace geos {
00037 namespace geom {
00038 class Geometry;
00039 class LineString;
00040 class Polygon;
00041 }
00042 namespace operation {
00043 namespace polygonize {
00044 class EdgeRing;
00045 class PolygonizeGraph;
00046 }
00047 }
00048 }
00049
00050 namespace geos {
00051 namespace operation {
00052 namespace polygonize {
00053
00074 class GEOS_DLL Polygonizer {
00075 private:
00079 class GEOS_DLL LineStringAdder: public geom::GeometryComponentFilter {
00080 public:
00081 Polygonizer *pol;
00082 LineStringAdder(Polygonizer *p);
00083
00084 void filter_ro(const geom::Geometry * g);
00085 };
00086
00087
00088 LineStringAdder lineStringAdder;
00089
00095 void add(const geom::LineString *line);
00096
00100 void polygonize();
00101
00102 void findValidRings(const std::vector<EdgeRing*>& edgeRingList,
00103 std::vector<EdgeRing*>& validEdgeRingList,
00104 std::vector<geom::LineString*>& invalidRingList);
00105
00106 void findShellsAndHoles(const std::vector<EdgeRing*>& edgeRingList);
00107
00108 static void assignHolesToShells(const std::vector<EdgeRing*>& holeList,
00109 std::vector<EdgeRing*>& shellList);
00110
00111 static void assignHoleToShell(EdgeRing *holeER,
00112 std::vector<EdgeRing*>& shellList);
00113
00114 protected:
00115
00116 PolygonizeGraph *graph;
00117
00118
00119 std::vector<const geom::LineString*> dangles;
00120 std::vector<const geom::LineString*> cutEdges;
00121 std::vector<geom::LineString*> invalidRingLines;
00122
00123 std::vector<EdgeRing*> holeList;
00124 std::vector<EdgeRing*> shellList;
00125 std::vector<geom::Polygon*> *polyList;
00126
00127 public:
00128
00133 Polygonizer();
00134
00135 ~Polygonizer();
00136
00145 void add(std::vector<geom::Geometry*> *geomList);
00146
00155 void add(std::vector<const geom::Geometry*> *geomList);
00156
00165 void add(geom::Geometry *g);
00166
00175 void add(const geom::Geometry *g);
00176
00184 std::vector<geom::Polygon*>* getPolygons();
00185
00193 const std::vector<const geom::LineString*>& getDangles();
00194
00195
00203 const std::vector<const geom::LineString*>& getCutEdges();
00204
00213 const std::vector<geom::LineString*>& getInvalidRingLines();
00214
00215
00216 friend class Polygonizer::LineStringAdder;
00217 };
00218
00219 }
00220 }
00221 }
00222
00223 #ifdef _MSC_VER
00224 #pragma warning(pop)
00225 #endif
00226
00227 #endif // GEOS_OP_POLYGONIZE_POLYGONIZER_H
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237