public string CreateLines(bool isCasing) { _sb = new StringBuilder(); string layerType = LayerUtils.GetLayerType(LayerWithSource); AppendLine($"{LayerUtils.NormaliseName(LayerWithSource.Id)}:"); _indent++; CreateFilterLines(isCasing); Layer casingLayer = null; if (refLayers != null && refLayers.Count > 0) { if (LayerUtils.IsCasing(LayerWithSource.Id)) { casingLayer = LayerWithSource; } else if (refLayers != null) { foreach (Layer refLayer in refLayers) { if (LayerUtils.IsCasing(refLayer.Id)) { casingLayer = refLayer; } } if (casingLayer != null) { refLayers.Remove(casingLayer); refLayers.Add(LayerWithSource); } } } CreateDrawLines(layerType, isCasing); _indent--; return(_sb.ToString()); }
private void ProcessSubLayer(Layer layer) { bool isCasing = LayerUtils.IsCasing(layer.Id); Paint paint = layer.Paint; Layout layout = layer.Layout; if (paint != null) { if (paint.FillColor != null) { ProcessColor(paint.FillColor, paint.FillOpacity, isCasing); } if (paint.FillOutlineColor != null) { ProcessColor(paint.FillOutlineColor, paint.FillOpacity, true); } if (paint.LineColor != null) { ProcessColor(paint.LineColor, paint.LineOpacity, isCasing); } if (paint.LineWidth != null) { ProcessWidth(paint.LineWidth, isCasing); } if (paint.TextColor != null || paint.TextHaloColor != null || paint.TextHaloWidth != null) { if (Font == null) { Font = new Font(); } if (paint.TextColor != null) { Font.Fill = Helper.ProcessColor(paint.TextColor, paint.TextOpacity); } if (paint.TextHaloColor != null || paint.TextHaloWidth != null) { if (Font.Stroke == null) { Font.Stroke = new Stroke(); } if (paint.TextHaloColor != null) { Font.Stroke.Color = Helper.ProcessColor(paint.TextHaloColor, null); } if (paint.TextHaloWidth != null) { Font.Stroke.Width = Math.Round((double)paint.TextHaloWidth).ToString(); } } } } if (layout != null) { if (layout.Visibility != null) { Visible = layout.Visibility == "visible"; } if (layout.LineCap != null) { Cap = Helper.ProcessStoppable(layout.LineCap); } if (layout.LineJoin != null) { Join = layout.LineJoin; } if (layout.TextField != null) { TextSource = GetTextField(layout.TextField, layer); } if ((layout.TextFont != null && layout.TextFont is List <string>) || layout.TextSize != null || layout.TextTransform != null) { if (Font == null) { Font = new Font(); } if (layout.TextFont != null) { Font.Family = Helper.ProcessFont(layout.TextFont); } if (layout.TextSize != null) { Font.Size = Helper.ProcessTextSize(layout.TextSize); } if (layout.TextTransform != null) { Font.Transform = layout.TextTransform; } } if (layer.Layout.IconImage != null) { Sprite = GetSprite(layer.Layout.IconImage); } } }