GEOS 3.14.0dev
overlay/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#pragma once
20
21#include <geos/export.h>
22#include <geos/algorithm/locate/IndexedPointInAreaLocator.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
32namespace geos {
33namespace geom {
34class Geometry;
35class Coordinate;
36class GeometryFactory;
37}
38namespace geomgraph {
39class EdgeRing;
40class Node;
41class PlanarGraph;
42class DirectedEdge;
43}
44namespace operation {
45namespace overlay {
46class MaximalEdgeRing;
47class MinimalEdgeRing;
48}
49}
50}
51
52namespace geos {
53namespace operation { // geos::operation
54namespace overlay { // geos::operation::overlay
55
61class GEOS_DLL PolygonBuilder {
62public:
63
64 PolygonBuilder(const geom::GeometryFactory* newGeometryFactory);
65
67
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<std::unique_ptr<geom::Geometry>> getPolygons();
86
87private:
88
89 const geom::GeometryFactory* geometryFactory;
90
91 std::vector<geomgraph::EdgeRing*> shellList;
92
100 void buildMaximalEdgeRings(
101 const std::vector<geomgraph::DirectedEdge*>* dirEdges,
102 std::vector<MaximalEdgeRing*>& maxEdgeRings);
103 // throw(const TopologyException &)
104
105 void buildMinimalEdgeRings(
106 std::vector<MaximalEdgeRing*>& maxEdgeRings,
107 std::vector<geomgraph::EdgeRing*>& newShellList,
108 std::vector<geomgraph::EdgeRing*>& freeHoleList,
109 std::vector<MaximalEdgeRing*>& edgeRings);
110
122 geomgraph::EdgeRing* findShell(std::vector<MinimalEdgeRing*>* minEdgeRings);
123
135 void placePolygonHoles(geomgraph::EdgeRing* shell,
136 std::vector<MinimalEdgeRing*>* minEdgeRings);
137
145 void sortShellsAndHoles(std::vector<MaximalEdgeRing*>& edgeRings,
146 std::vector<geomgraph::EdgeRing*>& newShellList,
147 std::vector<geomgraph::EdgeRing*>& freeHoleList);
148
149 struct FastPIPRing {
150 geomgraph::EdgeRing* edgeRing;
152 };
153
168 void placeFreeHoles(std::vector<FastPIPRing>& newShellList,
169 std::vector<geomgraph::EdgeRing*>& freeHoleList);
170 // throw(const TopologyException&)
171
190 geomgraph::EdgeRing* findEdgeRingContaining(geomgraph::EdgeRing* testEr,
191 std::vector<FastPIPRing>& newShellList);
192
193 std::vector<std::unique_ptr<geom::Geometry>> computePolygons(
194 std::vector<geomgraph::EdgeRing*>& newShellList);
195
201};
202
203} // namespace geos::operation::overlay
204} // namespace geos::operation
205} // namespace geos
206
207#ifdef _MSC_VER
208#pragma warning(pop)
209#endif
210
Determines the location of Coordinates relative to an areal geometry, using indexing for efficiency.
Definition IndexedPointInAreaLocator.h:54
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition GeometryFactory.h:70
Definition geomgraph/EdgeRing.h:57
Represents a directed graph which is embeddable in a planar surface.
Definition geomgraph/PlanarGraph.h:72
Forms Polygon out of a graph of geomgraph::DirectedEdge.
Definition overlay/PolygonBuilder.h:61
void add(const std::vector< geomgraph::DirectedEdge * > *dirEdges, const std::vector< geomgraph::Node * > *nodes)
void add(geomgraph::PlanarGraph *graph)
Basic namespace for all GEOS functionalities.
Definition geos.h:39