public IShape CreateRectangle(float pointXCoordinate, float pointYCoordinate, float width, float height, Color color, int currentLayer) { IShape rectangle = new ShapeMaker.Models.Rectangle( new PointF(pointXCoordinate, pointYCoordinate), width, height, color, currentLayer); return(rectangle); }
//Creates shapes from ShapesDtos and adds them to shapes list private static void GetShapesFromDto(ShapesDto shapesDto, IList <IShape> shapes) { foreach (CircleDto circleDto in shapesDto.Circles) { PointF center = new PointF(circleDto.CenterX, circleDto.CenterY); float radius = circleDto.Radius; Color color = GetColor(circleDto); int currentLayer = circleDto.CurrentLayer; IShape circle = new Circle(center, radius, color, currentLayer); shapes.Add(circle); } foreach (TriangleDto triangleDto in shapesDto.Triangles) { PointF pointA = new PointF(triangleDto.PointAX, triangleDto.PointAY); PointF pointB = new PointF(triangleDto.PointBX, triangleDto.PointBY); PointF pointC = new PointF(triangleDto.PointCX, triangleDto.PointCY); Color color = GetColor(triangleDto); int currentLayer = triangleDto.CurrentLayer; IShape triangle = new Triangle(pointA, pointB, pointC, color, currentLayer); shapes.Add(triangle); } foreach (RectangleDto rectangleDto in shapesDto.Rectangles) { PointF point = new PointF(rectangleDto.PointX, rectangleDto.PointY); float height = rectangleDto.Height; float width = rectangleDto.Width; Color color = GetColor(rectangleDto); int currentLayer = rectangleDto.CurrentLayer; IShape rectangle = new ShapeMaker.Models.Rectangle(point, width, height, color, currentLayer); shapes.Add(rectangle); } }