//文本注记 private void btnMapLable_Click(object sender, RoutedEventArgs e) { GisSmartTools.Support.Layer curLayer = mapControl.focuslayer; if (curLayer == null) { curLayer = mapControl.mapcontent.layerlist[0]; } SelectField form = new SelectField(curLayer.featuresource.schema.fields.Keys.ToList()); if (form.ShowDialog() == true) { GisSmartTools.Support.Style style = curLayer.style; PortableFontDesc font = new PortableFontDesc(); if (form.font != null) { double size = form.font.Size; string fontname = form.font.Family.Source; bool italic = false; bool bold = false; if (form.font.Style != FontStyles.Normal) { italic = true; } if (form.font.Weight != FontWeights.Normal) { bold = true; } font = new PortableFontDesc(name: fontname, emsize: (int)size, isbold: bold, isitalic: italic, cleartype: false); } foreach (var rule in style.rulelist) { textsymbolizer sym = (textsymbolizer)rule.textsymbolizer; sym.visible = form.Checked; sym.attributename = form.field; if (form.font != null) { sym.color = form.font.BrushColor.Color; sym.font = font; } } if (style.rulelist.Count == 0) { var rule = style.defaultRule; textsymbolizer sym = (textsymbolizer)rule.textsymbolizer; sym.visible = form.Checked; sym.attributename = form.field; if (form.font != null) { sym.color = form.font.BrushColor.Color; sym.font = font; } } mapControl.mapcontrol_refresh(); //curLayer.IsLabelShown = true; //curLayer.LabelField = form.field; //mapControl.Refresh(); } }
public void LoadFromXML(XElement xmlApp, PortableFontDesc Font) { XElement xmlList = xmlApp.Element(this.GetType().Name); IEnumerable <XElement> elementsList = xmlList.Elements(); foreach (var element in elementsList) { ComponentInstance newDataType = new ComponentInstance(); newDataType.LoadFromXML(element); this.Add(newDataType); } DoSort(); }
public override void Render(RenderContext context) { base.Render(context); PortableFontDesc typefaceFont = AutosarApplication.GetInstance().ComponentNameFont; /* Draw component name*/ GlyphFont glyphFont = LetterGlyphTool.GetFont(typefaceFont); int width = glyphFont.GetTextWidth(Name); int textHeight = glyphFont.GetTextHeight(Name); Point textCoord = Painter.Center; textCoord.Y = Painter.Top; textCoord = context.GetImageCoordinate(textCoord); textCoord.Y += textHeight; textCoord.X -= (double)width / 2; context.Bitmap.DrawString((int)textCoord.X, (int)textCoord.Y, Colors.Black, AutosarApplication.GetInstance().ComponentNameFont, Name); }
public void UpdateFontAccordingScale(double newScale) { double componentsFontNewSize = DefaultComponentFontSize * newScale; if ((int)componentsFontNewSize == 0) { componentsFontNewSize = 1; } int compDefFontSize = (int)(componentsFontNewSize - 2); if (compDefFontSize < 1) { compDefFontSize = 1; } ComponentNameFont = new PortableFontDesc(isbold: true, emsize: (int)componentsFontNewSize); PortsNamesFont = new PortableFontDesc(isbold: true, emsize: (int)componentsFontNewSize); ComponentDefinitionNameFont = new PortableFontDesc(isbold: false, emsize: compDefFontSize); }
public void SetLegendTextFont(FontInfo info) { legend.textcolor = info.BrushColor.Color; double size = info.Size; string fontname = info.Family.Source; bool italic = false; bool bold = false; if (info.Style != FontStyles.Normal) { italic = true; } if (info.Weight != FontWeights.Normal) { bold = true; } var font = new PortableFontDesc(name: fontname, emsize: (int)size, isbold: bold, isitalic: italic, cleartype: true); legend.font = font; Refresh(); }
public textsymbolizer() { this.sign = SymbolizerType.TEXT; font = new PortableFontDesc(emsize: 8); color = Colors.Black; }