public IHaveArea ReceiveFigure(IHaveArea figure) { var decoratedFigure = new ZoomDecorator(figure); decoratedFigure.Zoom = this.currentZoom; this.figures.Add(decoratedFigure); return(decoratedFigure); }
public static void withNaiveZoom() { var figures = new List <IHaveArea>(); figures.Add(new Square(new RectangleAreaEquation())); figures.Add(new Rectangle(new RectangleAreaEquation())); figures.Add(new Parralelogram(new ParralelogramAreaEquation())); var squareCanBeZoomed = new ZoomDecorator(new Square(new RectangleAreaEquation())); figures.Add(squareCanBeZoomed); // использование декоратора (наивный пример) squareCanBeZoomed.Zoom = 5; }