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

# Polygonizer.h

    00001 /**********************************************************************
    00002  * $Id: Polygonizer.h 1880 2006-10-27 11:54:17Z 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
    00018 #ifndef GEOS_OP_POLYGONIZE_POLYGONIZER_H
    00019 #define GEOS_OP_POLYGONIZE_POLYGONIZER_H
    00020
    00021 #include <geos/geom/GeometryComponentFilter.h> // for LineStringAdder inheritance
    00022
    00023 #include <vector>
    00024
    00025 // Forward declarations
    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 { // geos::operation
    00042 namespace polygonize { // geos::operation::polygonize
    00043
    00064 class Polygonizer {
    00065 private:
    00069         class LineStringAdder: public geom::GeometryComponentFilter {
    00070         public:
    00071                 Polygonizer *pol;
    00072                 LineStringAdder(Polygonizer *p);
    00073                 //void filter_rw(geom::Geometry *g);
    00074                 void filter_ro(const geom::Geometry * g);
    00075         };
    00076
    00077         // default factory
    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         // initialize with empty collections, in case nothing is computed
    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 // This seems to be needed by    GCC 2.95.4
    00203 friend class Polygonizer::LineStringAdder;
    00204 };
    00205
    00206 } // namespace geos::operation::polygonize
    00207 } // namespace geos::operation
    00208 } // namespace geos
    00209
    00210 #endif // GEOS_OP_POLYGONIZE_POLYGONIZER_H
    00211
    00212 /**********************************************************************
    00213  * $Log$
    00214  * Revision 1.2  2006/06/12 17:15:29  strk
    00215  * Removed unused parameters warning
    00216  *
    00217  * Revision 1.1  2006/03/22 11:19:06  strk
    00218  * opPolygonize.h headers split.
    00219  *
    00220  **********************************************************************/