readGeometryTaggedTextWithOpts method
Geometry
readGeometryTaggedTextWithOpts(
- WKTTokenizer tokenizer,
- String type,
- List<
Ordinate> ordinateFlags
Implementation
Geometry readGeometryTaggedTextWithOpts(
WKTTokenizer tokenizer, String type, List<Ordinate> ordinateFlags) {
if (ordinateFlags.length == 2) {
ordinateFlags = getNextOrdinateFlags(tokenizer);
}
// if we can create a sequence with the required dimension everything is ok, otherwise
// we need to take a different coordinate sequence factory.
// It would be good to not have to try/catch this but if the CoordinateSequenceFactory
// exposed a value indicating which min/max dimension it can handle or even an
// ordinate bit-flag.
try {
csFactory.createSizeDimMeas(0, toDimension(ordinateFlags),
ordinateFlags.contains(Ordinate.M) ? 1 : 0);
} catch (e) {
geometryFactory = GeometryFactory(geometryFactory.getPrecisionModel(),
geometryFactory.getSRID(), csFactoryXYZM);
}
if (type.startsWith("POINT")) {
return readPointText(tokenizer, ordinateFlags);
} else if (type.startsWith("LINESTRING")) {
return readLineStringText(tokenizer, ordinateFlags);
} else if (type.startsWith("LINEARRING")) {
return readLinearRingText(tokenizer, ordinateFlags);
} else if (type.startsWith("POLYGON")) {
return readPolygonText(tokenizer, ordinateFlags);
} else if (type.startsWith("MULTIPOINT")) {
return readMultiPointText(tokenizer, ordinateFlags);
} else if (type.startsWith("MULTILINESTRING")) {
return readMultiLineStringText(tokenizer, ordinateFlags);
} else if (type.startsWith("MULTIPOLYGON")) {
return readMultiPolygonText(tokenizer, ordinateFlags);
} else if (type.startsWith("GEOMETRYCOLLECTION")) {
return readGeometryCollectionText(tokenizer, ordinateFlags);
}
var currentToken = tokenizer.currentToken();
throw ArgumentError(
"Unknown geometry type: ${currentToken.type} -> ${currentToken.value}");
}