use of com.mongodb.client.model.geojson.NamedCoordinateReferenceSystem in project mongo-java-driver by mongodb.
the class GeometryDecoderHelper method decodeCoordinateReferenceSystem.
@Nullable
static CoordinateReferenceSystem decodeCoordinateReferenceSystem(final BsonReader reader) {
String crsName = null;
validateIsDocument(reader);
reader.readStartDocument();
while (reader.readBsonType() != BsonType.END_OF_DOCUMENT) {
String name = reader.readName();
if (name.equals("type")) {
String type = reader.readString();
if (!type.equals("name")) {
throw new CodecConfigurationException(format("Unsupported CoordinateReferenceSystem '%s'.", type));
}
} else if (name.equals("properties")) {
crsName = decodeCoordinateReferenceSystemProperties(reader);
} else {
throw new CodecConfigurationException(format("Found invalid key '%s' in the CoordinateReferenceSystem.", name));
}
}
reader.readEndDocument();
return crsName != null ? new NamedCoordinateReferenceSystem(crsName) : null;
}
Aggregations