pixelsForLatLngs method

List<ScreenPoint> pixelsForLatLngs(
  1. List<LatLng> coordinates
)

Finds the screen points of several coordinates, as MapProjectionHandle.pixelForLatLng() does.

See mln_map_projection_pixels_for_lat_lngs in the C API reference.

Implementation

List<ScreenPoint> pixelsForLatLngs(List<LatLng> coordinates) =>
    withNativeArena((arena) {
      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,
        );
      }
      final outPoints = arena<raw.mln_screen_point>(
        coordinates.isEmpty ? 1 : coordinates.length,
      );
      _check(
        raw.mln_map_projection_pixels_for_lat_lngs(
          _handle.raw,
          nativecoordinates,
          coordinates.length,
          outPoints,
          nativeDiagnostic,
        ),
      );
      return List<ScreenPoint>.unmodifiable(
        List.generate(
          coordinates.length,
          (index) => _readScreenPoint(outPoints[index]),
        ),
      );
    });