GEOS  3.7.2
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:
103  EdgeRing *testEr,
104  std::vector<EdgeRing*> *shellList);
105 
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 
141 
149  bool isHole();
150 
157 
167 
172  bool isValid();
173 
183 
192 
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
geos::operation::polygonize::EdgeRing::getRingOwnership
geom::LinearRing * getRingOwnership()
Returns this ring as a LinearRing, or null if an Exception occurs while creating it (such as a topolo...
geos::planargraph::DirectedEdge
Represents a directed edge in a PlanarGraph.
Definition: planargraph/DirectedEdge.h:46
geos::operation::polygonize::EdgeRing::isHole
bool isHole()
Tests whether this ring is a hole.
geos::operation::polygonize::EdgeRing::findEdgeRingContaining
static EdgeRing * findEdgeRingContaining(EdgeRing *testEr, std::vector< EdgeRing * > *shellList)
Find the innermost enclosing shell EdgeRing containing the argument EdgeRing, if any.
geos::operation::polygonize::EdgeRing::addHole
void addHole(geom::LinearRing *hole)
Adds a hole to the polygon formed by this ring.
geos::operation::polygonize::EdgeRing::getLineString
geom::LineString * getLineString()
Gets the coordinates for this ring as a LineString.
geos::geom::LinearRing
Models an OGC SFS LinearRing.
Definition: LinearRing.h:57
geos
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
geos::operation::polygonize::EdgeRing::isInList
static bool isInList(const geom::Coordinate &pt, const geom::CoordinateSequence *pts)
Tests whether a given point is in an array of points. Uses a value-based test.
geos::operation::polygonize::EdgeRing::getRingInternal
geom::LinearRing * getRingInternal()
Returns this ring as a LinearRing, or null if an Exception occurs while creating it (such as a topolo...
geos::operation::polygonize::EdgeRing::getPolygon
geom::Polygon * getPolygon()
Computes the Polygon formed by this ring and any contained holes.
geos::operation::polygonize::EdgeRing::add
void add(const planargraph::DirectedEdge *de)
Adds a DirectedEdge which is known to form part of this ring.
geos::geom::Polygon
Represents a linear polygon, which may include holes.
Definition: Polygon.h:67
geos::geom::Coordinate
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
geos::operation::polygonize::EdgeRing::ptNotInList
static const geom::Coordinate & ptNotInList(const geom::CoordinateSequence *testPts, const geom::CoordinateSequence *pts)
Finds a point in a list of points which is not contained in another list of points.
geos::operation::polygonize::EdgeRing
Represents a ring of PolygonizeDirectedEdge which form a ring of a polygon. The ring may be either an...
Definition: operation/polygonize/EdgeRing.h:57
geos::geom::CoordinateSequence
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:59
geos::operation::polygonize::EdgeRing::isValid
bool isValid()
Tests if the LinearRing ring formed by this edge ring is topologically valid.
geos::geom::GeometryFactory
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:67
geos::geom::LineString
Definition: LineString.h:70