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

# PolygonBuilder.h

    00001 /**********************************************************************
    00002  * $Id: PolygonBuilder.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  *
    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 #ifndef GEOS_OP_OVERLAY_POLYGONBUILDER_H
    00017 #define GEOS_OP_OVERLAY_POLYGONBUILDER_H
    00018
    00019 #include <vector>
    00020
    00021 // Forward declarations
    00022 namespace geos {
    00023         namespace geom {
    00024                 class Geometry;
    00025                 class Coordinate;
    00026                 class GeometryFactory;
    00027         }
    00028         namespace geomgraph {
    00029                 class EdgeRing;
    00030                 class Node;
    00031                 class PlanarGraph;
    00032                 class DirectedEdge;
    00033         }
    00034         namespace operation {
    00035                 namespace overlay {
    00036                         class MaximalEdgeRing;
    00037                         class MinimalEdgeRing;
    00038                 }
    00039         }
    00040 }
    00041
    00042 namespace geos {
    00043 namespace operation { // geos::operation
    00044 namespace overlay { // geos::operation::overlay
    00045
    00051 class PolygonBuilder {
    00052 public:
    00053
    00054         // CGAlgorithms argument is unused
    00055         PolygonBuilder(const geom::GeometryFactory *newGeometryFactory);
    00056
    00057         ~PolygonBuilder();
    00058
    00064         void add(geomgraph::PlanarGraph *graph); // throw(TopologyException *);
    00065
    00071         void add(const std::vector<geomgraph::DirectedEdge*> *dirEdges,
    00072                         const std::vector<geomgraph::Node*> *nodes);
    00073                         // throw(TopologyException *);
    00074
    00075         std::vector<geom::Geometry*>* getPolygons();
    00076
    00081         bool containsPoint(const geom::Coordinate& p);
    00082
    00083 private:
    00084
    00085         const geom::GeometryFactory *geometryFactory;
    00086
    00087         std::vector<geomgraph::EdgeRing*> shellList;
    00088
    00092         std::vector<MaximalEdgeRing*>* buildMaximalEdgeRings(
    00093                 const std::vector<geomgraph::DirectedEdge*> *dirEdges);
    00094
    00095         std::vector<MaximalEdgeRing*>* buildMinimalEdgeRings(
    00096                 std::vector<MaximalEdgeRing*> *maxEdgeRings,
    00097                 std::vector<geomgraph::EdgeRing*> *newShellList,
    00098                 std::vector<geomgraph::EdgeRing*> *freeHoleList);
    00110         geomgraph::EdgeRing* findShell(std::vector<MinimalEdgeRing*>* minEdgeRings);
    00111
    00123         void placePolygonHoles(geomgraph::EdgeRing *shell,
    00124                 std::vector<MinimalEdgeRing*> *minEdgeRings);
    00125
    00133         void sortShellsAndHoles(std::vector<MaximalEdgeRing*> *edgeRings,
    00134                 std::vector<geomgraph::EdgeRing*> *newShellList,
    00135                 std::vector<geomgraph::EdgeRing*> *freeHoleList);
    00136
    00149         void placeFreeHoles(std::vector<geomgraph::EdgeRing*>& newShellList,
    00150                 std::vector<geomgraph::EdgeRing*>& freeHoleList);
    00151
    00170         geomgraph::EdgeRing* findEdgeRingContaining(geomgraph::EdgeRing *testEr,
    00171                 std::vector<geomgraph::EdgeRing*>& newShellList);
    00172
    00173         std::vector<geom::Geometry*>* computePolygons(
    00174                         std::vector<geomgraph::EdgeRing*>& newShellList);
    00175
    00181 };
    00182
    00183
    00184
    00185 } // namespace geos::operation::overlay
    00186 } // namespace geos::operation
    00187 } // namespace geos
    00188
    00189 #endif // ndef GEOS_OP_OVERLAY_POLYGONBUILDER_H
    00190
    00191 /**********************************************************************
    00192  * $Log$
    00193  * Revision 1.3  2006/06/13 23:26:46  strk
    00194  * cleanups
    00195  *
    00196  * Revision 1.2  2006/03/20 12:33:45  strk
    00197  * Simplified some privat methods to use refs instead of pointers, added
    00198  * debugging section for failiures of holes/shells associations
    00199  *
    00200  * Revision 1.1  2006/03/17 13:24:59  strk
    00201  * 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).
    00202  *
    00203  **********************************************************************/
    00204