Exemple #1
0
        static void Main(string[] args)
        {
            var compositeGraphic  = new CompositeGraphic();
            var compositeGraphic1 = new CompositeGraphic();
            var compositeGraphic2 = new CompositeGraphic();

            //Composite Graphic 1 Grafiğe ekle
            compositeGraphic.Ekle(yeni Elips());
            //composite Graphic 2 Grafiğe ekle
            compositeGraphic2.AddRange(yeni Elips(), yeni Elips());

            //1 Graifk compositeGraphic1 ve ekle compositeGraphic
            compositeGraphic.AddRange(yeni Elips(), compositeGraphic1, compositeGraphic2);

            //Prints the complete graphic
            compositeGraphic.Print();
            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            CompositeGraphic allShapes = new CompositeGraphic();
            CompositeGraphic triangles = new CompositeGraphic();
            CompositeGraphic squares = new CompositeGraphic();
            CompositeGraphic circles = new CompositeGraphic();

            triangles.Add(new Triangle());

            circles.AddRange(new Circle(), new Circle(), new Circle());

            squares.AddRange(new Square(),new Square(), circles);

            allShapes.AddRange(new Triangle(),
                triangles,
                squares);

            allShapes.Print();

            Console.WriteLine("\n\nPrint only squares leaf: ");
            squares.Print();
        }
        static void Main(string[] args)
        {
            CompositeGraphic allShapes = new CompositeGraphic();
            CompositeGraphic triangles = new CompositeGraphic();
            CompositeGraphic squares   = new CompositeGraphic();
            CompositeGraphic circles   = new CompositeGraphic();

            triangles.Add(new Triangle());

            circles.AddRange(new Circle(), new Circle(), new Circle());

            squares.AddRange(new Square(), new Square(), circles);



            allShapes.AddRange(new Triangle(),
                               triangles,
                               squares);

            allShapes.Print();

            Console.WriteLine("\n\nPrint only squares leaf: ");
            squares.Print();
        }
        static void Main(string[] args)
        {
            // initialize variables
            var compositeGraphic = new CompositeGraphic();
            var compositeGraphic1 = new CompositeGraphic();
            var compositeGraphic2 = new CompositeGraphic();

            //Add 1 Graphic to compositeGraphic1
            compositeGraphic1.Add(new Ellipse());

            //Add 2 Graphic to compositeGraphic2
            compositeGraphic2.AddRange(new Ellipse(),
                new Ellipse());

            /*Add 1 Graphic, compositeGraphic1, and
              compositeGraphic2 to compositeGraphic */
            compositeGraphic.AddRange(new Ellipse(),
                compositeGraphic1,
                compositeGraphic2);

            /*Prints the complete graphic
            (four times the string "Ellipse").*/
            compositeGraphic.Print();
            Console.ReadLine();
        }