Skip to content

Commit

Permalink
[web] add getSymbolLatLng and getLineLatLngs (#720)
Browse files Browse the repository at this point in the history
web implementations were missing
  • Loading branch information
m0nac0 authored Oct 24, 2021
1 parent 3cae2b9 commit 4c211fb
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions mapbox_gl_web/lib/src/mapbox_map_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ class MapboxMapController extends MapboxGlPlatform
symbolManager.update(symbol.id, changes);
}

@override
Future<LatLng> getSymbolLatLng(Symbol symbol) async {
var coordinates = symbolManager.getFeature(symbol.id)!.geometry.coordinates;
return LatLng(coordinates[1], coordinates[0]);
}

@override
Future<void> removeSymbols(Iterable<String> symbolsIds) async {
symbolManager.removeAll(symbolsIds);
Expand All @@ -189,6 +195,13 @@ class MapboxMapController extends MapboxGlPlatform
lineManager.update(line.id, changes);
}

@override
Future<List<LatLng>> getLineLatLngs(Line line) async {
List<dynamic> coordinates =
lineManager.getFeature(line.id)!.geometry.coordinates;
return coordinates.map((c) => LatLng(c[1], c[0])).toList();
}

@override
Future<void> removeLine(String lineId) async {
lineManager.remove(lineId);
Expand Down

0 comments on commit 4c211fb

Please sign in to comment.