/// <summary> /// Reset the plotter. Erases the graphs and gets ready to start the whole plotting process again. To start once again, call Start () /// after calling Reset (). /// </summary> public void Reset () { // Skip if the Dispose() method has been called. if (IsDisposed) { return; } if (m_CurrentState == PlotterState.Running) { Stop(); } CompressedMode = false; m_CurrentState = PlotterState.Reset; m_LeftDisplayLimit = 0; m_SavedLeftDisplayLimit = 0; m_TotalPointsToRemove = 0; m_PointsToRemove = 0; m_StoppedLeftDisplayLimit = 0; m_TotalTimeElapsed = 0; m_HScrollBar.Visible = false; int xRangeInMs = (int)(m_XRange.Duration().Ticks / TimeSpan.TicksPerMillisecond); m_HScrollBar.Maximum = xRangeInMs / m_InitialPlotIntervalMs; m_HScrollBar.Value = m_HScrollBar.Maximum; // Reset the channel data for each control. foreach (Channel channel in Channels) { channel.CursorOffset = 0; channel.Points.Clear (); channel.X.Clear(); channel.TotalTimeElapsed = 0; } RefreshDisplay (); }
/// <summary> /// Stop plotting. The user can now view the graphs. /// </summary> public void Stop () { // Skip if the Dispose() method has been called. if (IsDisposed) { return; } m_CurrentState = PlotterState.Stopped; if (m_PointsToRemove == 0) { return; } m_StoppedLeftDisplayLimit = m_LeftDisplayLimit; m_HScrollBar.Visible = true; m_HScrollBar.Maximum = m_PointsToRemove + m_HScrollBar.LargeChange; m_HScrollBar.Value = 0; m_TotalPointsToRemove = m_PointsToRemove - 1; RefreshDisplay (); }
/// <summary> /// Start plotting. /// </summary> public void Start () { // Skip if the Dispose() method has been called. if (IsDisposed) { return; } if (m_CurrentState == PlotterState.Running) { return; } if (CompressedMode) { CompressedMode = false; } m_CurrentState = PlotterState.Running; m_HScrollBar.Visible = false; m_PointsToRemove = m_TotalPointsToRemove; m_LeftDisplayLimit = m_StoppedLeftDisplayLimit; }
/// <summary> /// Starts the plotting /// </summary> public void Start() { if (currentState == PlotterState.Running) { return; } // come here only when we had either paused or reset the plotter // in case compression mode is set, remove it // this if check is important. simply CompressedMode = false; will not work // debug and check for yourself if (CompressedMode) { CompressedMode = false; } currentState = PlotterState.Running; plotterHScrollBar.Visible = false; pointsToRemove = totalPointsToRemove; leftDisplayLimit = stoppedLeftDisplayLimit; // string message = string.Format ("Left display limit = {0}, points to remove = {1}", leftDisplayLimit, pointsToRemove); // debugLabel.Text = message; }
/// <summary> /// Resets the plotter. Erases the graphs and gets ready to start the /// whole plotting process again. To start once again, call Start () /// after calling Reset (). /// </summary> public void Reset() { if (currentState == PlotterState.Running) { Stop(); } CompressedMode = false; currentState = PlotterState.Reset; leftDisplayLimit = 0; savedLeftDisplayLimit = 0; totalPointsToRemove = 0; pointsToRemove = 0; stoppedLeftDisplayLimit = 0; int xRangeInMs = (int) (xRange.Duration().Ticks / TimeSpan.TicksPerMillisecond); plotterHScrollBar.Visible = false; plotterHScrollBar.Maximum = xRangeInMs / initialPlotRate; plotterHScrollBar.Value = plotterHScrollBar.Maximum; TotalTimeElapsed = 0; foreach (Channel channel in Channels) { channel.CursorOffset = 0; channel.Points.Clear(); channel.TotalTimeElapsed = 0; } RefreshDisplay(); }
/// <summary> /// Stops the plotting. The user can now view the graphs /// </summary> public void Stop() { currentState = PlotterState.Stopped; if (pointsToRemove == 0) { return; } stoppedLeftDisplayLimit = leftDisplayLimit; plotterHScrollBar.Visible = true; plotterHScrollBar.Maximum = pointsToRemove + plotterHScrollBar.LargeChange; // TODO: Figure out how this works plotterHScrollBar.Value = 0; totalPointsToRemove = pointsToRemove - 1; // string message = string.Format ("Left display limit = {0}, points to remove = {1}", leftDisplayLimit, pointsToRemove); // debugLabel.Text = message; RefreshDisplay(); }