Ejemplo n.º 1
0
        private float?OnePoint()
        {
            float sum = 0;
            int   boundary;

            if (_block.Length - _index < _n)
            {
                boundary = _n - (_block.Length - _index);
                for (; _index < _block.Length; _index++)
                {
                    sum += _block[_index];
                }
                _block.Clear();
                _source.LoadBlock(_block);
                _index = 0;
            }
            else
            {
                boundary = _index + _n;
            }
            for (; _index < boundary; _index++)
            {
                sum += _block[_index];
            }
            return(sum / _n);
        }
Ejemplo n.º 2
0
        private void TaskSpecificProcess()
        {
            _collector.Start();
            _realBlock.Clear();
            _baseBlock.Clear();
            _preBaseBlock.Clear();
            _source.LoadBlock(_baseBlock);
            _source.LoadBlock(_preBaseBlock);
            _listRenderTask.Begin(_realBlock, _baseBlock, _preBaseBlock);
            if (_viewRenderTask != null)
            {
                _viewRenderTask.Begin(_realBlock, _baseBlock, _preBaseBlock);
            }
            if (_statisticTask != null)
            {
                _statisticTask.Start();
            }
            if (_startedCallback != null)
            {
                _startedCallback();
            }


            while (_rendering)
            {
                int index  = _realBlock.Length;
                int length = Math.Min(_realBlock.Capacity, CollectStep);
                length = _collector.CollectPoints(_realBlock, length);
                if (length == 0)
                {
                    _rendering = false;
                    break;
                }
                bool needNewList, needNewView = false;
                needNewList = _listRenderTask.RenderRealPoints(length);
                if (_viewRenderTask != null)
                {
                    needNewView = _viewRenderTask.RenderRealPoints(length);
                }
                if (_statisticTask != null)
                {
                    _statisticTask.Statistics(_baseBlock, _realBlock, index, length);
                }
                if (_scrollTask != null && _scrollTask.IsEnable)
                {
                    _scrollTask.Scroll(_statisticTask.StatisticResult.Count);
                }
                Debug.Assert(!_realBlock.IsFull || needNewList);
                if (_realBlock.IsFull)
                {
                    _file.WriteBlock(_realBlock);
                    _realBlock.Clear();
                    var tb = _baseBlock;
                    _baseBlock    = _preBaseBlock;
                    _preBaseBlock = tb;
                    _preBaseBlock.Clear();
                    _source.LoadBlock(_preBaseBlock);
                    _listRenderTask.RenderBasePointsBlock(_preBaseBlock);
                    if (_viewRenderTask != null)
                    {
                        _viewRenderTask.RenderBasePointsBlock(_preBaseBlock);
                    }
                }
                if (needNewList)
                {
                    _listRenderTask.PrepareRenderItem(_realBlock);
                }
                if (_viewRenderTask != null && needNewView)
                {
                    _viewRenderTask.PrepareRenderItem(_realBlock);
                }
            }

            _collector.Stop();
            _listRenderTask.Finish();
            if (_viewRenderTask != null)
            {
                _viewRenderTask.Finish();
            }
            if (_statisticTask != null)
            {
                _statisticTask.Stop();
            }
            _file.WriteBlock(_realBlock);
            if (_stopedCallback != null)
            {
                _stopedCallback();
            }
        }