GEOS: Polygonizer.h Source File

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

# Polygonizer.h

    00001 /**********************************************************************
    00002  * $Id: Polygonizer.h 3255 2011-03-01 17:56:10Z mloskot $
    00003  *
    00004  * GEOS - Geometry Engine Open Source
    00005  * http://geos.refractions.net
    00006  *
    00007  * Copyright (C) 2010 Sandro Santilli <strk@keybit.net>
    00008  * Copyright (C) 2006 Refractions Research Inc.
    00009  * Copyright (C) 2001-2002 Vivid Solutions Inc.
    00010  *
    00011  * This is free software; you can redistribute and/or modify it under
    00012  * the terms of the GNU Lesser General Public Licence as published
    00013  * by the Free Software Foundation.
    00014  * See the COPYING file for more information.
    00015  *
    00016  **********************************************************************
    00017  *
    00018  * Last port: operation/polygonize/Polygonizer.java rev. 1.6 (JTS-1.10)
    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> // for LineStringAdder inheritance
    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 // Forward declarations
    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 { // geos::operation
    00052 namespace polygonize { // geos::operation::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                 //void filter_rw(geom::Geometry *g);
    00084                 void filter_ro(const geom::Geometry * g);
    00085         };
    00086
    00087         // default factory
    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         // initialize with empty collections, in case nothing is computed
    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 // This seems to be needed by    GCC 2.95.4
    00216 friend class Polygonizer::LineStringAdder;
    00217 };
    00218
    00219 } // namespace geos::operation::polygonize
    00220 } // namespace geos::operation
    00221 } // namespace geos
    00222
    00223 #ifdef _MSC_VER
    00224 #pragma warning(pop)
    00225 #endif
    00226
    00227 #endif // GEOS_OP_POLYGONIZE_POLYGONIZER_H
    00228
    00229 /**********************************************************************
    00230  * $Log$
    00231  * Revision 1.2  2006/06/12 17:15:29  strk
    00232  * Removed unused parameters warning
    00233  *
    00234  * Revision 1.1  2006/03/22 11:19:06  strk
    00235  * opPolygonize.h headers split.
    00236  *
    00237  **********************************************************************/