getBoundary method

Geometry getBoundary()
override

Computes the boundary of this geometry

@return a lineal geometry (which may be empty) @see Geometry#getBoundary

Implementation

Geometry getBoundary() {
  if (isEmpty()) {
    return getFactory().createMultiLineStringEmpty();
  }
  List<LinearRing> rings = []; //..length = holes!.length + 1;
  rings.add(shell!);
  // rings[0] = shell!;
  for (int i = 0; i < holes!.length; i++) {
    rings.add(holes![i]);
    // rings[i + 1] = holes![i];
  }
  // create LineString or MultiLineString as appropriate
  if (rings.length <= 1)
    return getFactory().createLinearRingSeq(rings[0].getCoordinateSequence());
  return getFactory().createMultiLineString(rings);
}