public void APathCommandIsCircularVerticalHorizontalTest() { //line in the shape of a lower half circle, clockwise from left to right, horizontal (line between start y and end y) PathCommand command1 = new PathCommand("a32,32 0 0,1 64,0"); //like above, but elliptic with half the radius. PathCommand command2 = new PathCommand("a32,16 0 0,1 64,0"); //line in the shape of a right half ellipse (half radius compared to circle), counter-clockwise from top to bottom, vertical (line between start x and end x) PathCommand command3 = new PathCommand("a32,16 0 1,0 0,64"); //like above but a right half circle PathCommand command4 = new PathCommand("a32,32 0 1,0 0,64"); Assert.True(command1.IsCircular()); Assert.False(command2.IsCircular()); Assert.False(command3.IsCircular()); Assert.True(command4.IsCircular()); Assert.True(command1.IsHorizontal()); Assert.True(command2.IsHorizontal()); Assert.False(command3.IsHorizontal()); Assert.False(command4.IsHorizontal()); Assert.False(command1.IsVertical()); Assert.False(command2.IsVertical()); Assert.True(command3.IsVertical()); Assert.True(command4.IsVertical()); }
protected Shape CreateShape(PathCommand c) { Shape shape = null; if (c.IsMoveToCommand()) { // } else if (c.IsArcCommand()) { if (c.IsCircular()) { if (c.IsHorizontal()) { if (c.IsLower()) { shape = new LowerHalfCircle((int)c.CenterX, (int)c.CenterY, (int)c.RadiusX); } else if (c.IsUpper()) { shape = new UpperHalfCircle((int)c.CenterX, (int)c.CenterY, (int)c.RadiusX); } } else if (c.IsVertical()) { if (c.IsLeft()) { shape = new LeftHalfCircle((int)c.CenterX, (int)c.CenterY, (int)c.RadiusY); } else if (c.IsRight()) { shape = new RightHalfCircle((int)c.CenterX, (int)c.CenterY, (int)c.RadiusY); } } } } return shape; }