示例#1
0
        private void setSymbologyText(TextBox aTbx, NVCO.Text textItem)
        {
            Feature ft = textItem.Feature;

            aTbx.Foreground = ft.Color.getAsBrush();
            aTbx.Opacity    = 1.0 - (Double)ft.Transparency;
        }
示例#2
0
        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);
        }
示例#3
0
        public void setUpTestingModel_20140422()
        {
            setUpFeaturesForTestingModel();
             allGrahics = new List<Graphic>();
             this.AddGraphic(new LineSegment(1.0, 8.5, 13.2, 0.8));
             this.AddGraphic(new LineSegment(1.0, 2.5, 13.2, 9.5));
             this.AddGraphic(new LineSegment(0.0, 0.0, 0.5, 0.25));
             this.AddGraphic(new LineSegment(2.0, 1.0, 1.0, 1.0));

             this.AddGraphic(new LineSegment(0.0, 0.0, 1.5, 0.0));

             this.AddGraphic(new LineSegment(0.1, 0.0, -1.3, -1.3));
             this.AddGraphic(new LineSegment(0.1, 0.0, -1.3, -0.7));

             this.AddGraphic(new LineSegment(0.1, 0.0, 1.0, -1.0));
             this.AddGraphic(new LineSegment(0.1, 0.0, 1.3, -0.7));
             this.AddGraphic(new LineSegment(0.1, 0.0, 1.6, -1.6));
             this.AddGraphic(new Text("1.6, -0.6", new Point(1.6, -0.6), 0.25));
             this.AddGraphic(new Text("-2, +0.9", new Point(-2, 0.9), 0.45));

             var rotexPt = new Point(-1.1, -0.6);
             //var rotText = new Text("Rotated 1", rotexPt, 0.3);
             //rotText.Rotation = Angle.radiansFromDegree(1);
             //this.AddGraphic(rotText);

             //var rotText2 = new Text("Rotated 5", rotexPt, 0.3);
             //rotText2.Rotation = Angle.radiansFromDegree(5);
             //this.AddGraphic(rotText2);

             var rotText3 = new Text("Rotated 340", rotexPt, 0.3);
             rotText3.Rotation = Angle.radiansFromDegree(340);
             rotText3.Feature = this.FeatureList.Children["GreenDot"];
             this.AddGraphic(rotText3);

             var anArc = new Arc(new Point(-1.4, 1.5),
            Azimuth.ctorAzimuthFromDegree(20.0),
            Deflection.ctorDeflectionFromAngle(310.0, 1), 0.25);
             anArc.Feature = this.FeatureList.Children["BlueDashed"];
             this.AddGraphic(anArc);

             allGrahics[0].Feature = this.FeatureList.Children["GreenDot"];
             allGrahics[1].Feature = this.FeatureList.Children["RedThick"];
             allGrahics[2].Feature = this.FeatureList.Children["BlueDashed"];
        }