- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

# PolygonizeGraph.h

    00001 /**********************************************************************
    00002  * $Id: PolygonizeGraph.h 2730 2009-11-19 20:29:01Z 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
    00103         void getEdgeRings(std::vector<EdgeRing*>& edgeRingList);
    00104
    00114         void deleteCutEdges(std::vector<const geom::LineString*> &cutLines);
    00115
    00128         void deleteDangles(std::vector<const geom::LineString*> &dangleLines);
    00129
    00130 private:
    00131
    00132         static int getDegreeNonDeleted(planargraph::Node *node);
    00133
    00134         static int getDegree(planargraph::Node *node, long label);
    00135
    00136         const geom::GeometryFactory *factory;
    00137
    00138         planargraph::Node* getNode(const geom::Coordinate& pt);
    00139
    00140         void computeNextCWEdges();
    00141
    00151         void convertMaximalToMinimalEdgeRings(
    00152                         std::vector<PolygonizeDirectedEdge*> &ringEdges);
    00153
    00164         static void findIntersectionNodes( PolygonizeDirectedEdge *startDE,
    00165                         long label, std::vector<planargraph::Node*>& intNodes
    00166 );
    00167
    00177         static void findLabeledEdgeRings(
    00178                         std::vector<planargraph::DirectedEdge*> &dirEdgesIn,
    00179                         std::vector<PolygonizeDirectedEdge*> &dirEdgesOut);
    00180
    00181         static void label(std::vector<planargraph::DirectedEdge*> &dirEdges, long label);
    00182
    00183         static void computeNextCWEdges(planargraph::Node *node);
    00184
    00192         static void computeNextCCWEdges(planargraph::Node *node, long label);
    00193
    00204         static void findDirEdgesInRing(PolygonizeDirectedEdge *startDE,
    00205                 std::vector<planargraph::DirectedEdge*>& edgesInRing);
    00206
    00207         EdgeRing* findEdgeRing(PolygonizeDirectedEdge *startDE);
    00208
    00209         /* Tese are for memory management */
    00210         std::vector<planargraph::Edge *> newEdges;
    00211         std::vector<planargraph::DirectedEdge *> newDirEdges;
    00212         std::vector<planargraph::Node *> newNodes;
    00213         std::vector<EdgeRing *> newEdgeRings;
    00214         std::vector<geom::CoordinateSequence *> newCoords;
    00215 };
    00216
    00217 } // namespace geos::operation::polygonize
    00218 } // namespace geos::operation
    00219 } // namespace geos
    00220
    00221 #endif // GEOS_OP_POLYGONIZE_POLYGONIZEGRAPH_H
    00222
    00223 /**********************************************************************
    00224  * $Log$
    00225  * Revision 1.1  2006/03/22 11:19:06  strk
    00226  * opPolygonize.h headers split.
    00227  *
    00228  **********************************************************************/