Exemple #1
0
        public void EhView_AddNormalGroupStyle()
        {
            SelectableListNode selected = null;

            foreach (SelectableListNode node in _availableNormalStyles)
            {
                if (node.Selected)
                {
                    selected = node;
                    break;
                }
            }
            if (null != selected)
            {
                _availableNormalStyles.Remove(selected);

                IPlotGroupStyle s = (IPlotGroupStyle)Activator.CreateInstance((Type)selected.Item);
                _doc.Add(s);
                CheckableSelectableListNode node = new CheckableSelectableListNode(
                    Current.Gui.GetUserFriendlyClassName(s.GetType()),
                    s.GetType(), true, s.IsStepEnabled);
                if (s.CanHaveChilds())
                {
                    _currentNormalStyles.Insert(_currentStepItems, node);
                    _currentStepItems++;
                }
                else
                {
                    _currentNormalStyles.Add(node);
                }

                _view.InitializeAvailableNormalGroupStyles(_availableNormalStyles);
                _view.InitializeCurrentNormalGroupStyles(_currentNormalStyles);
            }
        }
Exemple #2
0
        void ApplyPlotGroupView()
        {
            if (null != _plotGroupView)
            {
                bool color     = _plotGroupView.PlotGroupColor;
                bool linestyle = _plotGroupView.PlotGroupLineType;
                bool symbol    = _plotGroupView.PlotGroupSymbol;
                bool serial    = !_plotGroupView.PlotGroupConcurrently;

                if (_groupStyles.ContainsType(typeof(ColorGroupStyle)))
                {
                    _groupStyles.RemoveType(typeof(ColorGroupStyle));
                }
                if (_groupStyles.ContainsType(typeof(LineStyleGroupStyle)))
                {
                    _groupStyles.RemoveType(typeof(LineStyleGroupStyle));
                }
                if (_groupStyles.ContainsType(typeof(SymbolShapeStyleGroupStyle)))
                {
                    _groupStyles.RemoveType(typeof(SymbolShapeStyleGroupStyle));
                }


                if (color)
                {
                    _groupStyles.Add(new ColorGroupStyle());
                }
                if (linestyle)
                {
                    if (serial && color)
                    {
                        _groupStyles.Add(new LineStyleGroupStyle(), typeof(ColorGroupStyle));
                    }
                    else
                    {
                        _groupStyles.Add(new LineStyleGroupStyle());
                    }
                }
                if (symbol)
                {
                    if (serial && linestyle)
                    {
                        _groupStyles.Add(new SymbolShapeStyleGroupStyle(), typeof(LineStyleGroupStyle));
                    }
                    else if (serial && color)
                    {
                        _groupStyles.Add(new SymbolShapeStyleGroupStyle(), typeof(ColorGroupStyle));
                    }
                    else
                    {
                        _groupStyles.Add(new SymbolShapeStyleGroupStyle());
                    }
                }

                _groupStyles.PlotGroupStrictness = _plotGroupView.PlotGroupStrict;
            }


            // now distribute the new style to the other plot items
            if (_doc.ParentCollection != null)
            {
                _doc.ParentCollection.DistributePlotStyleFromTemplate(_doc, _groupStyles.PlotGroupStrictness);
                _doc.ParentCollection.DistributeChanges(_doc);
            }
        }