public void MergeYBoundsInto(IPlotArea layer, IPhysicalBoundaries pb, PlotItemCollection coll) { var pbclone = (IPhysicalBoundaries)pb.Clone(); // before we can use CanUseStyle, we have to give physical y boundaries template CoordinateTransformingStyleBase.MergeYBoundsInto(pbclone, coll); if (!CanUseStyle(layer, coll, out var plotDataList)) { pb.Add(pbclone); return; } // we put zero into the y-Boundaries, since the addition starts with that value pb.Add(new AltaxoVariant(0.0)); AltaxoVariant[] ySumArray = null; int idx = -1; foreach (IGPlotItem pi in coll) { if (pi is G2DPlotItem) { idx++; var gpi = (G2DPlotItem)pi; Processed2DPlotData pdata = plotDataList[gpi]; if (null != pdata) { // Note: we can not use AddUp function here, since // when we have positive/negative items, the intermediate bounds // might be wider than the bounds of the end result if (ySumArray == null) { ySumArray = new AltaxoVariant[pdata.RangeList.PlotPointCount]; int j = -1; foreach (int originalIndex in pdata.RangeList.OriginalRowIndices()) { j++; ySumArray[j] = pdata.GetYPhysical(originalIndex); pb.Add(ySumArray[j]); } } else // this is not the first item { int j = -1; foreach (int originalIndex in pdata.RangeList.OriginalRowIndices()) { j++; ySumArray[j] += pdata.GetYPhysical(originalIndex); pb.Add(ySumArray[j]); } } } } } }
public void MergeYBoundsInto(IPlotArea layer, IPhysicalBoundaries pb, PlotItemCollection coll) { Dictionary<G2DPlotItem, Processed2DPlotData> plotDataList; IPhysicalBoundaries pbclone = (IPhysicalBoundaries)pb.Clone(); // before we can use CanUseStyle, we have to give physical y boundaries template CoordinateTransformingStyleBase.MergeYBoundsInto(pbclone, coll); if (!CanUseStyle(layer, coll, out plotDataList)) { pb.Add(pbclone); return; } // we put zero into the y-Boundaries, since the addition starts with that value pb.Add(new AltaxoVariant(0.0)); AltaxoVariant[] ySumArray = null; int idx = -1; foreach (IGPlotItem pi in coll) { if (pi is G2DPlotItem) { idx++; G2DPlotItem gpi = (G2DPlotItem)pi; Processed2DPlotData pdata = plotDataList[gpi]; // Note: we can not use AddUp function here, since // when we have positive/negative items, the intermediate bounds // might be wider than the bounds of the end result if (ySumArray == null) { ySumArray = new AltaxoVariant[pdata.RangeList.PlotPointCount]; int j = -1; foreach (int originalIndex in pdata.RangeList.OriginalRowIndices()) { j++; ySumArray[j] = pdata.GetYPhysical(originalIndex); pb.Add(ySumArray[j]); } } else // this is not the first item { int j = -1; foreach (int originalIndex in pdata.RangeList.OriginalRowIndices()) { j++; ySumArray[j] += pdata.GetYPhysical(originalIndex); pb.Add(ySumArray[j]); } } } } }
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 void MergeZBoundsInto(IPlotArea layer, IPhysicalBoundaries pb, PlotItemCollection coll) { var pbclone = (IPhysicalBoundaries)pb.Clone(); // before we can use CanUseStyle, we have to give physical y boundaries template CoordinateTransformingStyleBase.MergeZBoundsInto(pbclone, coll); if (!CanUseStyle(layer, coll, out var plotDataList)) { pb.Add(pbclone); return; } pb.Add(0); pb.Add(100); }
public void MergeYBoundsInto(IPlotArea layer, IPhysicalBoundaries pb, PlotItemCollection coll) { Dictionary<G2DPlotItem, Processed2DPlotData> plotDataList; IPhysicalBoundaries pbclone = (IPhysicalBoundaries)pb.Clone(); // before we can use CanUseStyle, we have to give physical y boundaries template CoordinateTransformingStyleBase.MergeYBoundsInto(pbclone, coll); if (!CanUseStyle(layer, coll, out plotDataList)) { pb.Add(pbclone); return; } pb.Add(0); pb.Add(100); }
/// <summary> /// This sets the y boundary object to a object of the same type as val. The inner data of the boundary, if present, /// are copied into the new y boundary object. /// </summary> /// <param name="val">The template boundary object.</param> protected void SetYBoundsFromTemplate(IPhysicalBoundaries val) { if (null == _yBoundaries || val.GetType() != _yBoundaries.GetType()) { if (null != _yBoundaries) { _yBoundaries.BoundaryChanged -= new BoundaryChangedHandler(this.EhYBoundariesChanged); } _yBoundaries = (IPhysicalBoundaries)val.Clone(); _yBoundaries.BoundaryChanged += new BoundaryChangedHandler(this.EhYBoundariesChanged); _isCachedDataValid = false; OnChanged(); } }
public void SetVBoundsFromTemplate(IPhysicalBoundaries val) { if (null == m_vBoundaries || val.GetType() != m_vBoundaries.GetType()) { if (null != m_vBoundaries) { m_vBoundaries.BoundaryChanged -= new BoundaryChangedHandler(this.OnVBoundariesChangedEventHandler); } m_vBoundaries = (NumericalBoundaries)val.Clone(); m_vBoundaries.BoundaryChanged += new BoundaryChangedHandler(this.OnVBoundariesChangedEventHandler); this.m_bCachedDataValid = false; OnChanged(); } }
/// <summary> /// This sets the y boundary object to a object of the same type as val. The inner data of the boundary, if present, /// are copied into the new y boundary object. /// </summary> /// <param name="val">The template boundary object.</param> protected void SetYBoundsFromTemplate(IPhysicalBoundaries val) { if(null==_yBoundaries || val.GetType() != _yBoundaries.GetType()) { if(null!=_yBoundaries) { _yBoundaries.BoundaryChanged -= new BoundaryChangedHandler(this.EhYBoundariesChanged); } _yBoundaries = (IPhysicalBoundaries)val.Clone(); _yBoundaries.BoundaryChanged += new BoundaryChangedHandler(this.EhYBoundariesChanged); _isCachedDataValid = false; OnChanged(); } }
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); int idx = 0; foreach (IGPlotItem pi in coll) { if (pi is IYBoundsHolder) { IYBoundsHolder ybpi = (IYBoundsHolder)pi; ybounds.Reset(); ybpi.MergeYBoundsInto(ybounds); ybounds.Shift(_yinc * _scaleYInc * idx); pb.Add(ybounds); } if (pi is G2DPlotItem) idx++; } }