Skip to content

Commit

Permalink
[web] add getSymbolLatLng and getLineLatLngs (#37)
Browse files Browse the repository at this point in the history
web implementations were missing
  • Loading branch information
m0nac0 committed Oct 26, 2021
1 parent 029182e commit c8b30ee
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions maplibre_gl_web/lib/src/mapbox_map_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@ class MaplibreMapController extends MapLibreGlPlatform
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 @@ -187,6 +193,13 @@ class MaplibreMapController extends MapLibreGlPlatform
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 c8b30ee

Please sign in to comment.