GEOS 3.2.2
|
00001 /********************************************************************** 00002 * $Id: PolygonBuilder.h 2556 2009-06-06 22:22:28Z 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 // Forward declarations 00028 namespace geos { 00029 namespace geom { 00030 class Geometry; 00031 class Coordinate; 00032 class GeometryFactory; 00033 } 00034 namespace geomgraph { 00035 class EdgeRing; 00036 class Node; 00037 class PlanarGraph; 00038 class DirectedEdge; 00039 } 00040 namespace operation { 00041 namespace overlay { 00042 class MaximalEdgeRing; 00043 class MinimalEdgeRing; 00044 } 00045 } 00046 } 00047 00048 namespace geos { 00049 namespace operation { // geos::operation 00050 namespace overlay { // geos::operation::overlay 00051 00057 class GEOS_DLL PolygonBuilder { 00058 public: 00059 00060 PolygonBuilder(const geom::GeometryFactory *newGeometryFactory); 00061 00062 ~PolygonBuilder(); 00063 00069 void add(geomgraph::PlanarGraph *graph); 00070 // throw(const TopologyException &) 00071 00077 void add(const std::vector<geomgraph::DirectedEdge*> *dirEdges, 00078 const std::vector<geomgraph::Node*> *nodes); 00079 // throw(const TopologyException &) 00080 00081 std::vector<geom::Geometry*>* getPolygons(); 00082 00087 bool containsPoint(const geom::Coordinate& p); 00088 00089 private: 00090 00091 const geom::GeometryFactory *geometryFactory; 00092 00093 std::vector<geomgraph::EdgeRing*> shellList; 00094 00101 std::vector<MaximalEdgeRing*>* buildMaximalEdgeRings( 00102 const std::vector<geomgraph::DirectedEdge*> *dirEdges); 00103 // throw(const TopologyException &) 00104 00105 std::vector<MaximalEdgeRing*>* buildMinimalEdgeRings( 00106 std::vector<MaximalEdgeRing*> *maxEdgeRings, 00107 std::vector<geomgraph::EdgeRing*> *newShellList, 00108 std::vector<geomgraph::EdgeRing*> *freeHoleList); 00120 geomgraph::EdgeRing* findShell(std::vector<MinimalEdgeRing*>* minEdgeRings); 00121 00133 void placePolygonHoles(geomgraph::EdgeRing *shell, 00134 std::vector<MinimalEdgeRing*> *minEdgeRings); 00135 00143 void sortShellsAndHoles(std::vector<MaximalEdgeRing*> *edgeRings, 00144 std::vector<geomgraph::EdgeRing*> *newShellList, 00145 std::vector<geomgraph::EdgeRing*> *freeHoleList); 00146 00161 void placeFreeHoles(std::vector<geomgraph::EdgeRing*>& newShellList, 00162 std::vector<geomgraph::EdgeRing*>& freeHoleList); 00163 // throw(const TopologyException&) 00164 00183 geomgraph::EdgeRing* findEdgeRingContaining(geomgraph::EdgeRing *testEr, 00184 std::vector<geomgraph::EdgeRing*>& newShellList); 00185 00186 std::vector<geom::Geometry*>* computePolygons( 00187 std::vector<geomgraph::EdgeRing*>& newShellList); 00188 00194 }; 00195 00196 00197 00198 } // namespace geos::operation::overlay 00199 } // namespace geos::operation 00200 } // namespace geos 00201 00202 #endif // ndef GEOS_OP_OVERLAY_POLYGONBUILDER_H 00203 00204 /********************************************************************** 00205 * $Log$ 00206 * Revision 1.3 2006/06/13 23:26:46 strk 00207 * cleanups 00208 * 00209 * Revision 1.2 2006/03/20 12:33:45 strk 00210 * Simplified some privat methods to use refs instead of pointers, added 00211 * debugging section for failiures of holes/shells associations 00212 * 00213 * Revision 1.1 2006/03/17 13:24:59 strk 00214 * 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). 00215 * 00216 **********************************************************************/ 00217