private void setSymbologyText(TextBox aTbx, NVCO.Text textItem) { Feature ft = textItem.Feature; aTbx.Foreground = ft.Color.getAsBrush(); aTbx.Opacity = 1.0 - (Double)ft.Transparency; }
protected void DrawGraphicItem(NVCO.Arc arcItem) { //if (null != clickSound) // clickSound.PlaySync(); SweepDirection dir = (arcItem.Deflection.getAsRadians() < 0.0) ? SweepDirection.Clockwise : SweepDirection.Counterclockwise; bool largeArc = (Math.Abs(arcItem.Deflection.getAsDegreesDouble()) > 180.0) ? true : false; PathGeometry pGeom = new PathGeometry(); PathFigure pFig = new PathFigure(); pFig.StartPoint = new WIN.Point(arcItem.Origin.x, arcItem.Origin.y); pFig.Segments.Add( new ArcSegment(new WIN.Point(arcItem.EndPt.x, arcItem.EndPt.y), new Size(arcItem.Radius, arcItem.Radius), arcItem.Rotation.getAsDegreesDouble(), largeArc, dir, true)); pGeom.Figures.Add(pFig); System.Windows.Shapes.Path path = new System.Windows.Shapes.Path(); path.Data = pGeom; path.Fill = Brushes.Transparent; //path.Stroke = Brushes.Black; //path.StrokeThickness = 2.5 * itemWidthUnscale; //path.StrokeThickness = 2.0; setSymbologyNonText(path, arcItem); //path.ToolTip = arcItem.GetToolTip(); path.RenderTransform = xformGroup_all; this.Children.Add(path); }
protected void DrawGraphicItem(NVCO.LineSegment lineSegment) { Line aLine = new Line(); aLine.X1 = lineSegment.Origin.x; aLine.Y1 = lineSegment.Origin.y; aLine.X2 = lineSegment.EndPt.x; aLine.Y2 = lineSegment.EndPt.y; aLine.HorizontalAlignment = HorizontalAlignment.Left; aLine.VerticalAlignment = VerticalAlignment.Bottom; setSymbologyNonText(aLine, lineSegment); //aLine.ToolTip = lineSegment.GetToolTip(); aLine.RenderTransform = xformGroup_all; this.Children.Add(aLine); }
protected void DrawGraphicItem(NVCO.Text textItem) { var scrnPt = xformGroup_all.Transform(textItem.Origin); var aTextBox = new TextBox(); aTextBox.FontFamily = new FontFamily("Arial"); Double candidateFontSize = textItem.Height * 72 / this.myCadViewPort.ScaleVector.y; if (candidateFontSize < 3) candidateFontSize = 3; aTextBox.FontSize = candidateFontSize; aTextBox.BorderBrush = Brushes.Transparent; aTextBox.Background = Brushes.Transparent; aTextBox.Margin = new Thickness(0, 0, 0, 0); aTextBox.BorderThickness = new Thickness(1, 1, 1, 1); if (aTextBox.FontSize > 10.6) aTextBox.Padding = new Thickness(0,0,0,0); else aTextBox.Padding = new Thickness(-6, -6, -6, -6); setSymbologyText(aTextBox, textItem); aTextBox.Text = textItem.Content; //aTextBox.ToolTip = textItem.GetToolTip(); aTextBox.RenderTransformOrigin = new WIN.Point(0, 0); var rotAboutPt = xformGroup_all.Transform(textItem.Origin); var xfrmGrp = new TransformGroup(); if (this.myCadViewPort.Rotation.getAsDegreesDouble() != 0.0) { xfrmGrp.Children.Add( new RotateTransform( -this.myCadViewPort.Rotation.getAsDegreesDouble() ) ); } if (textItem.Rotation.getAsDegreesDouble() != 0.0) { xfrmGrp.Children.Add( new RotateTransform( -1 * textItem.Rotation.getAsDegreesDouble() ) ); } aTextBox.RenderTransform = xfrmGrp; Canvas.SetLeft(aTextBox, scrnPt.X );/// this.myCadViewPort.ScaleVector.x); Canvas.SetTop(aTextBox, scrnPt.Y);/// this.myCadViewPort.ScaleVector.y); this.Children.Add(aTextBox); }