Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

Polygonizer.h

00001 /**********************************************************************
00002  * $Id: Polygonizer.h 2567 2009-06-08 16:58:42Z 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 
00098         void findValidRings(std::vector<EdgeRing*> *edgeRingList,
00099                         std::vector<EdgeRing*> *validEdgeRingList,
00100                         std::vector<geom::LineString*> *invalidRingList);
00101 
00102         void findShellsAndHoles(std::vector<EdgeRing*> *edgeRingList);
00103 
00104         static void assignHolesToShells(std::vector<EdgeRing*> *holeList,
00105                         std::vector<EdgeRing*> *shellList);
00106 
00107         static void assignHoleToShell(EdgeRing *holeER,
00108                         std::vector<EdgeRing*> *shellList);
00109 
00110 protected:
00111 
00112         PolygonizeGraph *graph;
00113 
00114         // initialize with empty collections, in case nothing is computed
00115         std::vector<const geom::LineString*> *dangles;
00116         std::vector<const geom::LineString*> *cutEdges;
00117         std::vector<geom::LineString*> *invalidRingLines;
00118 
00119         std::vector<EdgeRing*> *holeList;
00120         std::vector<EdgeRing*> *shellList;
00121         std::vector<geom::Polygon*> *polyList;
00122 
00123 public:
00124 
00129         Polygonizer();
00130 
00131         ~Polygonizer();
00132 
00141         void add(std::vector<geom::Geometry*> *geomList);
00142 
00151         void add(std::vector<const geom::Geometry*> *geomList);
00152 
00161         void add(geom::Geometry *g);
00162 
00171         void add(const geom::Geometry *g);
00172 
00180         std::vector<geom::Polygon*>* getPolygons();
00181 
00187         std::vector<const geom::LineString*>* getDangles();
00188 
00189 
00195         std::vector<const geom::LineString*>* getCutEdges();
00196 
00206         std::vector<geom::LineString*>* getInvalidRingLines();
00207 
00208 // This seems to be needed by    GCC 2.95.4
00209 friend class Polygonizer::LineStringAdder;
00210 };
00211 
00212 } // namespace geos::operation::polygonize
00213 } // namespace geos::operation
00214 } // namespace geos
00215 
00216 #endif // GEOS_OP_POLYGONIZE_POLYGONIZER_H
00217 
00218 /**********************************************************************
00219  * $Log$
00220  * Revision 1.2  2006/06/12 17:15:29  strk
00221  * Removed unused parameters warning
00222  *
00223  * Revision 1.1  2006/03/22 11:19:06  strk
00224  * opPolygonize.h headers split.
00225  *
00226  **********************************************************************/

Generated on Thu Jun 11 06:17:01 2009 for GEOS by  doxygen 1.4.4