Пример #1
0
 public override void DrawSelf(DrawContext drawContext)
 {
     foreach (var primitive in Primitives)
     {
         primitive.DrawSelf(drawContext);
     }
 }
Пример #2
0
        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"));
        }
Пример #3
0
 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));
 }
Пример #4
0
 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));
 }
Пример #5
0
 /// <summary>
 /// Method for drawing figure
 /// </summary>
 /// <param name="drawContext">Draw context</param>
 public abstract void DrawSelf(DrawContext drawContext);
Пример #6
0
 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));
 }