18#include <geos/export.h>
20#include <geos/geom/Coordinate.h>
21#include <geos/operation/valid/PolygonIntersectionAnalyzer.h>
22#include <geos/operation/valid/PolygonRing.h>
23#include <geos/noding/BasicSegmentString.h>
38class GEOS_DLL PolygonTopologyAnalyzer {
39 using CoordinateXY = geos::geom::CoordinateXY;
48 bool isInvertedRingValid =
false;
49 PolygonIntersectionAnalyzer segInt;
50 std::vector<PolygonRing*> polyRings;
51 geom::CoordinateXY disconnectionPt;
56 std::deque<PolygonRing> polyRingStore;
57 std::deque<noding::BasicSegmentString> segStringStore;
62 std::vector<std::unique_ptr<CoordinateSequence>> coordSeqStore;
64 PolygonRing* createPolygonRing(
const LinearRing* p_ring);
65 PolygonRing* createPolygonRing(
const LinearRing* p_ring,
int p_index, PolygonRing* p_shell);
67 static const CoordinateXY&
68 findNonEqualVertex(
const LinearRing* ring,
const CoordinateXY& p);
87 static bool isIncidentSegmentInRing(
const CoordinateXY* p0,
const CoordinateXY* p1,
88 const CoordinateSequence* ringPts);
90 static const CoordinateXY& findRingVertexPrev(
const CoordinateSequence* ringPts,
91 std::size_t index,
const CoordinateXY& node);
93 static const CoordinateXY& findRingVertexNext(
const CoordinateSequence* ringPts,
94 std::size_t index,
const CoordinateXY& node);
96 static std::size_t ringIndexPrev(
const CoordinateSequence* ringPts, std::size_t index);
98 static std::size_t ringIndexNext(
const CoordinateSequence* ringPts, std::size_t index);
106 static std::size_t intersectingSegIndex(
const CoordinateSequence* ringPts,
const CoordinateXY* pt);
108 std::vector<SegmentString*> createSegmentStrings(
const Geometry* geom,
bool isInvertedRingValid);
110 std::vector<PolygonRing*> getPolygonRings(
const std::vector<SegmentString*>& segStrings);
112 SegmentString* createSegString(
const LinearRing* ring,
const PolygonRing* polyRing);
115 PolygonTopologyAnalyzer(
const PolygonTopologyAnalyzer& other) =
delete;
116 PolygonTopologyAnalyzer& operator=(
const PolygonTopologyAnalyzer& rhs) =
delete;
121 PolygonTopologyAnalyzer(
const Geometry* geom,
bool p_isInvertedRingValid);
129 static CoordinateXY findSelfIntersection(
const LinearRing* ring);
150 isRingNested(
const LinearRing* test,
151 const LinearRing* target);
153 bool hasInvalidIntersection() {
154 return segInt.isInvalid();
157 int getInvalidCode() {
158 return segInt.getInvalidCode();
161 const CoordinateXY& getInvalidLocation() {
162 return segInt.getInvalidLocation();
173 bool isInteriorDisconnected();
175 const CoordinateXY& getDisconnectionLocation()
const
177 return disconnectionPt;
193 void checkInteriorDisconnectedByHoleCycle();
204 void checkInteriorDisconnectedBySelfTouch();
The internal representation of a list of coordinates inside a Geometry.
Definition CoordinateSequence.h:56
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:197
Models an OGC SFS LinearRing. A LinearRing is a LineString which is both closed and simple.
Definition LinearRing.h:54
An interface for classes which represent a sequence of contiguous line segments.
Definition SegmentString.h:47
Basic namespace for all GEOS functionalities.
Definition geos.h:39