Ejemplo n.º 1
0
 public void StartDraw(IFigure figure)
 {
     if (figure is TriangleByPointsFigure || figure is NAngleByPointsFigure)
     {
         if (figure is TriangleByPointsFigure)
         {
             Drawer = new AnglePointsDrawer(((TriangleByPointsFigure)figure).N);
         }
         else
         {
             Drawer = new AnglePointsDrawer(((NAngleByPointsFigure)figure).N);
         }
     }
     else if (figure is EllipseFigure || figure is CircleFigure)
     {
         if (!(Drawer is EllipseDrawer))
         {
             Drawer = new EllipseDrawer();
         }
     }
     else if (figure is PenFigure || figure is PolylineByPointsFigure)
     {
         if (!(Drawer is PenDrawer))
         {
             Drawer = new PenDrawer();
         }
     }
     else if (!(Drawer is AngleFiguresDrawer))
     {
         Drawer = new AngleFiguresDrawer();
     }
 }
        public Figure CreateFigure()
        {
            EllipseDrawer  drawer  = new EllipseDrawer();
            EllipseUpdater updater = new EllipseUpdater();
            EllipseMover   mover   = new EllipseMover();
            RegularRotator rotator = new RegularRotator();
            RegularScaler  scaler  = new RegularScaler();
            Figure         figure  = new Figure(drawer, scaler, updater, mover, rotator);

            return(figure);
        }
Ejemplo n.º 3
0
    static void Main(string[] args)
    {
        var pixels = new bool[60, 60];

        Console.BufferHeight = pixels.GetLength(1) * 2 + 3;
        EllipseDrawer.Ellipse(pixels, new Rectangle(20, 20, 40, 60));
        PrintMatrix(pixels);
        Console.WriteLine();
        pixels = new bool[60, 60];
        EllipseDrawer.FillEllipse(pixels, new Rectangle(40, 40, 20, 20));
        PrintMatrix(pixels);
        Console.WriteLine();
        Console.ReadLine();
    }