public void DoDrawing(Pen pen, PenPosition penPosition, Graphics g, string line) { var split = line.Split(); string Operator; int repeatSize = 5; int.TryParse(split[4], out int AmountOfRepition); Operator = split[3]; double.TryParse(split[2], out double circleRadius); IShape circle = new CircleShape(circleRadius); double diameter = circle.GetDiameter(); float diameterF = Convert.ToSingle(diameter); if (Operator == "+") { for (int i = 0; i < AmountOfRepition; i++) { g.DrawEllipse(pen, penPosition.X, penPosition.Y, diameterF, diameterF); diameterF += repeatSize; } } if (Operator == "-") { for (int i = 0; i < AmountOfRepition; i++) { g.DrawEllipse(pen, penPosition.X, penPosition.Y, diameterF, diameterF); diameterF -= repeatSize; } } }
public void DoDrawing(Pen pen, PenPosition penPosition, Graphics g, string line) { var split = line.Split(); try { double.TryParse(split[1], out var circleRadius); IShape circle = new CircleShape(circleRadius); ShapeFactory fac = new ShapeFactory(); fac.CreateShape("circle"); double diameter = circle.GetDiameter(); float diameterF = Convert.ToSingle(diameter); g.DrawEllipse(pen, penPosition.X, penPosition.Y, diameterF, diameterF); } catch (IndexOutOfRangeException) { MessageBox.Show("Missing Radius Parameter, FORMAT <Shape> <Radius>", "Missing Paramters", MessageBoxButtons.OK, MessageBoxIcon.Information); } }