public void MPathCommandIsTest() { PathCommand command = new PathCommand("M18,24"); Assert.True(command.IsMoveToCommand()); Assert.False(command.IsArcCommand()); Assert.False(command.IsUpper()); Assert.False(command.IsLower()); Assert.False(command.IsRight()); Assert.False(command.IsLeft()); }
public void APathCommandIsUpperLowerTest() { PathCommand command1 = new PathCommand("A32,32 0 0,1 64,0"); PathCommand command2 = new PathCommand("a32,32 0 0,1 64,0"); PathCommand command3 = new PathCommand("a32,32 0 0,1 -64,0"); PathCommand command4 = new PathCommand("A32,32 0 1,0 64,0"); PathCommand command5 = new PathCommand("a32,32 0 1,0 64,0"); PathCommand command6 = new PathCommand("a32,32 0 1,0 -64,0"); PathCommand command7 = new PathCommand("a32,32 0 1,0 0,64"); PathCommand command8 = new PathCommand("a32,32 0 1,0 0,-64"); Assert.False(command1.IsMoveToCommand()); Assert.True(command1.IsArcCommand()); Assert.True(command1.IsUpper()); Assert.False(command1.IsLower()); Assert.True(command2.IsUpper()); Assert.False(command2.IsLower()); Assert.False(command3.IsUpper()); Assert.True(command3.IsLower()); Assert.False(command4.IsUpper()); Assert.True(command4.IsLower()); Assert.False(command5.IsUpper()); Assert.True(command5.IsLower()); Assert.True(command6.IsUpper()); Assert.False(command6.IsLower()); Assert.True(command7.IsUpper()); Assert.True(command7.IsLower()); Assert.True(command8.IsUpper()); Assert.True(command8.IsLower()); }
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; }