diff options
author | Tom Rondeau <trondeau@vt.edu> | 2012-06-28 00:54:13 -0400 |
---|---|---|
committer | Tom Rondeau <trondeau@vt.edu> | 2012-06-28 00:54:13 -0400 |
commit | bc77a2f13c4517459f4759bd2d95c7744282264a (patch) | |
tree | 2c122535861a88e3db37b6ca123c043b9fca3e11 /gr-qtgui/lib/TimeDomainDisplayPlot.cc | |
parent | be0c66690661eb5147b77892caecf89ed5444b90 (diff) |
qtgui: adding ability to start/stop running time plots.
Diffstat (limited to 'gr-qtgui/lib/TimeDomainDisplayPlot.cc')
-rw-r--r-- | gr-qtgui/lib/TimeDomainDisplayPlot.cc | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/gr-qtgui/lib/TimeDomainDisplayPlot.cc b/gr-qtgui/lib/TimeDomainDisplayPlot.cc index 621b677c81..8c3d5dcbbf 100644 --- a/gr-qtgui/lib/TimeDomainDisplayPlot.cc +++ b/gr-qtgui/lib/TimeDomainDisplayPlot.cc @@ -96,7 +96,7 @@ private: }; TimeDomainDisplayPlot::TimeDomainDisplayPlot(int nplots, QWidget* parent) - : QwtPlot(parent), _nplots(nplots) + : QwtPlot(parent), _nplots(nplots), _stop(false) { resize(parent->width(), parent->height()); @@ -290,6 +290,12 @@ TimeDomainDisplayPlot::setLineMarker(int which, QwtSymbol::Style marker) _plot_curve[which]->setSymbol(sym); } +void +TimeDomainDisplayPlot::setStop(bool on) +{ + _stop = on; +} + void TimeDomainDisplayPlot::replot() { QwtPlot::replot(); @@ -306,33 +312,35 @@ void TimeDomainDisplayPlot::PlotNewData(const std::vector<double*> dataPoints, const int64_t numDataPoints, const double timeInterval) { - if((numDataPoints > 0)) { - if(numDataPoints != _numPoints){ - _numPoints = numDataPoints; + if(!_stop) { + if((numDataPoints > 0)) { + if(numDataPoints != _numPoints){ + _numPoints = numDataPoints; - delete[] _xAxisPoints; - _xAxisPoints = new double[_numPoints]; + delete[] _xAxisPoints; + _xAxisPoints = new double[_numPoints]; - for(int i = 0; i < _nplots; i++) { - delete[] _dataPoints[i]; - _dataPoints[i] = new double[_numPoints]; + for(int i = 0; i < _nplots; i++) { + delete[] _dataPoints[i]; + _dataPoints[i] = new double[_numPoints]; #if QWT_VERSION < 0x060000 - _plot_curve[i]->setRawData(_xAxisPoints, _dataPoints[i], _numPoints); + _plot_curve[i]->setRawData(_xAxisPoints, _dataPoints[i], _numPoints); #else - _plot_curve[i]->setRawSamples(_xAxisPoints, _dataPoints[i], _numPoints); + _plot_curve[i]->setRawSamples(_xAxisPoints, _dataPoints[i], _numPoints); #endif + } + + setXaxis(0, numDataPoints); + _resetXAxisPoints(); } - setXaxis(0, numDataPoints); - _resetXAxisPoints(); - } + for(int i = 0; i < _nplots; i++) { + memcpy(_dataPoints[i], dataPoints[i], numDataPoints*sizeof(double)); + } - for(int i = 0; i < _nplots; i++) { - memcpy(_dataPoints[i], dataPoints[i], numDataPoints*sizeof(double)); + replot(); } - - replot(); } } |