public void Load(TitleAdornmentLayer layer) { Title = layer.Title; FontName = new FontFamily(layer.TitleFont.FontName); FontSize = (int)layer.TitleFont.Size; FontColor = layer.FontColor; IsBold = layer.TitleFont.IsBold; IsItalic = layer.TitleFont.IsItalic; IsStrikeout = layer.TitleFont.IsStrikeout; IsUnderline = layer.TitleFont.IsUnderline; Angle = layer.Rotation; TitleLocation = layer.Location; Left = layer.XOffsetInPixel; Top = layer.YOffsetInPixel; DoesAddHalo = layer.HaloPen != null; if (DoesAddHalo) { HaloColor = layer.HaloPen.Brush; HaloThickness = layer.HaloPen.Width; } IsEnableMask = layer.MaskFillColor != null; if (IsEnableMask) { MaskFillColor = layer.MaskFillColor; MaskOutlineColor = layer.MaskOutlineColor; MaskOutlineThickness = layer.MaskOutlineThickness; MaskMarginValue = layer.MaskMargin; } }
public void ChangePreview() { if (layer == null) { layer = new TitleAdornmentLayer(); } SetPropertiesForTitleAdronmentLayer(layer, SelectedTitle); BitmapImage bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); MemoryStream ms = new MemoryStream(); layer.DrawSample(ms, ImageWidth, ImageHeight); bitmapImage.StreamSource = ms; bitmapImage.EndInit(); PreviewSource = bitmapImage; }
public void AddTitlesToMap() { var map = GisEditor.ActiveMap; var layersToRemove = map.FixedAdornmentOverlay.Layers.OfType <TitleAdornmentLayer>().ToList(); layersToRemove.ForEach(l => map.FixedAdornmentOverlay.Layers.Remove(l)); foreach (TitleViewModel title in Titles) { if (!map.FixedAdornmentOverlay.Layers.Contains(title.ID)) { map.FixedAdornmentOverlay.Layers.Add(title.ID, new TitleAdornmentLayer()); } TitleAdornmentLayer layer = map.FixedAdornmentOverlay.Layers[title.ID] as TitleAdornmentLayer; SetPropertiesForTitleAdronmentLayer(layer, title); } }
private void SetPropertiesForTitleAdronmentLayer(TitleAdornmentLayer titleAdornmentLayer, TitleViewModel entity) { titleAdornmentLayer.Title = entity.Title; DrawingFontStyles drawingFontStyles = DrawingFontStyles.Regular; if (entity.IsBold) { drawingFontStyles = drawingFontStyles | DrawingFontStyles.Bold; } if (entity.IsItalic) { drawingFontStyles = drawingFontStyles | DrawingFontStyles.Italic; } if (entity.IsStrikeout) { drawingFontStyles = drawingFontStyles | DrawingFontStyles.Strikeout; } if (entity.IsUnderline) { drawingFontStyles = drawingFontStyles | DrawingFontStyles.Underline; } titleAdornmentLayer.TitleFont = new GeoFont(entity.FontName.Source, entity.FontSize, drawingFontStyles); titleAdornmentLayer.XOffsetInPixel = entity.Left; titleAdornmentLayer.YOffsetInPixel = entity.Top; titleAdornmentLayer.FontColor = entity.FontColor; titleAdornmentLayer.Rotation = entity.Angle; titleAdornmentLayer.Location = entity.TitleLocation; titleAdornmentLayer.HaloPen = entity.DoesAddHalo ? new GeoPen(entity.HaloColor, entity.HaloThickness) : null; if (entity.IsEnableMask) { titleAdornmentLayer.MaskFillColor = entity.MaskFillColor; titleAdornmentLayer.MaskOutlineColor = entity.MaskOutlineColor; titleAdornmentLayer.MaskOutlineThickness = entity.MaskOutlineThickness; titleAdornmentLayer.MaskMargin = entity.MaskMarginValue; } else { titleAdornmentLayer.MaskFillColor = null; titleAdornmentLayer.MaskOutlineColor = null; } }
public LabelPrinterLayerAdapter(TitleAdornmentLayer titleAdornmentLayer) { this.titleAdornmentLayer = titleAdornmentLayer; }