Ejemplo n.º 1
0
        /// <summary>
        /// Perform one step of peak and graph axes animations.
        /// </summary>
        private void Animate()
        {
            FrameMilliseconds = NORMAL_FRAME_MILLISECONDS;

            // Animate range of x and y axes.
            if (_xAxisAnimation != null)
            {
                _graphPane.XAxis.Scale.Max = _xAxisAnimation.Step();
                _graphPane.AxisChange();

                if (_xAxisAnimation.Done)
                    _xAxisAnimation = null;
                else
                    FrameMilliseconds = FAST_FRAME_MILLISECONDS;
            }

            if (_yAxisAnimation != null)
            {
                _graphPane.YAxis.Scale.Max = _yAxisAnimation.Step();
                _graphPane.AxisChange();

                if (_yAxisAnimation.Done)
                    _yAxisAnimation = null;
                else
                    FrameMilliseconds = FAST_FRAME_MILLISECONDS;
            }
        }
Ejemplo n.º 2
0
 private void ResetGraph()
 {
     string sampleName = _status.FilePath.GetSampleName();
     string filePath = _status.FilePath.GetFileName();
     var fileName = !string.IsNullOrEmpty(sampleName)
         ? string.Format(Resources.AsyncChromatogramsGraph_Render__0___sample__1_, filePath, sampleName)
         : filePath;
     _graphPane.Title.Text = fileName;
     _graphPane.CurveList.Clear();
     _graphPane.XAxis.Scale.Max = _xMax = Math.Max(X_AXIS_START, _status.Transitions.MaxRetentionTime);
     _graphPane.YAxis.Scale.Max = _yMax = Y_AXIS_START;
     _graphPane.AxisChange();
     _xAxisAnimation = null;
     _yAxisAnimation = null;
     _activeCurves.Clear();
     _lastCurve = null;
     _fullFrame = true;
     UpdateProgressLine(0);
     _graphPane.Chart.Fill = new Fill(Color.White);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Add peaks to the graph.
        /// </summary>
        /// <returns>True if render is needed.</returns>
        private bool AddData(ChromatogramLoadingStatus.TransitionData transitions)
        {
            List<ChromatogramLoadingStatus.TransitionData.Peak> bin;
            bool peaksAdded = false;

            // Process bins of peaks queued by the reader thread.
            float maxTime = (float) Math.Max(Math.Max(_xMax, transitions.MaxRetentionTime), transitions.CurrentTime);
            float maxIntensity = 0;
            while (transitions.BinnedPeaks.TryPeek(out bin))
            {
                transitions.BinnedPeaks.TryDequeue(out bin);

                if (bin == null)
                {
                    ResetGraph();
                    maxTime = (float) _xMax;
                    maxIntensity = 0;
                    transitions.MaxIntensity = 0;
                    continue;
                }

                if (transitions.Progressive)
                    ProcessBinProgressive(bin, ref peaksAdded, ref maxTime, ref maxIntensity);
                else
                    ProcessBinSRM(bin, ref peaksAdded, ref maxTime, ref maxIntensity);

                transitions.MaxIntensity = Math.Max(transitions.MaxIntensity, maxIntensity);
            }

            // Rescale graph if necessary.
            if (_xMax <= X_AXIS_START)
            {
                _xMax = maxTime;
                _xAxisAnimation = new Animation(_graphPane.XAxis.Scale.Max, _xMax, 1, FAST_FRAME_MILLISECONDS);
            }
            else if (_xMax < maxTime)
            {
                _xMax = maxTime * 1.1;
                _xAxisAnimation = new Animation(_graphPane.XAxis.Scale.Max, _xMax, STEPS_FOR_TIME_AXIS_ANIMATION,
                    FAST_FRAME_MILLISECONDS);
            }

            if (_yMax < maxIntensity)
            {
                _yMax = maxIntensity*1.1;
                _yAxisAnimation = new Animation(_graphPane.YAxis.Scale.Max, _yMax, STEPS_FOR_INTENSITY_ANIMATION);
            }

            return peaksAdded;
        }