Geometry.fromRaw constructor

Geometry.fromRaw(
  1. Geometry geometry
)

Creates a Geometry from a vt.Geometry instance.

Implementation

factory Geometry.fromRaw(vt.Geometry geometry) {
  if (geometry is vt.PointGeometry) {
    return Geometry.point(
      coordinates: _toOffset(geometry.coordinates),
    );
  } else if (geometry is vt.LineStringGeometry) {
    return Geometry.lineString(
      coordinates: _toPath(geometry.coordinates, false),
    );
  } else if (geometry is vt.PolygonGeometry) {
    return Geometry.polygon(
      coordinates: geometry.coordinates.map((e) => _toPath(e, true)).toList(),
    );
  } else {
    throw FlutterError('Geometry is unknown.');
  }
}