示例#1
0
        public void MergeYBoundsInto(IPlotArea layer, IPhysicalBoundaries pb, PlotItemCollection coll)
        {
            if (!(pb is NumericalBoundaries))
            {
                CoordinateTransformingStyleBase.MergeYBoundsInto(pb, coll);
                return;
            }

            NumericalBoundaries ybounds = (NumericalBoundaries)pb.Clone();

            ybounds.Reset();

            int nItems = 0;

            foreach (IGPlotItem pi in coll)
            {
                if (pi is IYBoundsHolder)
                {
                    IYBoundsHolder ybpi = (IYBoundsHolder)pi;
                    ybpi.MergeYBoundsInto(ybounds);
                }
                if (pi is G2DPlotItem)
                {
                    nItems++;
                }
            }


            if (nItems == 0)
            {
                _yinc = 0;
            }
            else
            {
                _yinc = (ybounds.UpperBound - ybounds.LowerBound) / nItems;
            }

            int idx = 0;

            foreach (IGPlotItem pi in coll)
            {
                if (pi is IYBoundsHolder)
                {
                    IYBoundsHolder ybpi = (IYBoundsHolder)pi;
                    ybounds.Reset();
                    ybpi.MergeYBoundsInto(ybounds);
                    ybounds.Shift(_yinc * idx);
                    pb.Add(ybounds);
                }
                if (pi is G2DPlotItem)
                {
                    idx++;
                }
            }
        }
 public static void MergeYBoundsInto(IPhysicalBoundaries pb, PlotItemCollection coll)
 {
     foreach (IGPlotItem pi in coll)
     {
         if (pi is IYBoundsHolder)
         {
             IYBoundsHolder plotItem = (IYBoundsHolder)pi;
             plotItem.MergeYBoundsInto(pb);
         }
     }
 }
示例#3
0
 /// <summary>
 /// This sets the type of the item boundaries to the type of the owner layer
 /// </summary>
 /// <param name="plotitem">The plot item for which the boundary type should be set.</param>
 void WireBoundaryEvents(IGPlotItem plotitem)
 {
     if (plotitem is IXBoundsHolder)
     {
         IXBoundsHolder xholder = (IXBoundsHolder)plotitem;
         xholder.XBoundariesChanged += new BoundaryChangedHandler(this.EhXBoundaryChanged);
     }
     if (plotitem is IYBoundsHolder)
     {
         IYBoundsHolder yholder = (IYBoundsHolder)plotitem;
         yholder.YBoundariesChanged += new BoundaryChangedHandler(this.EhYBoundaryChanged);
     }
 }