public void TestBottomRightPoint() { Shape shape = new Shape(); shape.SetPoints(new Point(20, 30), new Point(30, 40)); Assert.AreEqual(30, shape.BottomRightPoint.X); Assert.AreEqual(40, shape.BottomRightPoint.Y); shape.SetPoints(new Point(80, 30), new Point(30, 40)); Assert.AreEqual(80, shape.BottomRightPoint.X); Assert.AreEqual(40, shape.BottomRightPoint.Y); shape.SetPoints(new Point(80, 80), new Point(30, 40)); Assert.AreEqual(80, shape.BottomRightPoint.X); Assert.AreEqual(80, shape.BottomRightPoint.Y); shape.SetPoints(new Point(20, 70), new Point(30, 40)); Assert.AreEqual(30, shape.BottomRightPoint.X); Assert.AreEqual(70, shape.BottomRightPoint.Y); }
public void TestSetPoints() { Shape shape = new Shape(); shape.SetPoints(new Point(20, 30), new Point(30, 40)); Assert.AreEqual(20, shape.TopLeftPoint.X); Assert.AreEqual(30, shape.TopLeftPoint.Y); Assert.AreEqual(30, shape.BottomRightPoint.X); Assert.AreEqual(40, shape.BottomRightPoint.Y); }
public void TestDefaultCheckIsSelected() { Shape shape = new Shape(); shape.SetPoints(new Point(20, 30), new Point(30, 40)); Assert.IsTrue(shape.CheckIsSelected(new Point(25, 35))); Assert.IsFalse(shape.CheckIsSelected(new Point(19, 35))); Assert.IsFalse(shape.CheckIsSelected(new Point(25, 41))); Assert.IsFalse(shape.CheckIsSelected(new Point(19, 41))); }
public void TestTopLeftPoint() { Shape shape = new Shape(); shape.SetPoints(new Point(20, 30), new Point(30, 40)); Assert.AreEqual(20, shape.TopLeftPoint.X); Assert.AreEqual(30, shape.TopLeftPoint.Y); shape.SetPoints(new Point(80, 30), new Point(30, 40)); Assert.AreEqual(30, shape.TopLeftPoint.X); Assert.AreEqual(30, shape.TopLeftPoint.Y); shape.SetPoints(new Point(80, 80), new Point(30, 40)); Assert.AreEqual(30, shape.TopLeftPoint.X); Assert.AreEqual(40, shape.TopLeftPoint.Y); shape.SetPoints(new Point(20, 70), new Point(30, 40)); Assert.AreEqual(20, shape.TopLeftPoint.X); Assert.AreEqual(40, shape.TopLeftPoint.Y); }
public void TestSetPointsByList() { Shape shape = new Shape(); List<Point> points = new List<Point>(); points.Add(new Point(20, 30)); points.Add(new Point(30, 40)); shape.SetPoints(points); Assert.AreEqual(20, shape.TopLeftPoint.X); Assert.AreEqual(30, shape.TopLeftPoint.Y); Assert.AreEqual(30, shape.BottomRightPoint.X); Assert.AreEqual(40, shape.BottomRightPoint.Y); }
private Point SetOperationShapePosition(Shape shape, Point point) { Point movePoint; movePoint.X = point.X - startPoint.X; movePoint.Y = point.Y - startPoint.Y; Point newTopLeftPoint; newTopLeftPoint.X = shapeOriginTopLeftPoint.X + movePoint.X; newTopLeftPoint.Y = shapeOriginTopLeftPoint.Y + movePoint.Y; Point newBottomRightPoint; newBottomRightPoint.X = shapeOriginBottomRightPoint.X + movePoint.X; newBottomRightPoint.Y = shapeOriginBottomRightPoint.Y + movePoint.Y; shape.SetPoints(newTopLeftPoint, newBottomRightPoint); return point; }
//start create shape public void StartCreateShape(ShapeEnum shapeEnum, Point point) { operationShape = ShapeFactory.GetShape(shapeEnum); operationShape.SetPoints(point, point); startPoint = point; ChangeModel(); }