GEOS  3.6.1
PolygonBuilder.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2006 Refractions Research Inc.
7  *
8  * This is free software; you can redistribute and/or modify it under
9  * the terms of the GNU Lesser General Public Licence as published
10  * by the Free Software Foundation.
11  * See the COPYING file for more information.
12  *
13  **********************************************************************
14  *
15  * Last port: operation/overlay/PolygonBuilder.java rev. 1.20 (JTS-1.10)
16  *
17  **********************************************************************/
18 
19 #ifndef GEOS_OP_OVERLAY_POLYGONBUILDER_H
20 #define GEOS_OP_OVERLAY_POLYGONBUILDER_H
21 
22 #include <geos/export.h>
23 
24 #include <vector>
25 
26 #ifdef _MSC_VER
27 #pragma warning(push)
28 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
29 #endif
30 
31 // Forward declarations
32 namespace geos {
33  namespace geom {
34  class Geometry;
35  class Coordinate;
36  class GeometryFactory;
37  }
38  namespace geomgraph {
39  class EdgeRing;
40  class Node;
41  class PlanarGraph;
42  class DirectedEdge;
43  }
44  namespace operation {
45  namespace overlay {
46  class MaximalEdgeRing;
47  class MinimalEdgeRing;
48  }
49  }
50 }
51 
52 namespace geos {
53 namespace operation { // geos::operation
54 namespace overlay { // geos::operation::overlay
55 
61 class GEOS_DLL PolygonBuilder {
62 public:
63 
64  PolygonBuilder(const geom::GeometryFactory *newGeometryFactory);
65 
66  ~PolygonBuilder();
67 
73  void add(geomgraph::PlanarGraph *graph);
74  // throw(const TopologyException &)
75 
81  void add(const std::vector<geomgraph::DirectedEdge*> *dirEdges,
82  const std::vector<geomgraph::Node*> *nodes);
83  // throw(const TopologyException &)
84 
85  std::vector<geom::Geometry*>* getPolygons();
86 
91  bool containsPoint(const geom::Coordinate& p);
92 
93 private:
94 
95  const geom::GeometryFactory *geometryFactory;
96 
97  std::vector<geomgraph::EdgeRing*> shellList;
98 
106  void buildMaximalEdgeRings(
107  const std::vector<geomgraph::DirectedEdge*> *dirEdges,
108  std::vector<MaximalEdgeRing*> &maxEdgeRings);
109  // throw(const TopologyException &)
110 
111  void buildMinimalEdgeRings(
112  std::vector<MaximalEdgeRing*> &maxEdgeRings,
113  std::vector<geomgraph::EdgeRing*> &newShellList,
114  std::vector<geomgraph::EdgeRing*> &freeHoleList,
115  std::vector<MaximalEdgeRing*> &edgeRings);
116 
128  geomgraph::EdgeRing* findShell(std::vector<MinimalEdgeRing*>* minEdgeRings);
129 
141  void placePolygonHoles(geomgraph::EdgeRing *shell,
142  std::vector<MinimalEdgeRing*> *minEdgeRings);
143 
151  void sortShellsAndHoles(std::vector<MaximalEdgeRing*> &edgeRings,
152  std::vector<geomgraph::EdgeRing*> &newShellList,
153  std::vector<geomgraph::EdgeRing*> &freeHoleList);
154 
169  void placeFreeHoles(std::vector<geomgraph::EdgeRing*>& newShellList,
170  std::vector<geomgraph::EdgeRing*>& freeHoleList);
171  // throw(const TopologyException&)
172 
191  geomgraph::EdgeRing* findEdgeRingContaining(geomgraph::EdgeRing *testEr,
192  std::vector<geomgraph::EdgeRing*>& newShellList);
193 
194  std::vector<geom::Geometry*>* computePolygons(
195  std::vector<geomgraph::EdgeRing*>& newShellList);
196 
202 };
203 
204 } // namespace geos::operation::overlay
205 } // namespace geos::operation
206 } // namespace geos
207 
208 #ifdef _MSC_VER
209 #pragma warning(pop)
210 #endif
211 
212 #endif // ndef GEOS_OP_OVERLAY_POLYGONBUILDER_H
Forms Polygon out of a graph of geomgraph::DirectedEdge.
Definition: PolygonBuilder.h:61
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Represents a directed graph which is embeddable in a planar surface.
Definition: geomgraph/PlanarGraph.h:75
Definition: geomgraph/EdgeRing.h:59
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:67
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25