private void initializeRoutesLayer() { // Use one source only var borderLinesLayer = new LineLayer(border_line_layer_key, line_source_key) .WithProperties( PropertyFactory.LineColor(Expression.Get(border_line_color_key)), PropertyFactory.LineWidth(Expression.Get(border_line_width_key)), PropertyFactory.LineJoin("round"), PropertyFactory.LineCap("round")); var linesLayer = new LineLayer(line_layer_key, line_source_key) .WithProperties( PropertyFactory.LineColor(Expression.Get(line_color_key)), PropertyFactory.LineWidth(Expression.Get(line_width_key)), PropertyFactory.LineJoin("round"), PropertyFactory.LineCap("round")); nMap.AddLayer(borderLinesLayer); nMap.AddLayer(linesLayer); }
void AddLayers(List <Layer> layers) { if (layers == null) { return; } foreach (Layer layer in layers) { if (string.IsNullOrEmpty(layer.Id)) { continue; } map.RemoveLayer(layer.Id.Prefix()); if (layer is CircleLayer) { var cross = (CircleLayer)layer; var source = map.GetSource(cross.SourceId.Prefix()); if (source == null) { continue; } map.AddLayer(cross.ToNative()); } else if (layer is LineLayer) { var cross = (LineLayer)layer; var source = map.GetSource(cross.SourceId.Prefix()); if (source == null) { continue; } map.AddLayer(cross.ToNative()); } } }