Example #1
0
        /// <summary>
        /// Create decorators
        /// </summary>
        public virtual void CreateDecorators()
        {
            var grid = new GridDecorator
            {
                Composer = this,
                Color    = Brushes.LightGray.Color,
                Panel    = Control.View.GetPanel(nameof(PanelEnum.Grid), new CanvasControl()) as ICanvasControl
            };

            var axisT = new AxisDecorator
            {
                Composer = this,
                Position = PositionEnum.T,
                Color    = Brushes.DarkGray.Color,
                Panel    = Control.AxisT.GetPanel(nameof(PanelEnum.AxisT), new CanvasControl()) as ICanvasControl
            };

            var axisB = new AxisDecorator
            {
                Composer = this,
                Position = PositionEnum.B,
                Color    = Brushes.DarkGray.Color,
                Panel    = Control.AxisB.GetPanel(nameof(PanelEnum.AxisB), new CanvasControl()) as ICanvasControl
            };

            var axisL = new AxisDecorator
            {
                Composer = this,
                Position = PositionEnum.L,
                Color    = Brushes.DarkGray.Color,
                Panel    = Control.AxisL.GetPanel(nameof(PanelEnum.AxisL), new CanvasControl()) as ICanvasControl
            };

            var axisR = new AxisDecorator
            {
                Composer = this,
                Position = PositionEnum.R,
                Color    = Brushes.DarkGray.Color,
                Panel    = Control.AxisR.GetPanel(nameof(PanelEnum.AxisR), new CanvasControl()) as ICanvasControl
            };

            var labelsT = new LabelDecorator
            {
                Composer = this,
                Position = PositionEnum.T,
                Panel    = Control.AxisT.GetPanel(nameof(PanelEnum.LabelT), new CanvasControl()) as ICanvasControl
            };

            var labelsB = new LabelDecorator
            {
                Composer = this,
                Position = PositionEnum.B,
                Panel    = Control.AxisB.GetPanel(nameof(PanelEnum.LabelB), new CanvasControl()) as ICanvasControl
            };

            var labelsL = new LabelDecorator
            {
                Composer = this,
                Position = PositionEnum.L,
                Panel    = Control.AxisL.GetPanel(nameof(PanelEnum.LabelL), new CanvasControl()) as ICanvasControl
            };

            var labelsR = new LabelDecorator
            {
                Composer = this,
                Position = PositionEnum.R,
                Panel    = Control.AxisR.GetPanel(nameof(PanelEnum.LabelR), new CanvasControl()) as ICanvasControl
            };

            var crossView = Control
                            .View
                            .GetPanel(nameof(PanelEnum.Cross), new CanvasControl());

            var cross = new CrossDecorator
            {
                Composer = this,
                Panel    = crossView as ICanvasControl,
                PanelL   = Control.AxisL.GetPanel(nameof(PanelEnum.CrossL), new CanvasControl()) as ICanvasControl,
                PanelR   = Control.AxisR.GetPanel(nameof(PanelEnum.CrossR), new CanvasControl()) as ICanvasControl,
                PanelT   = Control.AxisT.GetPanel(nameof(PanelEnum.CrossT), new CanvasControl()) as ICanvasControl,
                PanelB   = Control.AxisB.GetPanel(nameof(PanelEnum.CrossB), new CanvasControl()) as ICanvasControl
            };

            crossView.Background = Brushes.Transparent;

            Panel.SetZIndex(crossView, 100);

            _decorators.Clear();
            _decorators.Add(grid);
            _decorators.Add(axisT);
            _decorators.Add(axisB);
            _decorators.Add(axisL);
            _decorators.Add(axisR);
            _decorators.Add(cross);
            _decorators.Add(labelsT);
            _decorators.Add(labelsB);
            _decorators.Add(labelsL);
            _decorators.Add(labelsR);
            _decoratorsUpdates.Add(labelsT);
            _decoratorsUpdates.Add(labelsB);
            _decoratorsUpdates.Add(labelsL);
            _decoratorsUpdates.Add(labelsR);

            foreach (var decorator in _decorators)
            {
                decorator.Panel.Clear();
                decorator.Create();
                decorator.Panel.Invalidate();
            }
        }
Example #2
0
        /// <summary>
        /// Create decorators
        /// </summary>
        public virtual void CreateDecorators()
        {
            var grid = new GridDecorator
            {
                Composer = this,
                Color    = Brushes.LightGray.Color,
                Panel    = Control.ViewArea.SetPanel("Grid", new CanvasControl()) as ICanvasControl
            };

            var axisT = new AxisDecorator
            {
                Composer = this,
                Position = PositionEnum.Top,
                Color    = Brushes.DarkGray.Color,
                Panel    = Control.AxisT.SetPanel("AxisT", new CanvasControl()) as ICanvasControl
            };

            var axisB = new AxisDecorator
            {
                Composer = this,
                Position = PositionEnum.Bottom,
                Color    = Brushes.DarkGray.Color,
                Panel    = Control.AxisB.SetPanel("AxisB", new CanvasControl()) as ICanvasControl
            };

            var axisL = new AxisDecorator
            {
                Composer = this,
                Position = PositionEnum.Left,
                Color    = Brushes.DarkGray.Color,
                Panel    = Control.AxisL.SetPanel("AxisL", new CanvasControl()) as ICanvasControl
            };

            var axisR = new AxisDecorator
            {
                Composer = this,
                Position = PositionEnum.Right,
                Color    = Brushes.DarkGray.Color,
                Panel    = Control.AxisR.SetPanel("AxisR", new CanvasControl()) as ICanvasControl
            };

            var labelsT = new LabelDecorator
            {
                Composer = this,
                Position = PositionEnum.Top,
                Panel    = Control.AxisT.SetPanel("LabelsT", new CanvasControl()) as ICanvasControl
            };

            var labelsB = new LabelDecorator
            {
                Composer = this,
                Position = PositionEnum.Bottom,
                Panel    = Control.AxisB.SetPanel("LabelsB", new CanvasControl()) as ICanvasControl
            };

            var labelsL = new LabelDecorator
            {
                Composer = this,
                Position = PositionEnum.Left,
                Panel    = Control.AxisL.SetPanel("LabelsL", new CanvasControl()) as ICanvasControl
            };

            var labelsR = new LabelDecorator
            {
                Composer = this,
                Position = PositionEnum.Right,
                Panel    = Control.AxisR.SetPanel("LabelsR", new CanvasControl()) as ICanvasControl
            };

            var crossView = Control.ViewArea.SetPanel("Cross", new CanvasControl());

            var cross = new CrossDecorator
            {
                Composer = this,
                Panel    = crossView as ICanvasControl,
                PanelL   = Control.AxisL.SetPanel("CrossL", new CanvasControl()) as ICanvasControl,
                PanelR   = Control.AxisR.SetPanel("CrossR", new CanvasControl()) as ICanvasControl,
                PanelT   = Control.AxisT.SetPanel("CrossT", new CanvasControl()) as ICanvasControl,
                PanelB   = Control.AxisB.SetPanel("CrossB", new CanvasControl()) as ICanvasControl
            };

            crossView.Background = Brushes.Transparent;

            Panel.SetZIndex(crossView, 100);

            _decorators.Clear();
            _decorators.Add(grid);
            _decorators.Add(axisT);
            _decorators.Add(axisB);
            _decorators.Add(axisL);
            _decorators.Add(axisR);
            _decorators.Add(cross);
            _decorators.Add(labelsT);
            _decorators.Add(labelsB);
            _decorators.Add(labelsL);
            _decorators.Add(labelsR);
            _decoratorsUpdates.Add(labelsT);
            _decoratorsUpdates.Add(labelsB);
            _decoratorsUpdates.Add(labelsL);
            _decoratorsUpdates.Add(labelsR);

            foreach (var decorator in _decorators)
            {
                decorator.Panel.Clear();
                decorator.Create();
                decorator.Panel.Invalidate();
            }
        }