Skip to content

Commit

Permalink
Fix TaggedLineString to return correct vertex
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-jts committed Nov 5, 2024
1 parent dc34764 commit 6e3765d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,21 @@ public int size() {
return parentLine.getNumPoints();
}

/**
* Returns a vertex of the component,
* in either simplified or original form.
* Once the component is simplified a vertex of the simplified linework
* must be returned.
* Otherwise the simplified linework could be jumped by a flattened line
* which does not cross an original vertex, and so is reported as valid.
*
* @return a component vertex
*/
public Coordinate getComponentPoint() {
//-- simplified vertex
if (resultSegs.size() > 0)
return resultSegs.get(0).p0;
//-- original vertex
return getParentCoordinates()[1];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,7 @@ private void checkTPS(String wkt, double tolerance, String wktExpected) {
Geometry geom = read(wkt);
Geometry actual = TopologyPreservingSimplifier.simplify(geom, tolerance);
Geometry expected = read(wktExpected);
//TODO: add this once the "skipping over rings" problem is fixed
//checkValid(actual);
checkValid(actual);
checkEqual(expected, actual);
}

Expand Down

0 comments on commit 6e3765d

Please sign in to comment.