GEOS 3.6.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
34namespace geos {
35 namespace geom {
36 class LineString;
37 class LinearRing;
38 class Polygon;
40 class Geometry;
41 class GeometryFactory;
42 class Coordinate;
43 }
44 namespace planargraph {
45 class DirectedEdge;
46 }
47}
48
49namespace geos {
50namespace operation { // geos::operation
51namespace polygonize { // geos::operation::polygonize
52
57class GEOS_DLL EdgeRing {
58private:
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;
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
83public:
102 static EdgeRing* findEdgeRingContaining(
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
The internal representation of a list of coordinates inside a Geometry.
Definition CoordinateSequence.h:59
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:60
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition GeometryFactory.h:67
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:167
Definition LineString.h:70
Models an OGC SFS LinearRing.
Definition LinearRing.h:57
Represents a linear polygon, which may include holes.
Definition Polygon.h:67
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.
geom::LinearRing * getRingInternal()
Returns this ring as a LinearRing, or null if an Exception occurs while creating it (such as a topolo...
bool isHole()
Tests whether this ring is a hole.
static EdgeRing * findEdgeRingContaining(EdgeRing *testEr, std::vector< EdgeRing * > *shellList)
Find the innermost enclosing shell EdgeRing containing the argument EdgeRing, if any.
void add(const planargraph::DirectedEdge *de)
Adds a DirectedEdge which is known to form part of this ring.
geom::LinearRing * getRingOwnership()
Returns this ring as a LinearRing, or null if an Exception occurs while creating it (such as a topolo...
void addHole(geom::LinearRing *hole)
Adds a hole to the polygon formed by this ring.
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.
geom::LineString * getLineString()
Gets the coordinates for this ring as a LineString.
geom::Polygon * getPolygon()
Computes the Polygon formed by this ring and any contained holes.
bool isValid()
Tests if the LinearRing ring formed by this edge ring is topologically valid.
Represents a directed edge in a PlanarGraph.
Definition planargraph/DirectedEdge.h:46
Contains the Geometry interface hierarchy and supporting classes.
Definition IndexedNestedRingTester.h:26
Provides classes for implementing operations on geometries.
Definition IndexedNestedRingTester.h:40
Contains classes to implement a planar graph data structure.
Definition LineMergeDirectedEdge.h:32
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:25