setStaticPosition method

Future<void> setStaticPosition(
  1. List<GeoPoint> geoPoints,
  2. String id
)
inherited

Implementation

Future<void> setStaticPosition(List<GeoPoint> geoPoints, String id) async {
  var listWithoutOrientation =
      geoPoints.skipWhile((p) => p is GeoPointWithOrientation).toList();
  if (listWithoutOrientation.isNotEmpty) {
    await interop.setStaticGeoPoints(
      mapIdMixin,
      id,
      listWithoutOrientation.map((point) => point.toGeoJS()).toList(),
    );
  }
  if (listWithoutOrientation.length != geoPoints.length) {
    List<GeoPointWithOrientation> listOrientation = geoPoints
        .where((p) => p is GeoPointWithOrientation)
        .map((e) => e as GeoPointWithOrientation)
        .toList();
    if (listOrientation.isNotEmpty) {
      await interop.setStaticGeoPointsWithOrientation(
        mapIdMixin,
        id,
        listOrientation.map((point) => point.toGeoJS()).toList(),
      );
    }
  }
}