public override Path draw() { Path path = new Path(); path.Stroke = new SolidColorBrush(ViewerHelper.getColor(layer.lineColor)); path.Fill = new SolidColorBrush(ViewerHelper.getColor(layer.lineColor)); path.StrokeThickness = Math.Abs(this.parent.header.yMin) > 400 ? 0.2 : 0.01; FormattedText text = new FormattedText(ViewerHelper.swtichDXFSymbols(this.text), CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface(style.getFontFamily()), size, new SolidColorBrush(ViewerHelper.getColor(layer.lineColor))); text.MaxTextWidth = rectangleWidth; Geometry geometry = text.BuildGeometry(ViewerHelper.mapToWPF(anchor, parent)); path.Data = geometry; return(path); }
public override Path draw() { Path path = new Path(); TransformGroup transforms = new TransformGroup(); Point shiftedStart = ViewerHelper.mapToWPF(this.start, this.parent); this.text = ViewerHelper.swtichDXFSymbols(this.text); path.Stroke = new SolidColorBrush(ViewerHelper.getColor(layer.lineColor)); path.Fill = new SolidColorBrush(ViewerHelper.getColor(layer.lineColor)); path.StrokeThickness = Math.Abs(this.parent.header.yMin) > 400 ? 0.2 : 0.01; FormattedText text = new FormattedText(this.text, CultureInfo.CurrentCulture, FlowDirection.LeftToRight, new Typeface(style.getFontFamily()), .05 + this.size * (96 / 72), Brushes.White); //Adjust for difference in WPF text origin (top left) and DXF origin (bottom left) start.Y += text.Baseline; Geometry geometry = text.BuildGeometry(ViewerHelper.mapToWPF(this.start, this.parent)); transforms.Children.Add(style.getMirrorTransform(shiftedStart)); if (!this.text.Equals("")) { transforms.Children.Add(new RotateTransform(-angle, shiftedStart.X, shiftedStart.Y)); } path.Data = geometry; path.RenderTransform = transforms; return(path); }