21 #ifndef GEOS_OP_POLYGONIZE_EDGERING_H
22 #define GEOS_OP_POLYGONIZE_EDGERING_H
24 #include <geos/export.h>
25 #include <geos/algorithm/locate/IndexedPointInAreaLocator.h>
26 #include <geos/operation/polygonize/PolygonizeDirectedEdge.h>
27 #include <geos/geom/Geometry.h>
28 #include <geos/geom/LinearRing.h>
29 #include <geos/geom/Polygon.h>
33 #include <geos/geom/Location.h>
37 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
44 class CoordinateSequence;
45 class GeometryFactory;
48 namespace planargraph {
60 namespace polygonize {
66 class GEOS_DLL EdgeRing {
68 const geom::GeometryFactory* factory;
70 typedef std::vector<const PolygonizeDirectedEdge*> DeList;
74 std::unique_ptr<geom::LinearRing> ring;
75 std::unique_ptr<geom::CoordinateArraySequence> ringPts;
76 std::unique_ptr<algorithm::locate::PointOnGeometryLocator> ringLocator;
78 std::unique_ptr<std::vector<std::unique_ptr<geom::LinearRing>>> holes;
80 EdgeRing* shell =
nullptr;
82 bool is_processed =
false;
83 bool is_included_set =
false;
84 bool is_included =
false;
85 bool visitedByUpdateIncludedRecursive =
false;
93 const geom::CoordinateSequence* getCoordinates();
95 static void addEdge(
const geom::CoordinateSequence* coords,
97 geom::CoordinateArraySequence* coordList);
99 algorithm::locate::PointOnGeometryLocator* getLocator() {
100 if (ringLocator ==
nullptr) {
101 ringLocator.reset(
new algorithm::locate::IndexedPointInAreaLocator(*getRingInternal()));
103 return ringLocator.get();
112 void add(
const PolygonizeDirectedEdge* de);
132 EdgeRing* findEdgeRingContaining(
const std::vector<EdgeRing*> & erList);
144 static std::vector<PolygonizeDirectedEdge*> findDirEdgesInRing(PolygonizeDirectedEdge* startDE);
156 static const geom::Coordinate& ptNotInList(
157 const geom::CoordinateSequence* testPts,
158 const geom::CoordinateSequence* pts);
168 static bool isInList(
const geom::Coordinate& pt,
169 const geom::CoordinateSequence* pts);
171 explicit EdgeRing(
const geom::GeometryFactory* newFactory);
173 ~EdgeRing() =
default;
175 void build(PolygonizeDirectedEdge* startDE);
186 bool isHole()
const {
193 bool isIncludedSet()
const {
194 return is_included_set;
200 bool isIncluded()
const {
204 void setIncluded(
bool included) {
205 is_included = included;
206 is_included_set =
true;
209 bool isProcessed()
const {
213 void setProcessed(
bool processed) {
214 is_processed = processed;
222 void setShell(EdgeRing* shellRing) {
231 bool hasShell()
const {
232 return shell !=
nullptr;
241 EdgeRing* getShell() {
242 return isHole() ? shell :
this;
251 bool isOuterHole()
const {
264 bool isOuterShell()
const {
265 return getOuterHole() !=
nullptr;
277 EdgeRing* getOuterHole()
const;
283 void updateIncludedRecursive();
290 void addHole(geom::LinearRing* hole);
292 void addHole(EdgeRing* holeER);
302 std::unique_ptr<geom::Polygon> getPolygon();
318 std::unique_ptr<geom::LineString> getLineString();
327 geom::LinearRing* getRingInternal();
336 std::unique_ptr<geom::LinearRing> getRingOwnership();
338 bool isInRing(
const geom::Coordinate & pt) {
351 #endif // GEOS_OP_POLYGONIZE_EDGERING_H