Esempio n. 1
0
        public override bool Apply(bool disposeController)
        {
            bool color     = _view.PlotGroupColor;
            bool linestyle = _view.PlotGroupLineType;
            bool symbol    = _view.PlotGroupSymbol;
            bool serial    = !_view.PlotGroupConcurrently;

            ColorGroupStyle         newColorGroupStyle         = null;
            DashPatternGroupStyle   newLineStyleGroupStyle     = null;
            ScatterSymbolGroupStyle newScatterSymbolGroupStyle = null;

            if (_doc.ContainsType(typeof(ColorGroupStyle)))
            {
                newColorGroupStyle = (ColorGroupStyle)_doc.GetPlotGroupStyle(typeof(ColorGroupStyle)).Clone();
                _doc.RemoveType(typeof(ColorGroupStyle));
            }
            if (_doc.ContainsType(typeof(DashPatternGroupStyle)))
            {
                newLineStyleGroupStyle = (DashPatternGroupStyle)_doc.GetPlotGroupStyle(typeof(DashPatternGroupStyle)).Clone();
                _doc.RemoveType(typeof(DashPatternGroupStyle));
            }
            if (_doc.ContainsType(typeof(ScatterSymbolGroupStyle)))
            {
                newScatterSymbolGroupStyle = (ScatterSymbolGroupStyle)_doc.GetPlotGroupStyle(typeof(ScatterSymbolGroupStyle)).Clone();
                _doc.RemoveType(typeof(ScatterSymbolGroupStyle));
            }

            if (color)
            {
                newColorGroupStyle = newColorGroupStyle ?? ColorGroupStyle.NewExternalGroupStyle();
                newColorGroupStyle.IsStepEnabled = true;
                _doc.Add(newColorGroupStyle);
            }
            if (linestyle)
            {
                newLineStyleGroupStyle = newLineStyleGroupStyle ?? new DashPatternGroupStyle();
                newLineStyleGroupStyle.IsStepEnabled = true;

                if (serial && color)
                {
                    _doc.Add(newLineStyleGroupStyle, typeof(ColorGroupStyle));
                }
                else
                {
                    _doc.Add(newLineStyleGroupStyle);
                }
            }
            if (symbol)
            {
                newScatterSymbolGroupStyle = newScatterSymbolGroupStyle ?? new ScatterSymbolGroupStyle();
                newScatterSymbolGroupStyle.IsStepEnabled = true;

                if (serial && linestyle)
                {
                    _doc.Add(newScatterSymbolGroupStyle, typeof(DashPatternGroupStyle));
                }
                else if (serial && color)
                {
                    _doc.Add(newScatterSymbolGroupStyle, typeof(ColorGroupStyle));
                }
                else
                {
                    _doc.Add(newScatterSymbolGroupStyle);
                }
            }

            _doc.PlotGroupStrictness = _view.PlotGroupStrict;

            return(ApplyEnd(true, disposeController));
        }
        public override bool Apply(bool disposeController)
        {
            bool color     = _view.PlotGroupColor;
            bool linestyle = _view.PlotGroupLineType;
            bool symbol    = _view.PlotGroupSymbol;
            bool serial    = !_view.PlotGroupConcurrently;

            if (_doc.ContainsType(typeof(ColorGroupStyle)))
            {
                _doc.RemoveType(typeof(ColorGroupStyle));
            }
            if (_doc.ContainsType(typeof(DashPatternGroupStyle)))
            {
                _doc.RemoveType(typeof(DashPatternGroupStyle));
            }
            if (_doc.ContainsType(typeof(ScatterSymbolGroupStyle)))
            {
                _doc.RemoveType(typeof(ScatterSymbolGroupStyle));
            }

            if (color)
            {
                _doc.Add(ColorGroupStyle.NewExternalGroupStyle());
            }
            if (linestyle)
            {
                if (serial && color)
                {
                    _doc.Add(new DashPatternGroupStyle()
                    {
                        IsStepEnabled = true
                    }, typeof(ColorGroupStyle));
                }
                else
                {
                    _doc.Add(new DashPatternGroupStyle()
                    {
                        IsStepEnabled = true
                    });
                }
            }
            if (symbol)
            {
                if (serial && linestyle)
                {
                    _doc.Add(new ScatterSymbolGroupStyle()
                    {
                        IsStepEnabled = true
                    }, typeof(DashPatternGroupStyle));
                }
                else if (serial && color)
                {
                    _doc.Add(new ScatterSymbolGroupStyle()
                    {
                        IsStepEnabled = true
                    }, typeof(ColorGroupStyle));
                }
                else
                {
                    _doc.Add(new ScatterSymbolGroupStyle()
                    {
                        IsStepEnabled = true
                    });
                }
            }

            _doc.PlotGroupStrictness = _view.PlotGroupStrict;

            return(ApplyEnd(true, disposeController));
        }