Exemplo n.º 1
0
        static void Main(string[] args)
        {
            /* Group g1 = new Group();
             * g1.Children = new List<GraphicsObject>();
             *
             * Group g2 = new Group();
             * g2.Children = new List<GraphicsObject>();
             *
             * Group g3 = new Group();
             * g3.Children = new List<GraphicsObject>();
             *
             * Cuboid c1 = new Cuboid();
             * c1.Length = 42;
             * c1.Width = 4711;
             * c1.Depth = 99;
             *
             * Cuboid c2 = new Cuboid();
             * c2.Length = 22;
             * c2.Width = 11;
             * c2.Depth = 33;
             *
             * Sphere s1 = new Sphere();
             * s1.Radius = 3.1415f;
             *
             * Sphere s2 = new Sphere();
             * s2.Radius = 12;
             *
             * g3.Children.Add(c2);
             * g2.Children.Add(c1);
             * g2.Children.Add(s1);
             * g2.Children.Add(g3);
             * g1.Children.Add(g2);
             * g1.Children.Add(s2);
             *
             * GraphicsObject root = g1;*/

            GraphicsObject root =
                new Group
            {
                Children = new List <GraphicsObject>
                {
                    new Group
                    {
                        Children = new List <GraphicsObject>
                        {
                            new Cuboid
                            {
                                Length = 42,
                                Width  = 4711,
                                Depth  = 99
                            },
                            new Sphere
                            {
                                Radius = 3.1415f,
                            },
                            new Group
                            {
                                Children = new List <GraphicsObject>
                                {
                                    new Cuboid
                                    {
                                        Length = 22,
                                        Width  = 11,
                                        Depth  = 33
                                    }
                                }
                            }
                        }
                    },
                    new Sphere
                    {
                        Radius = 12,
                    }
                }
            };


            root.Accept(new Renderer());

            Console.ReadKey();
        }
Exemplo n.º 2
0
 public override void Visit(Group g)
 {
     // TODO
 }
Exemplo n.º 3
0
 public virtual void Visit(Group g)
 {
 }