public override bool FillYPlotDatas(int beginXIndex, int endXIndex, bool forceRefresh, int seriesIndex, int newSparseRatio, int plotCount) { // 如果不需要强制更新,且当前起始位置等于上次起始位置、当前结束位置小于等于上次结束位置、新的SparseRatio等于上次的SpaseRatio时无需更新数据。 if (!forceRefresh && LastYStartIndex[seriesIndex] == beginXIndex && LastYEndIndex[seriesIndex] >= endXIndex && SparseRatio[seriesIndex] == newSparseRatio) { return(false); } LastYStartIndex[seriesIndex] = beginXIndex; LastYEndIndex[seriesIndex] = endXIndex; SparseRatio[seriesIndex] = newSparseRatio; if (1 == newSparseRatio) { ParallelHandler.FillNoneFitPlotData(beginXIndex, SparseRatio[seriesIndex], _yBuffers[seriesIndex], _plotBuffer.YPlotBuffer[seriesIndex], plotCount); } else { switch (ParentManager.FitType) { case StripChartX.FitType.None: ParallelHandler.FillNoneFitPlotData(beginXIndex, SparseRatio[seriesIndex], _yBuffers[seriesIndex], _plotBuffer.YPlotBuffer[seriesIndex], plotCount); break; case StripChartX.FitType.Range: ParallelHandler.FillRangeFitPlotData <TDataType>(beginXIndex, SparseRatio[seriesIndex], _yBuffers[seriesIndex], _plotBuffer.YPlotBuffer[seriesIndex], plotCount); break; } } return(true); }
public DataEntity(DataCheckParameters dataCheckParams) { DataInfo = new DataEntityInfo(); PlotBuf = new PlotBuffer(this); _transBuf = null; _dataCheckParams = dataCheckParams; Parallel = new ParallelHandler(this, dataCheckParams); }
protected PlotAction(StripPlotter plotter, AxisViewAdapter axisViewAdapter) { this.Plotter = plotter; this.PlotSeries = plotter.PlotSeries; this.SamplesInChart = 0; this.SparseRatio = 1; this.AxisViewAdapter = axisViewAdapter; this.Parallel = new ParallelHandler(this); _maxYValue = double.MinValue; _minYValue = double.MaxValue; this.YWrapBufs = new List <OverLapWrapBuffer <double> >(Constants.MaxSeriesToDraw); }
/// <summary> /// Create a new instance of CircularQueue /// </summary> /// <param name="capacity">The maximum count of data can be stored in queue. An overflow exception will be raised when the count of queue data exceeed this value</param> public CircularQueue(int capacity) { const int defaultCapacity = 1024; if (capacity <= 0) //输入的size无效,创建默认大小的缓冲区 { capacity = defaultCapacity; } _capacity = capacity; _dataTypeSize = Marshal.SizeOf(typeof(TDataType)); _dataBuffer = new TDataType[_capacity]; _startIndex = 0; _endIndex = 0; _dataCount = 0; _queueLock = new SpinLock(); _propertyReadTimeout = -1; _autoLock = AutoLockValue; BlockWait = true; _parallel = new ParallelHandler <TDataType>(_dataBuffer); }
protected DataEntityBase(PlotManager plotManager, DataEntityInfo dataInfo) { this.ParentManager = plotManager; this.FitType = plotManager.FitType; this.DataInfo = dataInfo; this.ParallelHandler = new ParallelHandler(ParentManager.DataCheckParams); _lastXStart = int.MinValue; _lastXEnd = int.MinValue; _lastXSparseRatio = int.MinValue; LastYStartIndex = new int[DataInfo.LineCount]; LastYEndIndex = new int[DataInfo.LineCount]; SparseRatio = new int[DataInfo.LineCount]; _maxYValues = new double[DataInfo.LineCount]; _minYValues = new double[DataInfo.LineCount]; for (int i = 0; i < DataInfo.LineCount; i++) { LastYStartIndex[i] = int.MinValue; LastYEndIndex[i] = int.MinValue; SparseRatio[i] = int.MaxValue; _maxYValues[i] = double.MinValue; _minYValues[i] = double.MaxValue; } }