void AddSources(List <ShapeSource> sources) { if (sources == null || map == null) { return; } foreach (ShapeSource ss in sources) { if (ss.Id != null && ss.Shape != null) { var shape = ss.Shape.ToFeatureCollection(); var source = map.GetSource(ss.Id.Prefix()) as Sdk.Style.Sources.GeoJsonSource; if (source == null) { source = new Sdk.Style.Sources.GeoJsonSource(ss.Id.Prefix(), shape); map.AddSource(source); } else { source.SetGeoJson(shape); } } } }
private void addAllRoutes() { if (xMap.routes == null) { return; } // Subscribe all routes to their respective changes foreach (var route in xMap.routes) { route.PropertyChanged += Route_PropertyChanged; } var geoJsonSource = new GeoJsonSource(line_source_key, xMap.routes.toFeatureCollection()); nMap.AddSource(geoJsonSource); }
void AddSources(List <MapSource> sources) { if (sources == null || map == null) { return; } foreach (MapSource mapSource in sources) { if (mapSource.Id != null) { if (mapSource is ShapeSource shapeSource && shapeSource.Shape != null) { var shape = shapeSource.Shape.ToFeatureCollection(); var source = map.GetSource(shapeSource.Id.Prefix()) as Sdk.Style.Sources.GeoJsonSource; if (source == null) { source = new Sdk.Style.Sources.GeoJsonSource(shapeSource.Id.Prefix(), shape); map.AddSource(source); } else { source.SetGeoJson(shape); } } else if (mapSource is RasterSource rs) { var source = map.GetSource(rs.Id); if (source == null) { Sdk.Style.Sources.RasterSource rasterSource = new Sdk.Style.Sources.RasterSource(rs.Id, rs.ConfigurationURL, (int)rs.TileSize); map.AddSource(rasterSource); } } } }