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(); } }
public bool IsElementEmpty(int i) { if (_originalColumn.IsElementEmpty(i)) { return(true); } var val = _transformation.Transform(_originalColumn[i]); if (val.IsType(AltaxoVariant.Content.VDouble) && double.IsNaN(val)) { return(true); } if (val.IsType(AltaxoVariant.Content.VString) && null == (string)val) { return(true); } return(false); }
public void CalculateCachedData() { // we can calulate the bounds only if they are set before if (null == _xBoundaries || null == _yBoundaries) { return; } _plottablePoints = 0; this._xBoundaries.BeginUpdate(); // disable events this._yBoundaries.BeginUpdate(); // disable events this._xBoundaries.Reset(); this._yBoundaries.Reset(); System.Diagnostics.Debug.Assert(_plotRangeStart >= 0); System.Diagnostics.Debug.Assert(_plotRangeLength >= 0); _pointCount = _plotRangeLength == int.MaxValue ? int.MaxValue : _plotRangeStart + _plotRangeLength; IReadableColumn xColumn = this.XColumn; IReadableColumn yColumn = this.YColumn; if (xColumn == null || yColumn == null) { _pointCount = 0; _plottablePoints = 0; } else { if (xColumn is IDefinedCount) { _pointCount = System.Math.Min(_pointCount, ((IDefinedCount)xColumn).Count); } if (yColumn is IDefinedCount) { _pointCount = System.Math.Min(_pointCount, ((IDefinedCount)yColumn).Count); } // if both columns are indefinite long, we set the length to zero if (_pointCount == int.MaxValue || _pointCount < 0) { _pointCount = 0; } for (int i = _plotRangeStart; i < _pointCount; i++) { if (!xColumn.IsElementEmpty(i) && !yColumn.IsElementEmpty(i)) { bool x_added = this._xBoundaries.Add(xColumn, i); bool y_added = this._yBoundaries.Add(yColumn, i); if (x_added && y_added) { _plottablePoints++; } } } } // now the cached data are valid _isCachedDataValid = true; // now when the cached data are valid, we can reenable the events this._xBoundaries.EndUpdate(); // enable events this._yBoundaries.EndUpdate(); // enable events }