Beispiel #1
0
        static void CalculateDrawingArea(IAmVisitable visitable)
        {
            var visitor = new DrawingAreaCalculationVisitor();

            visitable.Accept(visitor);
            var rect = visitor.Rect;

            Console.WriteLine("Drawing area for {0}: ({1},{2}) ({3},{4})", visitable.GetType().Name, rect.Left, rect.Top, rect.Right, rect.Bottom);
        }
Beispiel #2
0
        static void CalculateTotalDrawingArea(IEnumerable <IAmVisitable> visitables)
        {
            var visitor = new DrawingAreaCalculationVisitor();

            foreach (var visitable in visitables)
            {
                visitable.Accept(visitor);
            }
            var rect = visitor.Rect;

            Console.WriteLine("Total drawing area: ({0},{1}) ({2},{3})", rect.Left, rect.Top, rect.Right, rect.Bottom);
        }