62class GEOS_DLL PolygonHoleJoiner {
74 const Polygon* inputPolygon;
77 std::unique_ptr<CoordinateSequence> shellRing;
78 std::vector<std::unique_ptr<CoordinateSequence>> holeRings;
81 std::vector<bool> isHoleTouchingHint;
83 CoordinateSequence joinedRing;
86 std::set<Coordinate> joinedPts;
88 std::unique_ptr<SegmentSetMutualIntersector> boundaryIntersector;
91 std::vector<std::unique_ptr<BasicSegmentString>> polySegStringStore;
95 class InteriorIntersectionDetector;
96 friend class PolygonHoleJoiner::InteriorIntersectionDetector;
99 void extractOrientedRings(
const Polygon* polygon);
100 static std::unique_ptr<CoordinateSequence> extractOrientedRing(
const LinearRing* ring,
bool isCW);
104 void joinHole(std::size_t
index,
const CoordinateSequence& holeCoords);
113 bool joinTouchingHole(
const CoordinateSequence& holeCoords);
124 std::size_t findHoleTouchIndex(
const CoordinateSequence& holeCoords);
131 void joinNonTouchingHole(
132 const CoordinateSequence& holeCoords);
134 const Coordinate& findJoinableVertex(
135 const Coordinate& holeJoinCoord);
147 std::size_t findJoinIndex(
148 const Coordinate& joinCoord,
149 const Coordinate& holeJoinCoord);
160 static bool isLineInterior(
161 const CoordinateSequence& ring,
162 std::size_t ringIndex,
163 const Coordinate& linePt);
165 static std::size_t prev(std::size_t i, std::size_t size);
166 static std::size_t next(std::size_t i, std::size_t size);
181 std::size_t joinIndex,
182 const CoordinateSequence& holeCoords,
183 std::size_t holeJoinIndex);
195 std::vector<Coordinate> createHoleSection(
196 const CoordinateSequence& holeCoords,
197 std::size_t holeJoinIndex,
198 const Coordinate& joinPt);
206 static std::vector<const LinearRing*> sortHoles(
207 const Polygon* poly);
209 static std::size_t findLowestLeftVertexIndex(
210 const CoordinateSequence& holeCoords);
220 bool intersectsBoundary(
221 const Coordinate& p0,
222 const Coordinate& p1);
224 std::unique_ptr<SegmentSetMutualIntersector> createBoundaryIntersector();
229 PolygonHoleJoiner(
const Polygon* p_inputPolygon)
230 : inputPolygon(p_inputPolygon)
231 , boundaryIntersector(
nullptr)
242 const Polygon* p_inputPolygon);
251 static std::unique_ptr<CoordinateSequence>
join(
252 const Polygon* p_inputPolygon);
259 std::unique_ptr<CoordinateSequence>
compute();