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

# PolygonizeGraph.h

    00001 /**********************************************************************
    00002  * $Id: PolygonizeGraph.h 1820 2006-09-06 16:54:23Z 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
    00018 #ifndef GEOS_OP_POLYGONIZE_POLYGONIZEGRAPH_H
    00019 #define GEOS_OP_POLYGONIZE_POLYGONIZEGRAPH_H
    00020
    00021 #include <geos/planargraph/PlanarGraph.h> // for inheritance
    00022
    00023 #include <vector>
    00024
    00025 // Forward declarations
    00026 namespace geos {
    00027         namespace geom {
    00028                 class LineString;
    00029                 class GeometryFactory;
    00030                 class Coordinate;
    00031                 class CoordinateSequence;
    00032         }
    00033         namespace planargraph {
    00034                 class Node;
    00035                 class Edge;
    00036                 class DirectedEdge;
    00037         }
    00038         namespace operation {
    00039                 namespace polygonize {
    00040                         class EdgeRing;
    00041                         class PolygonizeDirectedEdge;
    00042                 }
    00043         }
    00044 }
    00045
    00046 namespace geos {
    00047 namespace operation { // geos::operation
    00048 namespace polygonize { // geos::operation::polygonize
    00049
    00050
    00060 class PolygonizeGraph: public planargraph::PlanarGraph {
    00061
    00062 public:
    00063
    00068         static void deleteAllEdges(planargraph::Node *node);
    00069
    00074         PolygonizeGraph(const geom::GeometryFactory *newFactory);
    00075
    00080         ~PolygonizeGraph();
    00081
    00087         void addEdge(const geom::LineString *line);
    00088
    00096         std::vector<EdgeRing*>* getEdgeRings();
    00097
    00104         std::vector<const geom::LineString*>* deleteCutEdges();
    00105
    00117         std::vector<const geom::LineString*>* deleteDangles();
    00118
    00119 private:
    00120
    00121         static int getDegreeNonDeleted(planargraph::Node *node);
    00122
    00123         static int getDegree(planargraph::Node *node, long label);
    00124
    00125         const geom::GeometryFactory *factory;
    00126
    00127         planargraph::Node* getNode(const geom::Coordinate& pt);
    00128
    00129         void computeNextCWEdges();
    00130
    00139         void convertMaximalToMinimalEdgeRings(
    00140                         std::vector<PolygonizeDirectedEdge*> *ringEdges);
    00141
    00153         static std::vector<planargraph::Node*>* findIntersectionNodes(
    00154                         PolygonizeDirectedEdge *startDE,
    00155                         long label);
    00156
    00161         static std::vector<PolygonizeDirectedEdge*>* findLabeledEdgeRings(
    00162                         std::vector<planargraph::DirectedEdge*> &dirEdges);
    00163
    00164         static void label(std::vector<planargraph::DirectedEdge*> &dirEdges, long label);
    00165
    00166         static void computeNextCWEdges(planargraph::Node *node);
    00167
    00175         static void computeNextCCWEdges(planargraph::Node *node, long label);
    00176
    00186         static std::vector<planargraph::DirectedEdge*>* findDirEdgesInRing(
    00187                         PolygonizeDirectedEdge *startDE);
    00188
    00189         EdgeRing* findEdgeRing(PolygonizeDirectedEdge *startDE);
    00190
    00191         /* Tese are for memory management */
    00192         std::vector<planargraph::Edge *>newEdges;
    00193         std::vector<planargraph::DirectedEdge *>newDirEdges;
    00194         std::vector<planargraph::Node *>newNodes;
    00195         std::vector<EdgeRing *>newEdgeRings;
    00196         std::vector<geom::CoordinateSequence *>newCoords;
    00197 };
    00198
    00199 } // namespace geos::operation::polygonize
    00200 } // namespace geos::operation
    00201 } // namespace geos
    00202
    00203 #endif // GEOS_OP_POLYGONIZE_POLYGONIZEGRAPH_H
    00204
    00205 /**********************************************************************
    00206  * $Log$
    00207  * Revision 1.1  2006/03/22 11:19:06  strk
    00208  * opPolygonize.h headers split.
    00209  *
    00210  **********************************************************************/