setImageSourceCoordinates method

Future<CommandCompletion> setImageSourceCoordinates(
  1. String sourceId,
  2. List<LatLng> coordinates
)

Moves the image of an image source.

coordinates are the image's four corners, clockwise from the top left.

See mln_map_set_image_source_coordinates in the C API reference.

Errors:

  • Status.notFound when the style has no source named sourceId.
  • Status.invalidArgument when the source named sourceId isn't an image source.
  • Status.invalidState while the style isn't loaded, as MapHandle.setStyleUrl() describes.

Implementation

Future<CommandCompletion> setImageSourceCoordinates(
  String sourceId,
  List<LatLng> coordinates,
) => _command((arena, completion) {
  final nativecoordinates = arena<raw.mln_lat_lng>(
    coordinates.isEmpty ? 1 : coordinates.length,
  );
  for (var index = 0; index < coordinates.length; index++) {
    _writeLatLng(coordinates[index], arena, into: nativecoordinates + index);
  }
  return raw.mln_map_set_image_source_coordinates(
    _handle.raw,
    nativeStringView(sourceId, arena).value,
    nativecoordinates,
    coordinates.length,
    completion,
    nativeDiagnostic,
  );
});