transformCoordinates method
Transforms a {@link CoordinateSequence}. This method should always return a valid coordinate list for the desired result type. (E.g. a coordinate list for a LineString must have 0 or at least 2 points). If this is not possible, return an empty sequence - this will be pruned out.
@param coords the coordinates to transform @param parent the parent geometry @return the transformed coordinates
Implementation
CoordinateSequence transformCoordinates(
CoordinateSequence coords, Geometry parent) {
List<Coordinate> inputPts = coords.toCoordinateArray();
List<Coordinate> newPts = List.empty(growable: true);
if (inputPts.length > 0) {
DouglasPeuckerLineSimplifier simplifier =
DouglasPeuckerLineSimplifier(inputPts);
simplifier.setDistanceTolerance(distanceTolerance);
newPts = simplifier.simplify();
}
return factory.getCoordinateSequenceFactory().create(newPts);
}