예제 #1
0
        /// <summary>
        /// This updates the list, presuming that the number of items has not changed.
        /// </summary>
        void UpdateCurrentNormalOrder()
        {
            // if possible, we try to maintain the order in the list in which the items
            // appear

            if (0 == _currentStepItems)
            {
                return; // then there is nothing to do now
            }
            IPlotGroupStyle previousStyle = null;
            IPlotGroupStyle style         = null;

            for (int i = 0; i < _currentStepItems; i++, previousStyle = style)
            {
                CheckableSelectableListNode node = _currentNormalStyles[i];
                style = _doc.GetPlotGroupStyle((Type)node.Item);

                if (previousStyle != null)
                {
                    Type prevchildtype = _doc.GetChildTypeOf(previousStyle.GetType());
                    if (prevchildtype != null)
                    {
                        if (prevchildtype != style.GetType())
                        {
                            int pi = _currentNormalStyles.IndexOfObject(prevchildtype);
                            _currentNormalStyles.Exchange(i, pi);
                        }
                        continue;
                    }
                }

                Type parenttype = _doc.GetParentTypeOf(style.GetType());
                if (parenttype != null &&
                    (previousStyle == null || previousStyle.GetType() != parenttype))
                {
                    int pi = _currentNormalStyles.IndexOfObject(parenttype);
                    _currentNormalStyles.Exchange(i, pi);
                }
            }
            UpdateCurrentNormalIndentation();
        }
예제 #2
0
        void InitializePlotGroupView()
        {
            bool bStandard = true;
            bool bSerial   = false;
            bool color     = false;
            bool linestyle = false;
            bool symbol    = false;

            if (_groupStyles != null)
            {
                color     = _groupStyles.ContainsType(typeof(ColorGroupStyle));
                linestyle = _groupStyles.ContainsType(typeof(LineStyleGroupStyle));
                symbol    = _groupStyles.ContainsType(typeof(SymbolShapeStyleGroupStyle));

                if (_groupStyles.Count != (color ? 1 : 0) + (linestyle ? 1 : 0) + (symbol ? 1 : 0))
                {
                    bStandard = false;
                }

                if (color && linestyle && typeof(LineStyleGroupStyle) == _groupStyles.GetChildTypeOf(typeof(ColorGroupStyle)))
                {
                    bSerial = true;
                }
                if ((linestyle && symbol) && typeof(SymbolShapeStyleGroupStyle) == _groupStyles.GetChildTypeOf(typeof(LineStyleGroupStyle)))
                {
                    if (color && !bSerial)
                    {
                        bStandard = false;
                    }
                    else
                    {
                        bSerial = true;
                    }
                }

                if (color && !((ColorGroupStyle)_groupStyles.GetPlotGroupStyle(typeof(ColorGroupStyle))).IsStepEnabled)
                {
                    bStandard = false;
                }
                if (linestyle && !((LineStyleGroupStyle)_groupStyles.GetPlotGroupStyle(typeof(LineStyleGroupStyle))).IsStepEnabled)
                {
                    bStandard = false;
                }
                if (symbol && !((SymbolShapeStyleGroupStyle)_groupStyles.GetPlotGroupStyle(typeof(SymbolShapeStyleGroupStyle))).IsStepEnabled)
                {
                    bStandard = false;
                }
                if (_groupStyles.CoordinateTransformingStyle != null)
                {
                    bStandard = false;
                }
            }

            if (bStandard && _groupStyles != null)
            {
                _plotGroupView = (IXYPlotGroupView)Current.Gui.FindAndAttachControlTo(this, typeof(IXYPlotGroupView));
                _plotGroupView.InitializePlotGroupConditions(
                    color,
                    linestyle,
                    symbol,
                    !bSerial,                  //_parentPlotGroup.ChangeStylesConcurrently,
                    PlotGroupStrictness.Normal //_parentPlotGroup.ChangeStylesStrictly
                    );
                _plotGroupView.AdvancedPlotGroupControl += EhAdvancedPlotGroupControlRequired;
            }
            else if (_groupStyles != null)
            {
                _plotGroupController = (IMVCAController)Current.Gui.GetControllerAndControl(new object[] { _groupStyles }, typeof(IMVCAController));
            }
        }