GEOS  3.3.3
PolygonBuilder.h
1 /**********************************************************************
2  * $Id: PolygonBuilder.h 3283 2011-04-18 15:08:55Z strk $
3  *
4  * GEOS - Geometry Engine Open Source
5  * http://geos.refractions.net
6  *
7  * Copyright (C) 2006 Refractions Research Inc.
8  *
9  * This is free software; you can redistribute and/or modify it under
10  * the terms of the GNU Lesser General Public Licence as published
11  * by the Free Software Foundation.
12  * See the COPYING file for more information.
13  *
14  **********************************************************************
15  *
16  * Last port: operation/overlay/PolygonBuilder.java rev. 1.20 (JTS-1.10)
17  *
18  **********************************************************************/
19 
20 #ifndef GEOS_OP_OVERLAY_POLYGONBUILDER_H
21 #define GEOS_OP_OVERLAY_POLYGONBUILDER_H
22 
23 #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 
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 
92  bool containsPoint(const geom::Coordinate& p);
93 
94 private:
95 
96  const geom::GeometryFactory *geometryFactory;
97 
98  std::vector<geomgraph::EdgeRing*> shellList;
99 
107  void buildMaximalEdgeRings(
108  const std::vector<geomgraph::DirectedEdge*> *dirEdges,
109  std::vector<MaximalEdgeRing*> &maxEdgeRings);
110  // throw(const TopologyException &)
111 
112  void buildMinimalEdgeRings(
113  std::vector<MaximalEdgeRing*> &maxEdgeRings,
114  std::vector<geomgraph::EdgeRing*> &newShellList,
115  std::vector<geomgraph::EdgeRing*> &freeHoleList,
116  std::vector<MaximalEdgeRing*> &edgeRings);
117 
129  geomgraph::EdgeRing* findShell(std::vector<MinimalEdgeRing*>* minEdgeRings);
130 
142  void placePolygonHoles(geomgraph::EdgeRing *shell,
143  std::vector<MinimalEdgeRing*> *minEdgeRings);
144 
152  void sortShellsAndHoles(std::vector<MaximalEdgeRing*> &edgeRings,
153  std::vector<geomgraph::EdgeRing*> &newShellList,
154  std::vector<geomgraph::EdgeRing*> &freeHoleList);
155 
170  void placeFreeHoles(std::vector<geomgraph::EdgeRing*>& newShellList,
171  std::vector<geomgraph::EdgeRing*>& freeHoleList);
172  // throw(const TopologyException&)
173 
192  geomgraph::EdgeRing* findEdgeRingContaining(geomgraph::EdgeRing *testEr,
193  std::vector<geomgraph::EdgeRing*>& newShellList);
194 
195  std::vector<geom::Geometry*>* computePolygons(
196  std::vector<geomgraph::EdgeRing*>& newShellList);
197 
203 };
204 
205 } // namespace geos::operation::overlay
206 } // namespace geos::operation
207 } // namespace geos
208 
209 #ifdef _MSC_VER
210 #pragma warning(pop)
211 #endif
212 
213 #endif // ndef GEOS_OP_OVERLAY_POLYGONBUILDER_H
214 
215 /**********************************************************************
216  * $Log$
217  * Revision 1.3 2006/06/13 23:26:46 strk
218  * cleanups
219  *
220  * Revision 1.2 2006/03/20 12:33:45 strk
221  * Simplified some privat methods to use refs instead of pointers, added
222  * debugging section for failiures of holes/shells associations
223  *
224  * Revision 1.1 2006/03/17 13:24:59 strk
225  * opOverlay.h header splitted. Reduced header inclusions in operation/overlay implementation files. ElevationMatrixFilter code moved from own file to ElevationMatrix.cpp (ideally a class-private).
226  *
227  **********************************************************************/
228