commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 24/37: qtgui: fixes waterfall plots.


From: git
Subject: [Commit-gnuradio] [gnuradio] 24/37: qtgui: fixes waterfall plots.
Date: Thu, 17 Jul 2014 20:23:42 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

trondeau pushed a commit to branch master
in repository gnuradio.

commit 79f06c437d61b9847cf66f7baa845dab29eda55e
Author: Tom Rondeau <address@hidden>
Date:   Sat Jul 12 10:49:21 2014 -0400

    qtgui: fixes waterfall plots.
    
    Better autoscaling and ability to set max and min intensity in runtime menu.
---
 .../include/gnuradio/qtgui/waterfalldisplayform.h  |  6 ++--
 gr-qtgui/lib/waterfalldisplayform.cc               | 37 +++++++++++++++++++---
 2 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/gr-qtgui/include/gnuradio/qtgui/waterfalldisplayform.h 
b/gr-qtgui/include/gnuradio/qtgui/waterfalldisplayform.h
index 5af2680..8017d5c 100644
--- a/gr-qtgui/include/gnuradio/qtgui/waterfalldisplayform.h
+++ b/gr-qtgui/include/gnuradio/qtgui/waterfalldisplayform.h
@@ -75,6 +75,8 @@ public slots:
 
   void setIntensityRange(const double minIntensity,
                         const double maxIntensity);
+  void setMaxIntensity(const QString &m);
+  void setMinIntensity(const QString &m);
 
   void setAlpha(int which, int alpha);
 
@@ -101,8 +103,8 @@ private:
   bool d_clicked;
   double d_clicked_freq;
 
-  double d_min_val;
-  double d_max_val;
+  double d_min_val, d_cur_min_val;
+  double d_max_val, d_cur_max_val;
 
   FFTSizeMenu *d_sizemenu;
   FFTAverageMenu *d_avgmenu;
diff --git a/gr-qtgui/lib/waterfalldisplayform.cc 
b/gr-qtgui/lib/waterfalldisplayform.cc
index 51f518f..fdf09d9 100644
--- a/gr-qtgui/lib/waterfalldisplayform.cc
+++ b/gr-qtgui/lib/waterfalldisplayform.cc
@@ -91,6 +91,16 @@ WaterfallDisplayForm::WaterfallDisplayForm(int nplots, 
QWidget* parent)
   connect(d_winmenu, SIGNAL(whichTrigger(gr::filter::firdes::win_type)),
          this, SLOT(setFFTWindowType(const gr::filter::firdes::win_type)));
 
+  PopupMenu *maxintmenu = new PopupMenu("Int. Max", this);
+  d_menu->addAction(maxintmenu);
+  connect(maxintmenu, SIGNAL(whichTrigger(QString)),
+         this, SLOT(setMaxIntensity(QString)));
+
+  PopupMenu *minintmenu = new PopupMenu("Int. Min", this);
+  d_menu->addAction(minintmenu);
+  connect(minintmenu, SIGNAL(whichTrigger(QString)),
+         this, SLOT(setMinIntensity(QString)));
+
   Reset();
 
   connect(d_display_plot, SIGNAL(plotPointSelected(const QPointF)),
@@ -119,8 +129,6 @@ WaterfallDisplayForm::newData(const QEvent *updateEvent)
   const uint64_t numDataPoints = event->getNumDataPoints();
   const gr::high_res_timer_type dataTimestamp = event->getDataTimestamp();
 
-  d_min_val =  1000;
-  d_max_val = -1000;
   for(size_t i=0; i < dataPoints.size(); i++) {
     double *min_val = std::min_element(&dataPoints[i][0], 
&dataPoints[i][numDataPoints-1]);
     double *max_val = std::max_element(&dataPoints[i][0], 
&dataPoints[i][numDataPoints-1]);
@@ -257,18 +265,39 @@ void
 WaterfallDisplayForm::setIntensityRange(const double minIntensity,
                                        const double maxIntensity)
 {
+  // reset max and min values
+  d_min_val =  1000;
+  d_max_val = -1000;
+
+  d_cur_min_val = minIntensity;
+  d_cur_max_val = maxIntensity;
   getPlot()->setIntensityRange(minIntensity, maxIntensity);
   getPlot()->replot();
 }
 
 void
+WaterfallDisplayForm::setMaxIntensity(const QString &m)
+{
+  double new_max = m.toDouble();
+  if(new_max > d_cur_min_val)
+    setIntensityRange(d_cur_min_val, new_max);
+}
+
+void
+WaterfallDisplayForm::setMinIntensity(const QString &m)
+{
+  double new_min = m.toDouble();
+  if(new_min < d_cur_max_val)
+    setIntensityRange(new_min, d_cur_max_val);
+}
+
+void
 WaterfallDisplayForm::autoScale(bool en)
 {
   double min_int = d_min_val - 5;
   double max_int = d_max_val + 10;
 
-  getPlot()->setIntensityRange(min_int, max_int);
-  getPlot()->replot();
+  setIntensityRange(min_int, max_int);
 }
 
 void



reply via email to

[Prev in Thread] Current Thread [Next in Thread]