GEOS  3.8.0dev
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 #include <geos/algorithm/locate/IndexedPointInAreaLocator.h>
24 
25 #include <vector>
26 
27 #ifdef _MSC_VER
28 #pragma warning(push)
29 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
30 #endif
31 
32 // Forward declarations
33 namespace geos {
34 namespace geom {
35 class Geometry;
36 class Coordinate;
37 class GeometryFactory;
38 }
39 namespace geomgraph {
40 class EdgeRing;
41 class Node;
42 class PlanarGraph;
43 class DirectedEdge;
44 }
45 namespace operation {
46 namespace overlay {
47 class MaximalEdgeRing;
48 class MinimalEdgeRing;
49 }
50 }
51 }
52 
53 namespace geos {
54 namespace operation { // geos::operation
55 namespace overlay { // geos::operation::overlay
56 
62 class GEOS_DLL PolygonBuilder {
63 public:
64 
65  PolygonBuilder(const geom::GeometryFactory* newGeometryFactory);
66 
67  ~PolygonBuilder();
68 
74  void add(geomgraph::PlanarGraph* graph);
75  // throw(const TopologyException &)
76 
82  void add(const std::vector<geomgraph::DirectedEdge*>* dirEdges,
83  const std::vector<geomgraph::Node*>* nodes);
84  // throw(const TopologyException &)
85 
86  std::vector<geom::Geometry*>* getPolygons();
87 
88 private:
89 
90  const geom::GeometryFactory* geometryFactory;
91 
92  std::vector<geomgraph::EdgeRing*> shellList;
93 
101  void buildMaximalEdgeRings(
102  const std::vector<geomgraph::DirectedEdge*>* dirEdges,
103  std::vector<MaximalEdgeRing*>& maxEdgeRings);
104  // throw(const TopologyException &)
105 
106  void buildMinimalEdgeRings(
107  std::vector<MaximalEdgeRing*>& maxEdgeRings,
108  std::vector<geomgraph::EdgeRing*>& newShellList,
109  std::vector<geomgraph::EdgeRing*>& freeHoleList,
110  std::vector<MaximalEdgeRing*>& edgeRings);
111 
123  geomgraph::EdgeRing* findShell(std::vector<MinimalEdgeRing*>* minEdgeRings);
124 
136  void placePolygonHoles(geomgraph::EdgeRing* shell,
137  std::vector<MinimalEdgeRing*>* minEdgeRings);
138 
146  void sortShellsAndHoles(std::vector<MaximalEdgeRing*>& edgeRings,
147  std::vector<geomgraph::EdgeRing*>& newShellList,
148  std::vector<geomgraph::EdgeRing*>& freeHoleList);
149 
150  struct FastPIPRing {
151  geomgraph::EdgeRing* edgeRing;
153  };
154 
169  void placeFreeHoles(std::vector<FastPIPRing>& newShellList,
170  std::vector<geomgraph::EdgeRing*>& freeHoleList);
171  // throw(const TopologyException&)
172 
191  geomgraph::EdgeRing* findEdgeRingContaining(geomgraph::EdgeRing* testEr,
192  std::vector<FastPIPRing>& 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
Determines the location of Coordinates relative to an areal geometry, using indexing for efficiency...
Definition: IndexedPointInAreaLocator.h:54
Forms Polygon out of a graph of geomgraph::DirectedEdge.
Definition: PolygonBuilder.h:62
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