convert method
- GeographicAreaType toType
override
Converts the geographic area to another type, if possible.
Parameters
- IN toType The GeographicAreaType to convert to.
Returns
- A GeographicArea object representing the converted area, or null if the conversion failed.
Implementation
@override
GeographicArea? convert(GeographicAreaType toType) {
final OperationResult resultString = staticMethod(
'GeographicArea',
'convert',
args: <String, dynamic>{
'toType': toType.id,
'fromType': GeographicAreaType.circle.id,
'radius': radius,
'centerCoordinates': centerCoordinates.toJson(),
},
);
if (resultString['gemApiError'] != 0) {
return null;
}
switch (toType) {
case GeographicAreaType.rectangle:
return RectangleGeographicArea.fromJson(resultString.data['result']);
case GeographicAreaType.circle:
return CircleGeographicArea.fromJson(resultString['result']);
case GeographicAreaType.polygon:
return PolygonGeographicArea.fromJson(resultString['result']);
case GeographicAreaType.tileCollection:
return TilesCollectionGeographicArea.init(resultString['result']);
case GeographicAreaType.undefined:
return RectangleGeographicArea(
topLeft: Coordinates(),
bottomRight: Coordinates(),
);
}
}