public override void DrawSelf(DrawContext drawContext) { foreach (var primitive in Primitives) { primitive.DrawSelf(drawContext); } }
public override void RunApp() { IOutputWritter writter = new ConsoleWritter(); writter.WriteLine("Run flyweight graphical redactor..."); writter.WriteLine("Run abstract factory for creating primitives"); PrimitiveFactory factory = new PrimitiveFactory(); List<Primitive> primitives = new List<Primitive>() { factory.CreatePoint(10,20), factory.CreateRectangle(15,20), factory.CreateSquare(5), factory.CreateSquare(5), factory.CreateRectangle(100,100) }; Image image = factory.CreateImage(primitives); DrawContext contextForDrawing = new DrawContext(640,480, "RED"); image.DrawSelf(contextForDrawing); writter.WriteLine("... new context ..."); image.DrawSelf(new DrawContext(1024,768, "BLUE")); }
public override void DrawSelf(DrawContext drawContext) { _writter.WriteLine(string.Format("Drawing rectangle on {0}, {1} with color {2}", drawContext.XPos, drawContext.Ypos, drawContext.ColorForDrawing)); _writter.WriteLine(string.Format("Inner parameters of rectangle is: HIGHT {0}, WIGHT {1}", Hight, Width)); }
public override void DrawSelf(DrawContext drawContext) { _writter.WriteLine(string.Format("Drawing square on {0}, {1} with color {2}", drawContext.XPos, drawContext.Ypos, drawContext.ColorForDrawing)); _writter.WriteLine(string.Format("Inner parameters of square is: BORDER {0}", SquareBorder)); }
/// <summary> /// Method for drawing figure /// </summary> /// <param name="drawContext">Draw context</param> public abstract void DrawSelf(DrawContext drawContext);
public override void DrawSelf(DrawContext drawContext) { _writter.WriteLine(string.Format("Drawing point on {0}, {1} with color {2}", drawContext.XPos, drawContext.Ypos, drawContext.ColorForDrawing)); _writter.WriteLine(string.Format("Inner parameters of point is: X {0}, Y {1}", XPos, YPos)); }