GEOS  3.3.3
operation/polygonize/EdgeRing.h
1 /**********************************************************************
2  * $Id: EdgeRing.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) 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/EdgeRing.java rev. 109/138 (JTS-1.10)
18  *
19  **********************************************************************/
20 
21 
22 #ifndef GEOS_OP_POLYGONIZE_EDGERING_H
23 #define GEOS_OP_POLYGONIZE_EDGERING_H
24 
25 #include <geos/export.h>
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
35 namespace geos {
36  namespace geom {
37  class LineString;
38  class LinearRing;
39  class Polygon;
40  class CoordinateSequence;
41  class Geometry;
42  class GeometryFactory;
43  class Coordinate;
44  }
45  namespace planargraph {
46  class DirectedEdge;
47  }
48 }
49 
50 namespace geos {
51 namespace operation { // geos::operation
52 namespace polygonize { // geos::operation::polygonize
53 
58 class GEOS_DLL EdgeRing {
59 private:
60  const geom::GeometryFactory *factory;
61 
62  typedef std::vector<const planargraph::DirectedEdge*> DeList;
63  DeList deList;
64 
65  // cache the following data for efficiency
66  geom::LinearRing *ring;
67  geom::CoordinateSequence *ringPts;
68 
69  typedef std::vector<geom::Geometry*> GeomVect;
70  GeomVect *holes;
71 
78  geom::CoordinateSequence* getCoordinates();
79 
80  static void addEdge(const geom::CoordinateSequence *coords,
81  bool isForward,
82  geom::CoordinateSequence *coordList);
83 
84 public:
103  static EdgeRing* findEdgeRingContaining(
104  EdgeRing *testEr,
105  std::vector<EdgeRing*> *shellList);
106 
117  static const geom::Coordinate& ptNotInList(
118  const geom::CoordinateSequence *testPts,
119  const geom::CoordinateSequence *pts);
120 
129  static bool isInList(const geom::Coordinate &pt,
130  const geom::CoordinateSequence *pts);
131 
132  EdgeRing(const geom::GeometryFactory *newFactory);
133 
134  ~EdgeRing();
135 
141  void add(const planargraph::DirectedEdge *de);
142 
150  bool isHole();
151 
157  void addHole(geom::LinearRing *hole);
158 
167  geom::Polygon* getPolygon();
168 
173  bool isValid();
174 
183  geom::LineString* getLineString();
184 
192  geom::LinearRing* getRingInternal();
193 
201  geom::LinearRing* getRingOwnership();
202 };
203 
204 } // namespace geos::operation::polygonize
205 } // namespace geos::operation
206 } // namespace geos
207 
208 #ifdef _MSC_VER
209 #pragma warning(pop)
210 #endif
211 
212 #endif // GEOS_OP_POLYGONIZE_EDGERING_H
213 
214 /**********************************************************************
215  * $Log$
216  * Revision 1.2 2006/05/02 14:32:49 strk
217  * Added port info for polygonize/EdgeRing class, polygonize/EdgeRing.h header
218  * not installed.
219  *
220  * Revision 1.1 2006/03/22 11:19:06 strk
221  * opPolygonize.h headers split.
222  *
223  **********************************************************************/