GEOS 3.6.2
Polygonizer.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2010 Sandro Santilli <strk@keybit.net>
7 * Copyright (C) 2006 Refractions Research Inc.
8 * Copyright (C) 2001-2002 Vivid Solutions Inc.
9 *
10 * This is free software; you can redistribute and/or modify it under
11 * the terms of the GNU Lesser General Public Licence as published
12 * by the Free Software Foundation.
13 * See the COPYING file for more information.
14 *
15 **********************************************************************
16 *
17 * Last port: operation/polygonize/Polygonizer.java rev. 1.6 (JTS-1.10)
18 *
19 **********************************************************************/
20
21#ifndef GEOS_OP_POLYGONIZE_POLYGONIZER_H
22#define GEOS_OP_POLYGONIZE_POLYGONIZER_H
23
24#include <geos/export.h>
25#include <geos/geom/GeometryComponentFilter.h> // for LineStringAdder inheritance
26
27#include <vector>
28
29#ifdef _MSC_VER
30#pragma warning(push)
31#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
32#endif
33
34// Forward declarations
35namespace geos {
36 namespace geom {
37 class Geometry;
38 class LineString;
39 class Polygon;
40 }
41 namespace operation {
42 namespace polygonize {
43 class EdgeRing;
44 class PolygonizeGraph;
45 }
46 }
47}
48
49namespace geos {
50namespace operation { // geos::operation
51namespace polygonize { // geos::operation::polygonize
52
73class GEOS_DLL Polygonizer {
74private:
78 class GEOS_DLL LineStringAdder: public geom::GeometryComponentFilter {
79 public:
80 Polygonizer *pol;
81 LineStringAdder(Polygonizer *p);
82 //void filter_rw(geom::Geometry *g);
83 void filter_ro(const geom::Geometry * g);
84 };
85
86 // default factory
87 LineStringAdder lineStringAdder;
88
94 void add(const geom::LineString *line);
95
99 void polygonize();
100
101 void findValidRings(const std::vector<EdgeRing*>& edgeRingList,
102 std::vector<EdgeRing*>& validEdgeRingList,
103 std::vector<geom::LineString*>& invalidRingList);
104
105 void findShellsAndHoles(const std::vector<EdgeRing*>& edgeRingList);
106
107 static void assignHolesToShells(const std::vector<EdgeRing*>& holeList,
108 std::vector<EdgeRing*>& shellList);
109
110 static void assignHoleToShell(EdgeRing *holeER,
111 std::vector<EdgeRing*>& shellList);
112
113protected:
114
115 PolygonizeGraph *graph;
116
117 // initialize with empty collections, in case nothing is computed
118 std::vector<const geom::LineString*> dangles;
119 std::vector<const geom::LineString*> cutEdges;
120 std::vector<geom::LineString*> invalidRingLines;
121
122 std::vector<EdgeRing*> holeList;
123 std::vector<EdgeRing*> shellList;
124 std::vector<geom::Polygon*> *polyList;
125
126public:
127
133
134 ~Polygonizer();
135
144 void add(std::vector<geom::Geometry*> *geomList);
145
154 void add(std::vector<const geom::Geometry*> *geomList);
155
165
174 void add(const geom::Geometry *g);
175
183 std::vector<geom::Polygon*>* getPolygons();
184
192 const std::vector<const geom::LineString*>& getDangles();
193
194
202 const std::vector<const geom::LineString*>& getCutEdges();
203
212 const std::vector<geom::LineString*>& getInvalidRingLines();
213
214// This seems to be needed by GCC 2.95.4
215friend class Polygonizer::LineStringAdder;
216};
217
218} // namespace geos::operation::polygonize
219} // namespace geos::operation
220} // namespace geos
221
222#ifdef _MSC_VER
223#pragma warning(pop)
224#endif
225
226#endif // GEOS_OP_POLYGONIZE_POLYGONIZER_H
Definition GeometryComponentFilter.h:43
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:167
Definition LineString.h:70
Represents a linear polygon, which may include holes.
Definition Polygon.h:67
Represents a ring of PolygonizeDirectedEdge which form a ring of a polygon. The ring may be either an...
Definition operation/polygonize/EdgeRing.h:57
Represents a planar graph of edges that can be used to compute a polygonization, and implements the a...
Definition PolygonizeGraph.h:69
const std::vector< const geom::LineString * > & getDangles()
Get the list of dangling lines found during polygonization.
void add(std::vector< const geom::Geometry * > *geomList)
Add a collection of geometries to be polygonized. May be called multiple times. Any dimension of Geom...
std::vector< geom::Polygon * > * getPolygons()
Gets the list of polygons formed by the polygonization.
void add(const geom::Geometry *g)
const std::vector< const geom::LineString * > & getCutEdges()
Get the list of cut edges found during polygonization.
const std::vector< geom::LineString * > & getInvalidRingLines()
Get the list of lines forming invalid rings found during polygonization.
Polygonizer()
Create a polygonizer with the same GeometryFactory as the input Geometry.
void add(std::vector< geom::Geometry * > *geomList)
Add a collection of geometries to be polygonized. May be called multiple times. Any dimension of Geom...
Contains the Geometry interface hierarchy and supporting classes.
Definition IndexedNestedRingTester.h:26
Provides classes for implementing operations on geometries.
Definition IndexedNestedRingTester.h:40
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:25