119 CoverageRing* ringForward;
120 std::size_t indexForward;
121 CoverageRing* ringOpp;
122 std::size_t indexOpp;
126 CoverageRing* p_ring, std::size_t p_index)
128 , ringForward(
nullptr)
133 if (p_p1.compareTo(p_p0) < 0) {
139 ringForward = p_ring;
140 indexForward = p_index;
144 void match(
const CoverageRingSegment* seg) {
145 bool isInvalid = checkInvalid(seg);
150 if (ringForward ==
nullptr) {
151 ringForward = seg->ringForward;
152 indexForward = seg->indexForward;
155 ringOpp = seg->ringOpp;
156 indexOpp = seg->indexOpp;
159 ringForward->markMatched(indexForward);
160 ringOpp->markMatched(indexOpp);
163 bool checkInvalid(
const CoverageRingSegment* seg)
const {
164 if (ringForward !=
nullptr && seg->ringForward !=
nullptr) {
165 ringForward->markInvalid(indexForward);
166 seg->ringForward->markInvalid(seg->indexForward);
169 if (ringOpp !=
nullptr && seg->ringOpp !=
nullptr) {
170 ringOpp->markInvalid(indexOpp);
171 seg->ringOpp->markInvalid(seg->indexOpp);
177 struct CoverageRingSegHash {
179 operator() (CoverageRingSegment
const* s)
const {
180 std::size_t h = std::hash<double>{}(s->p0.x);
181 h ^= (std::hash<double>{}(s->p0.y) << 1);
182 h ^= (std::hash<double>{}(s->p1.x) << 1);
183 return h ^ (std::hash<double>{}(s->p1.y) << 1);
187 struct CoverageRingSegEq {
189 operator() (CoverageRingSegment
const* lhs, CoverageRingSegment
const* rhs)
const {
190 return lhs->p0.x == rhs->p0.x
191 && lhs->p0.y == rhs->p0.y
192 && lhs->p1.x == rhs->p1.x
193 && lhs->p1.y == rhs->p1.y;
201 std::vector<const Geometry*> adjGeoms;
204 double gapWidth = 0.0;
205 std::vector<std::unique_ptr<CoveragePolygon>> m_adjCovPolygons;
206 std::deque<CoverageRing> coverageRingStore;
207 std::vector<std::unique_ptr<CoordinateSequence>> localCoordinateSequences;
208 std::deque<CoverageRingSegment> coverageRingSegmentStore;
210 typedef std::unordered_map<CoverageRingSegment*, CoverageRingSegment*, CoverageRingSegment::CoverageRingSegHash, CoverageRingSegment::CoverageRingSegEq> CoverageRingSegmentMap;
228 std::vector<const Geometry*>& adjPolygons);
245 std::vector<const Geometry*>& adjPolygons,
260 std::vector<const Geometry*>& adjPolygons);
279 static std::vector<std::unique_ptr<CoveragePolygon>>
280 toCoveragePolygons(
const std::vector<const Polygon*> polygons);
281 static std::vector<const Polygon*> extractPolygons(std::vector<const Geometry*>& geoms);
284 std::unique_ptr<Geometry> createEmptyResult();
303 void markMatchedSegments(
304 std::vector<CoverageRing*>& targetRings,
305 std::vector<CoverageRing*>& adjRings,
317 void markMatchedSegments(
318 std::vector<CoverageRing*>& rings,
320 CoverageRingSegmentMap& segmentMap);
322 CoverageRingSegment* createCoverageRingSegment(
323 CoverageRing* ring, std::size_t index);
334 void markInvalidInteractingSegments(
335 std::vector<CoverageRing*>& targetRings,
336 std::vector<CoverageRing*>& adjRings,
337 double distanceTolerance);
346 void markInvalidInteriorSegments(
347 std::vector<CoverageRing*>& targetRings,
348 std::vector<std::unique_ptr<CoveragePolygon>>& adjCovPolygons);
350 void markInvalidInteriorSection(
354 std::vector<std::unique_ptr<CoveragePolygon>>& adjCovPolygons );
356 void markInvalidInteriorSegment(
357 CoverageRing& ring, std::size_t i, CoveragePolygon* adjPoly);
359 void checkTargetRings(
360 std::vector<CoverageRing*>& targetRings,
361 std::vector<CoverageRing*>& adjRngs,
364 std::unique_ptr<Geometry> createInvalidLines(std::vector<CoverageRing*>& rings);
366 std::vector<CoverageRing*> createRings(
const Geometry* geom);
368 std::vector<CoverageRing*> createRings(std::vector<const Polygon*>& polygons);
370 void createRings(
const Polygon* poly, std::vector<CoverageRing*>& rings);
375 std::vector<CoverageRing*>& rings);
377 CoverageRing* createRing(
const LinearRing* ring,
bool isShell);