GEOS: Polygonizer.h Source File

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

- File List

# Polygonizer.h

    00001 /**********************************************************************
    00002  * $Id: Polygonizer.h 2728 2009-11-19 19:57:36Z strk $
    00003  *
    00004  * GEOS - Geometry Engine Open Source
    00005  * http://geos.refractions.net
    00006  *
    00007  * Copyright (C) 2006 Refractions Research Inc.
    00008  * Copyright (C) 2001-2002 Vivid Solutions Inc.
    00009  *
    00010  * This is free software; you can redistribute and/or modify it under
    00011  * the terms of the GNU Lesser General Public Licence as published
    00012  * by the Free Software Foundation.
    00013  * See the COPYING file for more information.
    00014  *
    00015  **********************************************************************
    00016  *
    00017  * Last port: operation/polygonize/Polygonizer.java rev. 1.6 (JTS-1.10)
    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> // for LineStringAdder inheritance
    00028
    00029 #include <vector>
    00030
    00031 // Forward declarations
    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 { // geos::operation
    00048 namespace polygonize { // geos::operation::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                 //void filter_rw(geom::Geometry *g);
    00080                 void filter_ro(const geom::Geometry * g);
    00081         };
    00082
    00083         // default factory
    00084         LineStringAdder *lineStringAdder;
    00085
    00091         void add(const geom::LineString *line);
    00092
    00096         void polygonize();
    00097
    00099         void findValidRings(std::vector<EdgeRing*>& edgeRingList,
    00100                         std::vector<EdgeRing*> *validEdgeRingList,
    00101                         std::vector<geom::LineString*> *invalidRingList);
    00102
    00103         void findShellsAndHoles(std::vector<EdgeRing*> *edgeRingList);
    00104
    00105         static void assignHolesToShells(std::vector<EdgeRing*> *holeList,
    00106                         std::vector<EdgeRing*> *shellList);
    00107
    00108         static void assignHoleToShell(EdgeRing *holeER,
    00109                         std::vector<EdgeRing*> *shellList);
    00110
    00111 protected:
    00112
    00113         PolygonizeGraph *graph;
    00114
    00115         // initialize with empty collections, in case nothing is computed
    00116         std::vector<const geom::LineString*> *dangles;
    00117         std::vector<const geom::LineString*> *cutEdges;
    00118         std::vector<geom::LineString*> *invalidRingLines;
    00119
    00120         std::vector<EdgeRing*> *holeList;
    00121         std::vector<EdgeRing*> *shellList;
    00122         std::vector<geom::Polygon*> *polyList;
    00123
    00124 public:
    00125
    00130         Polygonizer();
    00131
    00132         ~Polygonizer();
    00133
    00142         void add(std::vector<geom::Geometry*> *geomList);
    00143
    00152         void add(std::vector<const geom::Geometry*> *geomList);
    00153
    00162         void add(geom::Geometry *g);
    00163
    00172         void add(const geom::Geometry *g);
    00173
    00181         std::vector<geom::Polygon*>* getPolygons();
    00182
    00188         std::vector<const geom::LineString*>* getDangles();
    00189
    00190
    00198         std::vector<const geom::LineString*>* getCutEdges();
    00199
    00209         std::vector<geom::LineString*>* getInvalidRingLines();
    00210
    00211 // This seems to be needed by    GCC 2.95.4
    00212 friend class Polygonizer::LineStringAdder;
    00213 };
    00214
    00215 } // namespace geos::operation::polygonize
    00216 } // namespace geos::operation
    00217 } // namespace geos
    00218
    00219 #endif // GEOS_OP_POLYGONIZE_POLYGONIZER_H
    00220
    00221 /**********************************************************************
    00222  * $Log$
    00223  * Revision 1.2  2006/06/12 17:15:29  strk
    00224  * Removed unused parameters warning
    00225  *
    00226  * Revision 1.1  2006/03/22 11:19:06  strk
    00227  * opPolygonize.h headers split.
    00228  *
    00229  **********************************************************************/