/// <summary> /// Draw shapes /// </summary> /// <param name="coordinates"></param> /// <param name="mChar"></param> /// <param name="cmd"></param> public void Draw(ICoordinate coordinates, char mchar, char cmd) { try { ValidateCanvas(); ShapeFactory shapeFactory = new ConcreteShapeFactory(); CanvasItem canvasItem = shapeFactory.GetShape(cmd); canvasItem.Coordinate = coordinates; canvasItem.Draw(ref canvasArray, mchar); } catch { throw; } }
/// <summary> /// Draw shapes /// </summary> /// <param name="coordinates"></param> /// <param name="mChar"></param> /// <param name="cmd"></param> public void Draw(ICoordinate coordinates, char mchar, char cmd) { try { ValidateCanvas(); ShapeFactory shapeFactory = new ConcreteShapeFactory(); CanvasItem canvasItem = shapeFactory.GetShape(cmd); canvasItem.Coordinate = coordinates; if (!canvasItem.ValidateCoordinates()) { throw new CanvasException("Coordinates are not correct or colinear. Please try Again!!"); } canvasItem.Draw(ref canvasArray, mchar); } catch { throw; } }