18#include <geos/geom/Coordinate.h>
19#include <geos/noding/SegmentIntersector.h>
20#include <geos/algorithm/LineIntersector.h>
21#include <geos/operation/valid/TopologyValidationError.h>
24#include <geos/export.h>
39class GEOS_DLL PolygonIntersectionAnalyzer :
public noding::SegmentIntersector {
40 using CoordinateXY = geos::geom::CoordinateXY;
45 algorithm::LineIntersector li;
46 bool m_hasDoubleTouch =
false;
47 bool isInvertedRingValid =
false;
48 int invalidCode = TopologyValidationError::oNoInvalidIntersection;
49 CoordinateXY invalidLocation;
50 CoordinateXY doubleTouchLocation;
52 int findInvalidIntersection(
53 const SegmentString* ss0, std::size_t segIndex0,
54 const SegmentString* ss1, std::size_t segIndex1);
57 const SegmentString* ss0,
const SegmentString* ss1,
58 const CoordinateXY& intPt);
61 const SegmentString* ss,
const CoordinateXY& intPt,
62 const CoordinateXY* e00,
const CoordinateXY* e01,
63 const CoordinateXY* e10,
const CoordinateXY* e11);
65 const CoordinateXY& prevCoordinateInRing(
66 const SegmentString* ringSS, std::size_t segIndex)
const;
68 bool isAdjacentInRing(
const SegmentString* ringSS,
69 std::size_t segIndex0, std::size_t segIndex1)
const;
79 PolygonIntersectionAnalyzer(
bool p_isInvertedRingValid)
80 : isInvertedRingValid(p_isInvertedRingValid)
81 , invalidLocation(CoordinateXY::getNull())
82 , doubleTouchLocation(CoordinateXY::getNull())
85 void processIntersections(
86 SegmentString* ss0, std::size_t segIndex0,
87 SegmentString* ss1, std::size_t segIndex1)
override;
89 bool isDone()
const override {
90 return isInvalid() || m_hasDoubleTouch;
93 bool isInvalid()
const
95 return invalidCode >= 0;
98 int getInvalidCode()
const
103 const CoordinateXY& getInvalidLocation()
const
105 return invalidLocation;
108 bool hasDoubleTouch()
const
110 return m_hasDoubleTouch;
113 const CoordinateXY& getDoubleTouchLocation()
const
115 return doubleTouchLocation;
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