createEmpty method

Geometry createEmpty(
  1. int dimension
)

Creates an empty atomic geometry of the given dimension. If passed a dimension of -1 will create an empty {@link GeometryCollection}.

@param dimension the required dimension (-1, 0, 1 or 2) @return an empty atomic geometry of given dimension

Implementation

Geometry createEmpty(int dimension) {
  switch (dimension) {
    case -1:
      return createGeometryCollectionEmpty();
    case 0:
      return createPointEmpty();
    case 1:
      return createLineStringEmpty();
    case 2:
      return createPolygonEmpty();
    default:
      throw new ArgumentError("Invalid dimension: $dimension");
  }
}