readGeometryCollectionText method

GeometryCollection readGeometryCollectionText(
  1. WKTTokenizer tokenizer,
  2. List<Ordinate> ordinateFlags
)

Creates a GeometryCollection using the next token in the stream.

@param tokenizer tokenizer over a stream of text in Well-known Text format. The next tokens must form a <GeometryCollection Text>. @return a GeometryCollection specified by the next token in the stream @throws ParseException if the coordinates used to create a Polygon shell and holes do not form closed linestrings, or if an unexpected token was encountered @throws IOException if an I/O error occurs

Implementation

GeometryCollection readGeometryCollectionText(
    WKTTokenizer tokenizer, List<Ordinate> ordinateFlags) {
  String nextToken = getNextEmptyOrOpener(tokenizer);
  if (nextToken == EMPTY) {
    return geometryFactory.createGeometryCollectionEmpty();
  }
  List<Geometry> geometries = [];
  do {
    Geometry geometry = readGeometryTaggedText(tokenizer)!;
    geometries.add(geometry);
    nextToken = getNextCloserOrComma(tokenizer);
  } while (nextToken == COMMA);

  return geometryFactory.createGeometryCollection(geometries);
}