From 0877adb2e194c9dfad2484519b2979e2bed93958 Mon Sep 17 00:00:00 2001
From: Tom Rondeau <trondeau@vt.edu>
Date: Sat, 23 Apr 2011 15:11:17 -0400
Subject: gr-qtgui: Passing vectors of data to update plot for stability; also
 moving responsibility of keeping track of plot updates out to qtgui_sink
 instead of inside plot qidget.

---
 gr-qtgui/lib/TimeDomainDisplayPlot.cc | 30 +++++++++++-------------------
 1 file changed, 11 insertions(+), 19 deletions(-)

(limited to 'gr-qtgui/lib/TimeDomainDisplayPlot.cc')

diff --git a/gr-qtgui/lib/TimeDomainDisplayPlot.cc b/gr-qtgui/lib/TimeDomainDisplayPlot.cc
index c9973fbc22..e3c773e4cd 100644
--- a/gr-qtgui/lib/TimeDomainDisplayPlot.cc
+++ b/gr-qtgui/lib/TimeDomainDisplayPlot.cc
@@ -95,8 +95,6 @@ private:
 TimeDomainDisplayPlot::TimeDomainDisplayPlot(int nplots, QWidget* parent)
   : QwtPlot(parent), _nplots(nplots)
 {
-  timespec_reset(&_lastReplot);
-
   resize(parent->width(), parent->height());
 
   _numPoints = 1024;
@@ -215,36 +213,30 @@ TimeDomainDisplayPlot::resizeSlot( QSize *s )
   resize(s->width(), s->height());
 }
 
-void TimeDomainDisplayPlot::PlotNewData(const int which,
-					const double* dataPoints,
+void TimeDomainDisplayPlot::PlotNewData(const std::vector<double*> dataPoints,
 					const int64_t numDataPoints,
 					const double timeInterval)
 {
-  if((numDataPoints > 0) && 
-     (diff_timespec(get_highres_clock(), _lastReplot) > timeInterval)) {
-  
+  if((numDataPoints > 0)) {
     if(numDataPoints != _numPoints){
       _numPoints = numDataPoints;
 
-      delete[] _dataPoints[which];
-      _dataPoints[which] = new double[_numPoints];
-
       delete[] _xAxisPoints;
       _xAxisPoints = new double[_numPoints];
-      
-      _plot_curve[which]->setRawData(_xAxisPoints, _dataPoints[which], _numPoints);
 
+      for(int i = 0; i < _nplots; i++) {
+	delete[] _dataPoints[i];
+	_dataPoints[i] = new double[_numPoints];
+	_plot_curve[i]->setRawData(_xAxisPoints, _dataPoints[i], _numPoints);
+      }
+      
       set_xaxis(0, numDataPoints);
-
       _resetXAxisPoints();
     }
 
-    std::cout << "DisplayPlot: " << which << std::endl;
-    memcpy(_dataPoints[which], dataPoints, numDataPoints*sizeof(double));
-    std::cout << "after" << std::endl;
-
-    if(which == _nplots-1)
-      _lastReplot = get_highres_clock();
+    for(int i = 0; i < _nplots; i++) {
+      memcpy(_dataPoints[i], dataPoints[i], numDataPoints*sizeof(double));
+    }
   }
 }
 
-- 
cgit v1.2.3