From 52a86996371fa11d791919f2635aefadde292a3b Mon Sep 17 00:00:00 2001 From: Martin Davis Date: Tue, 5 Nov 2024 14:45:36 -0800 Subject: [PATCH 1/2] Fix TaggedLineString as per JTS 1096 --- src/simplify/TaggedLineString.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/simplify/TaggedLineString.cpp b/src/simplify/TaggedLineString.cpp index e0dc40ddbf..9a6d09324d 100644 --- a/src/simplify/TaggedLineString.cpp +++ b/src/simplify/TaggedLineString.cpp @@ -169,7 +169,7 @@ TaggedLineString::extractCoordinates( if(size) { for(std::size_t i = 0; i < size; i++) { - TaggedLineSegment* seg = segs[i]; + TaggedLineSegment* seg = segs[i]; assert(seg); pts->add(seg->p0); } @@ -185,7 +185,6 @@ TaggedLineString::extractCoordinates( const Coordinate& TaggedLineString::getCoordinate(std::size_t i) const { - return parentLine->getCoordinateN(i); } @@ -198,6 +197,10 @@ TaggedLineString::size() const const Coordinate& TaggedLineString::getComponentPoint() const { + //-- when simplified use a valid coordinate + if (resultSegs.size() > 0) { + return resultSegs[0]->p0; + } return getParentCoordinates()->getAt(1); } From 51c3b3d8a74864e7b05916c27e57ed95036301b4 Mon Sep 17 00:00:00 2001 From: Martin Davis Date: Tue, 5 Nov 2024 16:26:54 -0800 Subject: [PATCH 2/2] Update NEWS --- NEWS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS.md b/NEWS.md index ee77dbf89c..c85d46c926 100644 --- a/NEWS.md +++ b/NEWS.md @@ -12,6 +12,7 @@ - DouglasPeuckerLineSimplifier, avoid crash with Point input and NaN tolerance (GH-1078, Dan Baston) - GEOSLineSubstring, avoid crash with NaN length fraction (GH-1077, Dan Baston) - MinimumClearance, avoid crash on NaN inputs (GH-1079, Dan Baston) + - Fix TopologyPreservingSimplifier/TaggedLineString to avoid jumping components (JTS-1096, Martin Davis) ## Changes in 3.12.2 2024-06-05