Ejemplo n.º 1
0
        public void MergeXBoundsInto(IPlotArea layer, IPhysicalBoundaries pb, PlotItemCollection coll)
        {
            if (!(pb is NumericalBoundaries))
            {
                CoordinateTransformingStyleBase.MergeXBoundsInto(pb, coll);
                return;
            }

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

            xbounds.Reset();

            int nItems = 0;

            foreach (IGPlotItem pi in coll)
            {
                if (pi is IXBoundsHolder)
                {
                    IXBoundsHolder xbpi = (IXBoundsHolder)pi;
                    xbpi.MergeXBoundsInto(xbounds);
                }
                if (pi is G2DPlotItem)
                {
                    nItems++;
                }
            }


            if (nItems == 0)
            {
                _xinc = 0;
            }
            else
            {
                _xinc = (xbounds.UpperBound - xbounds.LowerBound) / nItems;
            }

            int idx = 0;

            foreach (IGPlotItem pi in coll)
            {
                if (pi is IXBoundsHolder)
                {
                    IXBoundsHolder xbpi = (IXBoundsHolder)pi;
                    xbounds.Reset();
                    xbpi.MergeXBoundsInto(xbounds);
                    xbounds.Shift(_xinc * idx);
                    pb.Add(xbounds);
                }
                if (pi is G2DPlotItem)
                {
                    idx++;
                }
            }
        }
 public static void MergeXBoundsInto(IPhysicalBoundaries pb, PlotItemCollection coll)
 {
     foreach (IGPlotItem pi in coll)
     {
         if (pi is IXBoundsHolder)
         {
             IXBoundsHolder plotItem = (IXBoundsHolder)pi;
             plotItem.MergeXBoundsInto(pb);
         }
     }
 }
Ejemplo n.º 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);
     }
 }