Beispiel #1
0
        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]);

            }
          }
        }
      }
    }
Beispiel #3
0
        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);
    }
Beispiel #5
0
        public void CalculateCachedData()
        {
            if (IsDisposeInProgress)
            {
                return;
            }

            // we can calulate the bounds only if they are set before
            if (null == _xBoundaries && null == _yBoundaries && null == _zBoundaries)
            {
                return;
            }

            ISuspendToken suspendTokenX = null;
            ISuspendToken suspendTokenY = null;
            ISuspendToken suspendTokenZ = null;

            suspendTokenX = _xBoundaries?.SuspendGetToken();
            suspendTokenY = _yBoundaries?.SuspendGetToken();
            suspendTokenZ = _zBoundaries?.SuspendGetToken();

            try
            {
                _xBoundaries?.Reset();
                _yBoundaries?.Reset();
                _zBoundaries?.Reset();

                _pointCount = GetMaximumRowIndexFromDataColumns();

                IReadableColumn xColumn = XColumn;
                IReadableColumn yColumn = YColumn;
                IReadableColumn zColumn = ZColumn;

                foreach (var segment in _dataRowSelection.GetSelectedRowIndexSegmentsFromTo(0, _pointCount, _dataTable?.Document?.DataColumns, _pointCount))
                {
                    for (int rowIdx = segment.start; rowIdx < segment.endExclusive; ++rowIdx)
                    {
                        if (!xColumn.IsElementEmpty(rowIdx) && !yColumn.IsElementEmpty(rowIdx) && !zColumn.IsElementEmpty(rowIdx))
                        {
                            _xBoundaries?.Add(xColumn, rowIdx);
                            _yBoundaries?.Add(yColumn, rowIdx);
                            _zBoundaries?.Add(zColumn, rowIdx);
                        }
                    }
                }

                // now the cached data are valid
                _isCachedDataValidX = null != _xBoundaries;
                _isCachedDataValidY = null != _yBoundaries;
                _isCachedDataValidZ = null != _zBoundaries;

                // now when the cached data are valid, we can reenable the events
            }
            finally
            {
                suspendTokenX?.Resume();
                suspendTokenY?.Resume();
                suspendTokenZ?.Resume();
            }
        }
Beispiel #6
0
 public void MergeVBoundsInto(IPhysicalBoundaries pb)
 {
     if (!_isCachedDataValid)
     {
         CalculateCachedData();
     }
     pb.Add(_vBoundaries);
 }
 public void MergeVBoundsInto(IPhysicalBoundaries pb)
 {
     if (!this.m_bCachedDataValid)
     {
         this.CalculateCachedData();
     }
     pb.Add(m_vBoundaries);
 }
        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 MergeYBoundsInto(IPhysicalBoundaries pb)
        {
            if (null == _yBoundaries || pb.GetType() != _yBoundaries.GetType())
            {
                this.SetYBoundsFromTemplate(pb);
            }

            if (!this._isCachedDataValid)
            {
                _SupressBoundaryChangeEvents++;
                this.CalculateCachedData();
                _SupressBoundaryChangeEvents--;
            }
            pb.Add(_yBoundaries);
        }
Beispiel #10
0
        public void MergeZBoundsInto(IPhysicalBoundaries pb)
        {
            if (null == _zBoundaries || pb.GetType() != _zBoundaries.GetType())
            {
                SetZBoundsFromTemplate(pb);
            }

            if (!_isCachedDataValidY)
            {
                using (var suspendToken = SuspendGetToken())
                {
                    CalculateCachedData();
                }
            }
            pb.Add(_zBoundaries);
        }
Beispiel #11
0
        public void CalculateCachedData()
        {
            if (IsDisposeInProgress)
            {
                return;
            }

            if (0 == RowCount || 0 == ColumnCount)
            {
                return;
            }

            using (var suspendTokenX = _xBoundaries.SuspendGetToken())
            {
                using (var suspendTokenY = _yBoundaries.SuspendGetToken())
                {
                    using (var suspendTokenV = _vBoundaries.SuspendGetToken())
                    {
                        _xBoundaries.Reset();
                        _yBoundaries.Reset();
                        _vBoundaries.Reset();

                        _matrixProxy.ForEachMatrixElementDo((col, idx) => _vBoundaries.Add(col, idx));
                        _matrixProxy.ForEachRowHeaderElementDo((col, idx) => _xBoundaries.Add(col, idx));
                        _matrixProxy.ForEachColumnHeaderElementDo((col, idx) => _yBoundaries.Add(col, idx));

                        // now the cached data are valid
                        _isCachedDataValid = true;

                        // now when the cached data are valid, we can reenable the events
                        suspendTokenV.Resume();
                    }
                    suspendTokenY.Resume();
                }
                suspendTokenX.Resume();
            }
        }
Beispiel #12
0
		public void MergeYBoundsInto(IPhysicalBoundaries pb)
		{
			if (null == _yBoundaries || pb.GetType() != _yBoundaries.GetType())
				this.SetYBoundsFromTemplate(pb);

			if (!this._isCachedDataValidY)
			{
				using (var suspendToken = SuspendGetToken())
				{
					this.CalculateCachedData();
				}
			}
			pb.Add(_yBoundaries);
		}
		public void MergeVBoundsInto(IPhysicalBoundaries pb)
		{
			if (!this._isCachedDataValid)
				this.CalculateCachedData();
			pb.Add(_vBoundaries);
		}
    public void MergeYBoundsInto(IPhysicalBoundaries pb)
    {
      if (null == _yBoundaries || pb.GetType() != _yBoundaries.GetType())
        this.SetYBoundsFromTemplate(pb);

      if(!this._isCachedDataValid)
      {
        _SupressBoundaryChangeEvents++;
        this.CalculateCachedData();
        _SupressBoundaryChangeEvents--;
      }
      pb.Add(_yBoundaries);
    }
Beispiel #15
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);

			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++;
			}
		}