GEOS
3.3.2
|
00001 /********************************************************************** 00002 * $Id: PolygonizeGraph.h 3255 2011-03-01 17:56:10Z mloskot $ 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/PolygonizeGraph.java rev. 6/138 (JTS-1.10) 00018 * 00019 **********************************************************************/ 00020 00021 #ifndef GEOS_OP_POLYGONIZE_POLYGONIZEGRAPH_H 00022 #define GEOS_OP_POLYGONIZE_POLYGONIZEGRAPH_H 00023 00024 #include <geos/export.h> 00025 00026 #include <geos/planargraph/PlanarGraph.h> // for inheritance 00027 00028 #include <vector> 00029 00030 #ifdef _MSC_VER 00031 #pragma warning(push) 00032 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class 00033 #endif 00034 00035 // Forward declarations 00036 namespace geos { 00037 namespace geom { 00038 class LineString; 00039 class GeometryFactory; 00040 class Coordinate; 00041 class CoordinateSequence; 00042 } 00043 namespace planargraph { 00044 class Node; 00045 class Edge; 00046 class DirectedEdge; 00047 } 00048 namespace operation { 00049 namespace polygonize { 00050 class EdgeRing; 00051 class PolygonizeDirectedEdge; 00052 } 00053 } 00054 } 00055 00056 namespace geos { 00057 namespace operation { // geos::operation 00058 namespace polygonize { // geos::operation::polygonize 00059 00060 00070 class GEOS_DLL PolygonizeGraph: public planargraph::PlanarGraph { 00071 00072 public: 00073 00078 static void deleteAllEdges(planargraph::Node *node); 00079 00084 PolygonizeGraph(const geom::GeometryFactory *newFactory); 00085 00090 ~PolygonizeGraph(); 00091 00097 void addEdge(const geom::LineString *line); 00098 00107 void getEdgeRings(std::vector<EdgeRing*>& edgeRingList); 00108 00118 void deleteCutEdges(std::vector<const geom::LineString*> &cutLines); 00119 00132 void deleteDangles(std::vector<const geom::LineString*> &dangleLines); 00133 00134 private: 00135 00136 static int getDegreeNonDeleted(planargraph::Node *node); 00137 00138 static int getDegree(planargraph::Node *node, long label); 00139 00140 const geom::GeometryFactory *factory; 00141 00142 planargraph::Node* getNode(const geom::Coordinate& pt); 00143 00144 void computeNextCWEdges(); 00145 00155 void convertMaximalToMinimalEdgeRings( 00156 std::vector<PolygonizeDirectedEdge*> &ringEdges); 00157 00168 static void findIntersectionNodes( PolygonizeDirectedEdge *startDE, 00169 long label, std::vector<planargraph::Node*>& intNodes 00170 ); 00171 00181 static void findLabeledEdgeRings( 00182 std::vector<planargraph::DirectedEdge*> &dirEdgesIn, 00183 std::vector<PolygonizeDirectedEdge*> &dirEdgesOut); 00184 00185 static void label(std::vector<planargraph::DirectedEdge*> &dirEdges, long label); 00186 00187 static void computeNextCWEdges(planargraph::Node *node); 00188 00196 static void computeNextCCWEdges(planargraph::Node *node, long label); 00197 00208 static void findDirEdgesInRing(PolygonizeDirectedEdge *startDE, 00209 std::vector<planargraph::DirectedEdge*>& edgesInRing); 00210 00211 EdgeRing* findEdgeRing(PolygonizeDirectedEdge *startDE); 00212 00213 /* Tese are for memory management */ 00214 std::vector<planargraph::Edge *> newEdges; 00215 std::vector<planargraph::DirectedEdge *> newDirEdges; 00216 std::vector<planargraph::Node *> newNodes; 00217 std::vector<EdgeRing *> newEdgeRings; 00218 std::vector<geom::CoordinateSequence *> newCoords; 00219 }; 00220 00221 } // namespace geos::operation::polygonize 00222 } // namespace geos::operation 00223 } // namespace geos 00224 00225 #ifdef _MSC_VER 00226 #pragma warning(pop) 00227 #endif 00228 00229 #endif // GEOS_OP_POLYGONIZE_POLYGONIZEGRAPH_H 00230 00231 /********************************************************************** 00232 * $Log$ 00233 * Revision 1.1 2006/03/22 11:19:06 strk 00234 * opPolygonize.h headers split. 00235 * 00236 **********************************************************************/