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); }
public void Arc_CreateArc_ctor3DeflectingRight90_IsCorrect() { var anArc = new Arc(new Point(100.0, 100.0), Azimuth.ctorAzimuthFromDegree(90), Deflection.ctorDeflectionFromAngle(90.0, 1), 50.0); Assert.IsNotNull(anArc); Assert.AreEqual( expected: 0.0, actual: anArc.BeginRadiusVector.Azimuth.getAsDegreesDouble(), delta: 0.00001); Assert.AreEqual( expected: 90.0, actual: anArc.StartAzimuth.getAsDegreesDouble(), delta: 0.00001); Assert.IsNotNull(anArc.BoundingBox); Assertt.AreEqual( expected: new Point(100,50), actual: anArc.CenterPt); Assert.AreEqual( expected: 90.0, actual: anArc.Deflection.getAsDegreesDouble(), delta: 0.00001); Assert.AreEqual( expected: 0.0, actual: anArc.Eccentricity, delta: 0.00001); Assertt.AreEqual( expected: new Point(150.0, 50.0), actual: anArc.EndPt); var expecVec = new Vector(Azimuth.ctorAzimuthFromDegree(90.0), 50.0); Assertt.AreEqual( expected: expecVec, actual: anArc.EndRadiusVector); Assertt.AreEqual( expected: new Point(100.0, 100.0), actual: anArc.Origin); Assert.AreEqual( expected: 50.0, actual: anArc.Radius, delta: 0.00001); Assert.AreEqual( expected: 0.0, actual: anArc.Rotation.getAsDegreesDouble(), delta: 0.00001); Double FiftyOverSR2 = 50.0 / Math.Sqrt(2.0); Assertt.AreEqual( expected: new Vector(FiftyOverSR2, FiftyOverSR2), actual: anArc.ScaleVector); }
public void Arc_CreateArc_ctor3DeflectingLeft90_IsCorrect() { var anArc = new Arc(new Point(100.0, 100.0), Azimuth.ctorAzimuthFromDegree(90), Deflection.ctorDeflectionFromAngle(90.0, -1), 50.0); Assert.IsNotNull(anArc); Assert.AreEqual( expected: 180.0, actual: anArc.BeginRadiusVector.Azimuth.getAsDegreesDouble(), delta: 0.00001, message: "BeginRadiusVector"); Assert.AreEqual( expected: 90.0, actual: anArc.StartAzimuth.getAsDegreesDouble(), delta: 0.00001, message: "BeginPointAngle"); Assert.IsNotNull(anArc.BoundingBox); Assertt.AreEqual( expected: new Point(100,150), actual: anArc.CenterPt); Assert.AreEqual( expected: -90.0, actual: anArc.Deflection.getAsDegreesDouble(), delta: 0.00001, message: "Deflection"); Assert.AreEqual( expected: 0.0, actual: anArc.Eccentricity, delta: 0.00001, message: "Eccentricity"); Assertt.AreEqual( expected: new Point(150.0, 150.0), actual: anArc.EndPt); var expecVec = new Vector(Azimuth.ctorAzimuthFromDegree(90.0), 50.0); Assertt.AreEqual( expected: expecVec, actual: anArc.EndRadiusVector); Assertt.AreEqual( expected: new Point(100.0, 100.0), actual: anArc.Origin); Assert.AreEqual( expected: 50.0, actual: anArc.Radius, delta: 0.00001, message: "Radius"); Assert.AreEqual( expected: 0.0, actual: anArc.Rotation.getAsDegreesDouble(), delta: 0.00001, message: "Rotation"); Assert.AreEqual( expected: 50.0, actual: anArc.ScaleVector.Length, delta: 0.00001); }
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"]; }
internal List<Graphic> GetGraphics() { if (null == dxf) throw new Exception("Dxf file has not been set."); List<Graphic> graphicsList = new List<Graphic>(); foreach (var dxfArc in dxf.Arcs) { Arc arc = new Arc(dxfArc); graphicsList.Add(arc); } foreach (var dxfLine in dxf.Lines) { LineSegment lineSegment = new LineSegment(dxfLine); graphicsList.Add(lineSegment); } //foreach (var dxfTxt in dxf.Texts) //{ // NVcad.CadObjects.Text txt = new NVcad.CadObjects.Text(dxfTxt); // graphicsList.Add(txt); //} //foreach (var dxfTxt in dxf.MTexts) //{ // NVcad.CadObjects.Text txt = new NVcad.CadObjects.Text(dxfTxt); // graphicsList.Add(txt); //} return graphicsList; }