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

PolygonizeGraph.h

00001 /**********************************************************************
00002  * $Id: PolygonizeGraph.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/PolygonizeGraph.java rev. 1.6 (JTS-1.10)
00018  *
00019  **********************************************************************/
00020 
00021 
00022 #ifndef GEOS_OP_POLYGONIZE_POLYGONIZEGRAPH_H
00023 #define GEOS_OP_POLYGONIZE_POLYGONIZEGRAPH_H
00024 
00025 #include <geos/export.h>
00026 
00027 #include <geos/planargraph/PlanarGraph.h> // for inheritance
00028 
00029 #include <vector>
00030 
00031 // Forward declarations
00032 namespace geos {
00033         namespace geom { 
00034                 class LineString;
00035                 class GeometryFactory;
00036                 class Coordinate;
00037                 class CoordinateSequence;
00038         }
00039         namespace planargraph { 
00040                 class Node;
00041                 class Edge;
00042                 class DirectedEdge;
00043         }
00044         namespace operation { 
00045                 namespace polygonize {
00046                         class EdgeRing;
00047                         class PolygonizeDirectedEdge;
00048                 }
00049         }
00050 }
00051 
00052 namespace geos {
00053 namespace operation { // geos::operation
00054 namespace polygonize { // geos::operation::polygonize
00055 
00056 
00066 class GEOS_DLL PolygonizeGraph: public planargraph::PlanarGraph {
00067 
00068 public:
00069 
00074         static void deleteAllEdges(planargraph::Node *node);
00075 
00080         PolygonizeGraph(const geom::GeometryFactory *newFactory);
00081 
00086         ~PolygonizeGraph();
00087 
00093         void addEdge(const geom::LineString *line);
00094 
00102         std::vector<EdgeRing*>* getEdgeRings();
00103 
00110         std::vector<const geom::LineString*>* deleteCutEdges();
00111 
00123         std::vector<const geom::LineString*>* deleteDangles();
00124 
00125 private:
00126 
00127         static int getDegreeNonDeleted(planargraph::Node *node);
00128 
00129         static int getDegree(planargraph::Node *node, long label);
00130 
00131         const geom::GeometryFactory *factory;
00132 
00133         planargraph::Node* getNode(const geom::Coordinate& pt);
00134 
00135         void computeNextCWEdges();
00136 
00145         void convertMaximalToMinimalEdgeRings(
00146                         std::vector<PolygonizeDirectedEdge*> *ringEdges);
00147 
00159         static std::vector<planargraph::Node*>* findIntersectionNodes(
00160                         PolygonizeDirectedEdge *startDE,
00161                         long label);
00162 
00167         static std::vector<PolygonizeDirectedEdge*>* findLabeledEdgeRings(
00168                         std::vector<planargraph::DirectedEdge*> &dirEdges);
00169 
00170         static void label(std::vector<planargraph::DirectedEdge*> &dirEdges, long label);
00171 
00172         static void computeNextCWEdges(planargraph::Node *node);
00173 
00181         static void computeNextCCWEdges(planargraph::Node *node, long label);
00182 
00192         static std::vector<planargraph::DirectedEdge*>* findDirEdgesInRing(
00193                         PolygonizeDirectedEdge *startDE);
00194 
00195         EdgeRing* findEdgeRing(PolygonizeDirectedEdge *startDE);
00196 
00197         /* Tese are for memory management */
00198         std::vector<planargraph::Edge *>newEdges;
00199         std::vector<planargraph::DirectedEdge *>newDirEdges;
00200         std::vector<planargraph::Node *>newNodes;
00201         std::vector<EdgeRing *>newEdgeRings;
00202         std::vector<geom::CoordinateSequence *>newCoords;
00203 };
00204 
00205 } // namespace geos::operation::polygonize
00206 } // namespace geos::operation
00207 } // namespace geos
00208 
00209 #endif // GEOS_OP_POLYGONIZE_POLYGONIZEGRAPH_H
00210 
00211 /**********************************************************************
00212  * $Log$
00213  * Revision 1.1  2006/03/22 11:19:06  strk
00214  * opPolygonize.h headers split.
00215  *
00216  **********************************************************************/

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