transformCoordinates method

CoordinateSequence transformCoordinates(
  1. CoordinateSequence coords,
  2. Geometry parent
)
override

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) {
  // for linear components (including rings), simplify the linestring
  if (parent is LineString) {
    TaggedLineString? taggedLine = linestringMap[parent];
    if (taggedLine != null) {
      return createCoordinateSequence(taggedLine.getResultCoordinates());
    }
  }
  // for anything else (e.g. points) just copy the coordinates
  return super.transformCoordinates(coords, parent);
}