readMultiPolygonText method

MultiPolygon readMultiPolygonText(
  1. WKTTokenizer tokenizer,
  2. List<Ordinate> ordinateFlags
)

Creates a MultiPolygon 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 <MultiPolygon Text>. @return a MultiPolygon specified by the next token in the stream, or if if the coordinates used to create the Polygon shells and holes do not form closed linestrings. @throws IOException if an I/O error occurs @throws ParseException if an unexpected token was encountered

Implementation

MultiPolygon readMultiPolygonText(
    WKTTokenizer tokenizer, List<Ordinate> ordinateFlags) {
  String nextToken = getNextEmptyOrOpener(tokenizer);
  if (nextToken == EMPTY) {
    return geometryFactory.createMultiPolygonEmpty();
  }
  List<Polygon> polygons = [];
  do {
    Polygon polygon = readPolygonText(tokenizer, ordinateFlags);
    polygons.add(polygon);
    nextToken = getNextCloserOrComma(tokenizer);
  } while (nextToken == COMMA);
  return geometryFactory.createMultiPolygon(polygons);
}