GEOS  3.8.0dev
operation/polygonize/EdgeRing.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2006 Refractions Research Inc.
7  * Copyright (C) 2001-2002 Vivid Solutions 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/polygonize/EdgeRing.java rev. 109/138 (JTS-1.10)
17  *
18  **********************************************************************/
19 
20 
21 #ifndef GEOS_OP_POLYGONIZE_EDGERING_H
22 #define GEOS_OP_POLYGONIZE_EDGERING_H
23 
24 #include <geos/export.h>
25 
26 #include <vector>
27 
28 #ifdef _MSC_VER
29 #pragma warning(push)
30 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
31 #endif
32 
33 // Forward declarations
34 namespace geos {
35 namespace geom {
36 class LineString;
37 class LinearRing;
38 class Polygon;
39 class CoordinateSequence;
40 class Geometry;
41 class GeometryFactory;
42 class Coordinate;
43 }
44 namespace planargraph {
45 class DirectedEdge;
46 }
47 }
48 
49 namespace geos {
50 namespace operation { // geos::operation
51 namespace polygonize { // geos::operation::polygonize
52 
57 class GEOS_DLL EdgeRing {
58 private:
59  const geom::GeometryFactory* factory;
60 
61  typedef std::vector<const planargraph::DirectedEdge*> DeList;
62  DeList deList;
63 
64  // cache the following data for efficiency
65  geom::LinearRing* ring;
66  geom::CoordinateSequence* ringPts;
67 
68  typedef std::vector<geom::Geometry*> GeomVect;
69  GeomVect* holes;
70 
77  geom::CoordinateSequence* getCoordinates();
78 
79  static void addEdge(const geom::CoordinateSequence* coords,
80  bool isForward,
81  geom::CoordinateSequence* coordList);
82 
83 public:
102  static EdgeRing* findEdgeRingContaining(
103  EdgeRing* testEr,
104  std::vector<EdgeRing*>* shellList);
105 
116  static const geom::Coordinate& ptNotInList(
117  const geom::CoordinateSequence* testPts,
118  const geom::CoordinateSequence* pts);
119 
128  static bool isInList(const geom::Coordinate& pt,
129  const geom::CoordinateSequence* pts);
130 
131  EdgeRing(const geom::GeometryFactory* newFactory);
132 
133  ~EdgeRing();
134 
140  void add(const planargraph::DirectedEdge* de);
141 
149  bool isHole();
150 
156  void addHole(geom::LinearRing* hole);
157 
166  geom::Polygon* getPolygon();
167 
172  bool isValid();
173 
182  geom::LineString* getLineString();
183 
191  geom::LinearRing* getRingInternal();
192 
200  geom::LinearRing* getRingOwnership();
201 };
202 
203 } // namespace geos::operation::polygonize
204 } // namespace geos::operation
205 } // namespace geos
206 
207 #ifdef _MSC_VER
208 #pragma warning(pop)
209 #endif
210 
211 #endif // GEOS_OP_POLYGONIZE_EDGERING_H
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Represents a directed edge in a PlanarGraph.
Definition: planargraph/DirectedEdge.h:46
Definition: LineString.h:69
Represents a linear polygon, which may include holes.
Definition: Polygon.h:65
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.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
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
Models an OGC SFS LinearRing.
Definition: LinearRing.h:56
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:58