GEOS 3.3.8

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

Polygonizer.h
1 /**********************************************************************
2 * $Id: Polygonizer.h 3255 2011-03-01 17:56:10Z mloskot $
3 *
4 * GEOS - Geometry Engine Open Source
5 * http://geos.refractions.net
6 *
7 * Copyright (C) 2010 Sandro Santilli <strk@keybit.net>
8 * Copyright (C) 2006 Refractions Research Inc.
9 * Copyright (C) 2001-2002 Vivid Solutions Inc.
10 *
11 * This is free software; you can redistribute and/or modify it under
12 * the terms of the GNU Lesser General Public Licence as published
13 * by the Free Software Foundation.
14 * See the COPYING file for more information.
15 *
16 **********************************************************************
17 *
18 * Last port: operation/polygonize/Polygonizer.java rev. 1.6 (JTS-1.10)
19 *
20 **********************************************************************/
21
22 #ifndef GEOS_OP_POLYGONIZE_POLYGONIZER_H
23 #define GEOS_OP_POLYGONIZE_POLYGONIZER_H
24
25 #include <geos/export.h>
26 #include <geos/geom/GeometryComponentFilter.h> // for LineStringAdder inheritance
27
28 #include <vector>
29
30 #ifdef _MSC_VER
31 #pragma warning(push)
32 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
33 #endif
34
35 // Forward declarations
36 namespace geos {
37 namespace geom {
38 class Geometry;
39 class LineString;
40 class Polygon;
41 }
42 namespace operation {
43 namespace polygonize {
44 class EdgeRing;
45 class PolygonizeGraph;
46 }
47 }
48 }
49
50 namespace geos {
51 namespace operation { // geos::operation
52 namespace polygonize { // geos::operation::polygonize
53
74 class GEOS_DLL Polygonizer {
75 private:
79 class GEOS_DLL LineStringAdder: public geom::GeometryComponentFilter {
80 public:
81 Polygonizer *pol;
82 LineStringAdder(Polygonizer *p);
83 //void filter_rw(geom::Geometry *g);
84 void filter_ro(const geom::Geometry * g);
85 };
86
87 // default factory
88 LineStringAdder lineStringAdder;
89
95 void add(const geom::LineString *line);
96
100 void polygonize();
101
102 void findValidRings(const std::vector<EdgeRing*>& edgeRingList,
103 std::vector<EdgeRing*>& validEdgeRingList,
104 std::vector<geom::LineString*>& invalidRingList);
105
106 void findShellsAndHoles(const std::vector<EdgeRing*>& edgeRingList);
107
108 static void assignHolesToShells(const std::vector<EdgeRing*>& holeList,
109 std::vector<EdgeRing*>& shellList);
110
111 static void assignHoleToShell(EdgeRing *holeER,
112 std::vector<EdgeRing*>& shellList);
113
114 protected:
115
116 PolygonizeGraph *graph;
117
118 // initialize with empty collections, in case nothing is computed
119 std::vector<const geom::LineString*> dangles;
120 std::vector<const geom::LineString*> cutEdges;
121 std::vector<geom::LineString*> invalidRingLines;
122
123 std::vector<EdgeRing*> holeList;
124 std::vector<EdgeRing*> shellList;
125 std::vector<geom::Polygon*> *polyList;
126
127 public:
128
133 Polygonizer();
134
135 ~Polygonizer();
136
145 void add(std::vector<geom::Geometry*> *geomList);
146
155 void add(std::vector<const geom::Geometry*> *geomList);
156
165 void add(geom::Geometry *g);
166
175 void add(const geom::Geometry *g);
176
184 std::vector<geom::Polygon*>* getPolygons();
185
193 const std::vector<const geom::LineString*>& getDangles();
194
195
203 const std::vector<const geom::LineString*>& getCutEdges();
204
213 const std::vector<geom::LineString*>& getInvalidRingLines();
214
215 // This seems to be needed by GCC 2.95.4
216 friend class Polygonizer::LineStringAdder;
217 };
218
219 } // namespace geos::operation::polygonize
220 } // namespace geos::operation
221 } // namespace geos
222
223 #ifdef _MSC_VER
224 #pragma warning(pop)
225 #endif
226
227 #endif // GEOS_OP_POLYGONIZE_POLYGONIZER_H
228
229 /**********************************************************************
230 * $Log$
231 * Revision 1.2 2006/06/12 17:15:29 strk
232 * Removed unused parameters warning
233 *
234 * Revision 1.1 2006/03/22 11:19:06 strk
235 * opPolygonize.h headers split.
236 *
237 **********************************************************************/