00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef GEOS_OP_POLYGONIZE_POLYGONIZER_H
00022 #define GEOS_OP_POLYGONIZE_POLYGONIZER_H
00023
00024 #include <geos/export.h>
00025 #include <geos/geom/GeometryComponentFilter.h>
00026
00027 #include <vector>
00028
00029 #ifdef _MSC_VER
00030 #pragma warning(push)
00031 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00032 #endif
00033
00034
00035 namespace geos {
00036 namespace geom {
00037 class Geometry;
00038 class LineString;
00039 class Polygon;
00040 }
00041 namespace operation {
00042 namespace polygonize {
00043 class EdgeRing;
00044 class PolygonizeGraph;
00045 }
00046 }
00047 }
00048
00049 namespace geos {
00050 namespace operation {
00051 namespace polygonize {
00052
00073 class GEOS_DLL Polygonizer {
00074 private:
00078 class GEOS_DLL LineStringAdder: public geom::GeometryComponentFilter {
00079 public:
00080 Polygonizer *pol;
00081 LineStringAdder(Polygonizer *p);
00082
00083 void filter_ro(const geom::Geometry * g);
00084 };
00085
00086
00087 LineStringAdder lineStringAdder;
00088
00094 void add(const geom::LineString *line);
00095
00099 void polygonize();
00100
00101 void findValidRings(const std::vector<EdgeRing*>& edgeRingList,
00102 std::vector<EdgeRing*>& validEdgeRingList,
00103 std::vector<geom::LineString*>& invalidRingList);
00104
00105 void findShellsAndHoles(const std::vector<EdgeRing*>& edgeRingList);
00106
00107 static void assignHolesToShells(const std::vector<EdgeRing*>& holeList,
00108 std::vector<EdgeRing*>& shellList);
00109
00110 static void assignHoleToShell(EdgeRing *holeER,
00111 std::vector<EdgeRing*>& shellList);
00112
00113 protected:
00114
00115 PolygonizeGraph *graph;
00116
00117
00118 std::vector<const geom::LineString*> dangles;
00119 std::vector<const geom::LineString*> cutEdges;
00120 std::vector<geom::LineString*> invalidRingLines;
00121
00122 std::vector<EdgeRing*> holeList;
00123 std::vector<EdgeRing*> shellList;
00124 std::vector<geom::Polygon*> *polyList;
00125
00126 public:
00127
00132 Polygonizer();
00133
00134 ~Polygonizer();
00135
00144 void add(std::vector<geom::Geometry*> *geomList);
00145
00154 void add(std::vector<const geom::Geometry*> *geomList);
00155
00164 void add(geom::Geometry *g);
00165
00174 void add(const geom::Geometry *g);
00175
00183 std::vector<geom::Polygon*>* getPolygons();
00184
00192 const std::vector<const geom::LineString*>& getDangles();
00193
00194
00202 const std::vector<const geom::LineString*>& getCutEdges();
00203
00212 const std::vector<geom::LineString*>& getInvalidRingLines();
00213
00214
00215 friend class Polygonizer::LineStringAdder;
00216 };
00217
00218 }
00219 }
00220 }
00221
00222 #ifdef _MSC_VER
00223 #pragma warning(pop)
00224 #endif
00225
00226 #endif // GEOS_OP_POLYGONIZE_POLYGONIZER_H