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

PolygonBuilder.h

00001 /**********************************************************************
00002  * $Id: PolygonBuilder.h 3283 2011-04-18 15:08:55Z strk $
00003  *
00004  * GEOS - Geometry Engine Open Source
00005  * http://geos.refractions.net
00006  *
00007  * Copyright (C) 2006 Refractions Research Inc.
00008  *
00009  * This is free software; you can redistribute and/or modify it under
00010  * the terms of the GNU Lesser General Public Licence as published
00011  * by the Free Software Foundation. 
00012  * See the COPYING file for more information.
00013  *
00014  **********************************************************************
00015  *
00016  * Last port: operation/overlay/PolygonBuilder.java rev. 1.20 (JTS-1.10)
00017  *
00018  **********************************************************************/
00019 
00020 #ifndef GEOS_OP_OVERLAY_POLYGONBUILDER_H
00021 #define GEOS_OP_OVERLAY_POLYGONBUILDER_H
00022 
00023 #include <geos/export.h>
00024 
00025 #include <vector>
00026 
00027 #ifdef _MSC_VER
00028 #pragma warning(push)
00029 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00030 #endif
00031 
00032 // Forward declarations
00033 namespace geos {
00034         namespace geom {
00035                 class Geometry;
00036                 class Coordinate;
00037                 class GeometryFactory;
00038         }
00039         namespace geomgraph {
00040                 class EdgeRing;
00041                 class Node;
00042                 class PlanarGraph;
00043                 class DirectedEdge;
00044         }
00045         namespace operation {
00046                 namespace overlay {
00047                         class MaximalEdgeRing;
00048                         class MinimalEdgeRing;
00049                 }
00050         }
00051 }
00052 
00053 namespace geos {
00054 namespace operation { // geos::operation
00055 namespace overlay { // geos::operation::overlay
00056 
00062 class GEOS_DLL PolygonBuilder {
00063 public:
00064 
00065         PolygonBuilder(const geom::GeometryFactory *newGeometryFactory);
00066 
00067         ~PolygonBuilder();
00068 
00074         void add(geomgraph::PlanarGraph *graph);
00075             // throw(const TopologyException &)
00076 
00082         void add(const std::vector<geomgraph::DirectedEdge*> *dirEdges,
00083                         const std::vector<geomgraph::Node*> *nodes);
00084                         // throw(const TopologyException &)
00085 
00086         std::vector<geom::Geometry*>* getPolygons();
00087 
00092         bool containsPoint(const geom::Coordinate& p);
00093 
00094 private:
00095 
00096         const geom::GeometryFactory *geometryFactory;
00097 
00098         std::vector<geomgraph::EdgeRing*> shellList;
00099 
00107         void buildMaximalEdgeRings(
00108                 const std::vector<geomgraph::DirectedEdge*> *dirEdges,
00109                 std::vector<MaximalEdgeRing*> &maxEdgeRings);
00110                         // throw(const TopologyException &)
00111 
00112         void buildMinimalEdgeRings(
00113                 std::vector<MaximalEdgeRing*> &maxEdgeRings,
00114                 std::vector<geomgraph::EdgeRing*> &newShellList,
00115                 std::vector<geomgraph::EdgeRing*> &freeHoleList,
00116                 std::vector<MaximalEdgeRing*> &edgeRings);
00117 
00129         geomgraph::EdgeRing* findShell(std::vector<MinimalEdgeRing*>* minEdgeRings);
00130 
00142         void placePolygonHoles(geomgraph::EdgeRing *shell,
00143                 std::vector<MinimalEdgeRing*> *minEdgeRings);
00144 
00152         void sortShellsAndHoles(std::vector<MaximalEdgeRing*> &edgeRings,
00153                 std::vector<geomgraph::EdgeRing*> &newShellList,
00154                 std::vector<geomgraph::EdgeRing*> &freeHoleList);
00155 
00170         void placeFreeHoles(std::vector<geomgraph::EdgeRing*>& newShellList,
00171                 std::vector<geomgraph::EdgeRing*>& freeHoleList);
00172                 // throw(const TopologyException&)
00173 
00192         geomgraph::EdgeRing* findEdgeRingContaining(geomgraph::EdgeRing *testEr,
00193                 std::vector<geomgraph::EdgeRing*>& newShellList);
00194 
00195         std::vector<geom::Geometry*>* computePolygons(
00196                         std::vector<geomgraph::EdgeRing*>& newShellList);
00197 
00203 };
00204 
00205 } // namespace geos::operation::overlay
00206 } // namespace geos::operation
00207 } // namespace geos
00208 
00209 #ifdef _MSC_VER
00210 #pragma warning(pop)
00211 #endif
00212 
00213 #endif // ndef GEOS_OP_OVERLAY_POLYGONBUILDER_H
00214 
00215 /**********************************************************************
00216  * $Log$
00217  * Revision 1.3  2006/06/13 23:26:46  strk
00218  * cleanups
00219  *
00220  * Revision 1.2  2006/03/20 12:33:45  strk
00221  * Simplified some privat methods to use refs instead of pointers, added
00222  * debugging section for failiures of holes/shells associations
00223  *
00224  * Revision 1.1  2006/03/17 13:24:59  strk
00225  * opOverlay.h header splitted. Reduced header inclusions in operation/overlay implementation files. ElevationMatrixFilter code moved from own file to ElevationMatrix.cpp (ideally a class-private).
00226  *
00227  **********************************************************************/
00228 

Generated on Tue Jun 5 14:58:09 2012 for GEOS by  doxygen 1.3.9.1