Esempio n. 1
0
        public void RenderEllipseTest()
        {
            var ellipse = new DxfEllipse(new DxfPoint(1.0, 2.0, 3.0), new DxfVector(1.0, 0.0, 0.0), 0.5)
            {
                StartParameter = 0.0,
                EndParameter   = Math.PI / 2.0 // 90 degrees
            };
            var path = ellipse.GetSvgPath();

            Assert.Equal(2, path.Segments.Count);

            var move = (SvgMoveToPath)path.Segments[0];

            AssertClose(2.0, move.LocationX);
            AssertClose(2.0, move.LocationY);

            var arcSegment = (SvgArcToPath)path.Segments[1];

            AssertClose(1.0, arcSegment.EndPointX);
            AssertClose(2.5, arcSegment.EndPointY);
            Assert.Equal(1.0, arcSegment.RadiusX);
            Assert.Equal(0.5, arcSegment.RadiusY);
            Assert.Equal(0.0, arcSegment.XAxisRotation);
            Assert.False(arcSegment.IsLargeArc);
            Assert.True(arcSegment.IsCounterClockwiseSweep);

            var expected = new XElement("path",
                                        new XAttribute("d", path.ToString()),
                                        new XAttribute("fill-opacity", "0"),
                                        new XAttribute("stroke-width", "1.0px"),
                                        new XAttribute("vector-effect", "non-scaling-stroke"));
            var actual = ellipse.ToXElement();

            AssertXElement(expected, actual);
        }
Esempio n. 2
0
        public void EllipseAndClosedShapeTest()
        {
            var ellipse  = new DxfEllipse(new DxfPoint(0.0, 0.0, 0.0), new DxfVector(1.0, 0.0, 0.0), 0.5);
            var expected = new XElement("ellipse",
                                        new XAttribute("cx", "0.0"), new XAttribute("cy", "0.0"),
                                        new XAttribute("rx", "1.0"), new XAttribute("ry", "0.5"),
                                        new XAttribute("fill-opacity", "0"),
                                        new XAttribute("stroke-width", "1.0px"),
                                        new XAttribute("vector-effect", "non-scaling-stroke"));
            var actual = ellipse.ToXElement();

            AssertXElement(expected, actual);
        }