예제 #1
0
        /// <summary>
        /// Prepare styles forward, but only up in the hierarchy.
        /// </summary>
        /// <param name="parentstyles">The parent group style collection.</param>
        /// <param name="layer">The plot layer.</param>
        protected void PrepareStylesForward_HierarchyUpOnly(PlotGroupStyleCollection parentstyles, IPlotArea layer)
        {
            bool transferFromParentStyles =
                parentstyles != null &&
                parentstyles.Count != 0 &&
                parentstyles.DistributeToChildGroups &&
                this._styles.InheritFromParentGroups;

            _styles.BeginPrepare();

            string thisname = Main.DocumentPath.GetPathString(this, int.MaxValue);

            System.Diagnostics.Debug.WriteLine(string.Format("{0}:Begin:PrepareFWHUO", thisname));
            if (transferFromParentStyles)
            {
                PlotGroupStyleCollection.TransferFromTo(parentstyles, _styles);
                System.Diagnostics.Debug.WriteLine(string.Format("{0}:Begin:PrepareFWHUO (transfer from parent style", thisname));
            }


            // now distibute the styles from the first item down to the last item
            int last = _plotItems.Count - 1;

            for (int i = 0; i <= last; i++)
            {
                IGPlotItem pi = _plotItems[i];
                if (pi is PlotItemCollection)
                {
                    PlotItemCollection pic = (PlotItemCollection)pi;
                    pic.PrepareStylesForward_HierarchyUpOnly(_styles, layer);
                    _styles.PrepareStepIfForeignSteppingFalse(((PlotItemCollection)pi)._styles);
                }
                else
                {
                    pi.PrepareStyles(_styles, layer);
                    _styles.PrepareStep();
                }
            }

            if (transferFromParentStyles)
            {
                PlotGroupStyleCollection.TransferFromTo(_styles, parentstyles);
                System.Diagnostics.Debug.WriteLine(string.Format("{0}:End:PrepareFWHUO (transfer back to parent style", thisname));
            }

            _styles.EndPrepare();
            System.Diagnostics.Debug.WriteLine(string.Format("{0}:End:PrepareFWHUO", thisname));
        }
예제 #2
0
        /// <summary>
        /// Distribute the changes made to the plotitem 'pivotitem' to all other items in the collection and if neccessary, also up and down the plot item tree.
        /// </summary>
        /// <param name="pivotitem">The plot item where changes to the plot item's styles were made.</param>
        public void DistributeChanges(IGPlotItem pivotitem)
        {
            int pivotidx = _plotItems.IndexOf(pivotitem);

            if (pivotidx < 0)
            {
                return;
            }

            // Distribute the changes backward to the first item
            PrepareStylesIterativeBackward(pivotidx, this.ParentLayer);
            PlotItemCollection rootCollection = ApplyStylesIterativeBackward(pivotidx);

            // now prepare and apply the styles forward normally beginning from the root collection
            // we can set the parent styles to null since rootCollection is the lowest collection that don't inherit from a lower group.
            rootCollection.PrepareStylesForward_HierarchyUpOnly(null, this.ParentLayer);
            rootCollection.ApplyStylesForward_HierarchyUpOnly(null);
        }