private void Configure() { if (FeatureSet != null) { MyExtent = FeatureSet.Extent.Copy(); } _symbology = new LabelScheme(); }
private void importBtn_Click(object sender, EventArgs e) { ILabelScheme labelScheme = SerializeHelper.Open <ILabelScheme>("*.lbly|*.lbly"); if (labelScheme != null) { _layer.Symbology = labelScheme; UpdateCategories(); if (lbCategories.Items.Count > 0) { lbCategories.SelectedIndex = 0; } UpdateControls(); } else { MessageBox.Show("Failed to open file"); } }
private void Configure() { if (_featureSet != null) Envelope = _featureSet.Envelope; _symbology = new LabelScheme(); }
private void Configure() { if (_featureSet != null) MyExtent = _featureSet.Extent.Copy(); _symbology = new LabelScheme(); }
/// <summary> /// Translates the given style as point style and adds it to the given point scheme. /// </summary> /// <param name="scheme">The scheme the style gets added to.</param> /// <param name="labelScheme">The scheme the label definitions gets added to.</param> /// <param name="style">The style that gets translated.</param> private static void TranslatePointStyle(PointScheme scheme, ILabelScheme labelScheme, string style) { if (string.IsNullOrWhiteSpace(style)) { return; } var myStyle = style; int index = myStyle.IndexOf("(", StringComparison.Ordinal); if (index < 1) { return; } var toolname = myStyle.Substring(0, index); myStyle = myStyle.Substring(index + 1); switch (toolname) { case "PEN": { var color = GetColor(ref myStyle, Parameters.Color); var width = GetWidth(ref myStyle); var cat = new PointCategory(color, Symbology.PointShape.Rectangle, width) { FilterExpression = $"[style] = '{style}'", LegendText = style, Symbolizer = { ScaleMode = ScaleMode.Simple, Smoothing = false } }; scheme.AddCategory(cat); break; } case "LABEL": { var fontSize = GetFontSize(ref myStyle); var fontColor = GetColor(ref myStyle, Parameters.Color); var boxColor = GetColor(ref myStyle, Parameters.BoxColor); var haloColor = GetColor(ref myStyle, Parameters.HaloColor); var shadowColor = GetColor(ref myStyle, Parameters.ShadowColor); var angle = GetAngle(ref myStyle); var font = GetFontName(ref myStyle); var orientation = GetOrientation(ref myStyle); // create a transparent point category because the point is only used to position the label var cat = new PointCategory(Color.Transparent, Symbology.PointShape.Rectangle, 1) { FilterExpression = $"[style] = '{style}'", LegendText = style, Symbolizer = { ScaleMode = ScaleMode.Simple, Smoothing = false } }; scheme.AddCategory(cat); // create the label category only if the text column exists, otherwise we don't know where to take the text from if (hasTextField) { var lcat = new LabelCategory { Name = style, Expression = "[Text]", FilterExpression = $"[style] = '{style}'", Symbolizer = { ScaleMode = ScaleMode.Simple, Alignment = StringAlignment.Center, FontColor = fontColor, FontSize = (float)fontSize, Orientation = orientation } }; if (!string.IsNullOrWhiteSpace(font)) { lcat.Symbolizer.FontFamily = font; } if (angle != 0) { lcat.Symbolizer.Angle = angle; lcat.Symbolizer.UseAngle = true; } if (haloColor != Color.Empty) { lcat.Symbolizer.HaloColor = haloColor; lcat.Symbolizer.HaloEnabled = true; } if (boxColor != Color.Empty) { lcat.Symbolizer.BackColor = boxColor; lcat.Symbolizer.BackColorEnabled = true; } if (shadowColor != Color.Empty) { lcat.Symbolizer.DropShadowColor = shadowColor; lcat.Symbolizer.DropShadowEnabled = true; } labelScheme.Categories.Add(lcat); } break; } default: throw new NotImplementedException($"The translation of the point tool {toolname} is not yet implemented."); } }