GEOS  3.9.1dev
PolygonBuilder.h
Go to the documentation of this file.
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>
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 
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 
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 {
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...
Forms Polygon out of a graph of geomgraph::DirectedEdge.
#define GEOS_DLL
Definition: export.h:28
Represents a directed graph which is embeddable in a planar surface.
algorithm::locate::IndexedPointInAreaLocator * pipLocator
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Basic namespace for all GEOS functionalities.
std::vector< geomgraph::EdgeRing * > shellList
const geom::GeometryFactory * geometryFactory