commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] [gnuradio] 23/37: qtgui: time raster display updates.


From: git
Subject: [Commit-gnuradio] [gnuradio] 23/37: qtgui: time raster display updates.
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 c60d058b6d71ba750cb79a8280c5caa3a218c0e7
Author: Tom Rondeau <address@hidden>
Date:   Sat Jul 12 10:39:05 2014 -0400

    qtgui: time raster display updates.
    
    Fixes issue with autoscaling; allows settable intensity min/max in GRC and 
through runtime menu.
---
 gr-qtgui/grc/qtgui_time_raster_x.xml               | 17 +++++++++
 .../include/gnuradio/qtgui/timerasterdisplayform.h |  6 ++--
 gr-qtgui/lib/timerasterdisplayform.cc              | 42 +++++++++++++++++-----
 3 files changed, 55 insertions(+), 10 deletions(-)

diff --git a/gr-qtgui/grc/qtgui_time_raster_x.xml 
b/gr-qtgui/grc/qtgui_time_raster_x.xml
index 512773a..16619cb 100644
--- a/gr-qtgui/grc/qtgui_time_raster_x.xml
+++ b/gr-qtgui/grc/qtgui_time_raster_x.xml
@@ -22,6 +22,7 @@ qtgui.$(type.fcn)(
        )
 
 self.$(id).set_update_time($update_time)
+self.$(id).set_intensity_range($zmin, $zmax)
 self.$(id).enable_grid($grid)
 
 labels = [$label1, $label2, $label3, $label4, $label5,
@@ -106,6 +107,22 @@ $(gui_hint()($win))</make>
   </param>
 
   <param>
+    <name>Int. min</name>
+    <key>zmin</key>
+    <value>-1</value>
+    <type>real</type>
+    <hide>part</hide>
+  </param>
+
+  <param>
+    <name>Int. max</name>
+    <key>zmax</key>
+    <value>1</value>
+    <type>real</type>
+    <hide>part</hide>
+  </param>
+
+  <param>
     <name>Multiplier</name>
     <key>mult</key>
     <value>[]</value>
diff --git a/gr-qtgui/include/gnuradio/qtgui/timerasterdisplayform.h 
b/gr-qtgui/include/gnuradio/qtgui/timerasterdisplayform.h
index dff2986..1abc6eb 100644
--- a/gr-qtgui/include/gnuradio/qtgui/timerasterdisplayform.h
+++ b/gr-qtgui/include/gnuradio/qtgui/timerasterdisplayform.h
@@ -72,6 +72,8 @@ public slots:
 
   void setIntensityRange(const double minIntensity,
                         const double maxIntensity);
+  void setMaxIntensity(const QString &m);
+  void setMinIntensity(const QString &m);
 
   void setColorMap(int which,
                   const int newType,
@@ -86,8 +88,8 @@ private slots:
   void newData(const QEvent *updateEvent);
 
 private:
-  double d_min_val;
-  double d_max_val;
+  double d_min_val, d_cur_min_val;
+  double d_max_val, d_cur_max_val;
 };
 
 #endif /* TIMERASTER_DISPLAY_FORM_H */
diff --git a/gr-qtgui/lib/timerasterdisplayform.cc 
b/gr-qtgui/lib/timerasterdisplayform.cc
index 382e916..eb5405d 100644
--- a/gr-qtgui/lib/timerasterdisplayform.cc
+++ b/gr-qtgui/lib/timerasterdisplayform.cc
@@ -91,6 +91,16 @@ TimeRasterDisplayForm::TimeRasterDisplayForm(int nplots,
   connect(rowsmenu, SIGNAL(whichTrigger(QString)),
          this, SLOT(setNumRows(QString)));
 
+  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)));
+
   getPlot()->setIntensityRange(0, zmax);
 
   Reset();
@@ -155,8 +165,6 @@ TimeRasterDisplayForm::newData(const QEvent *updateEvent)
   const std::vector<double*> dataPoints = event->getPoints();
   const uint64_t numDataPoints = event->getNumDataPoints();
 
-  d_min_val =  10;
-  d_max_val = -10;
   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]);
@@ -239,18 +247,36 @@ TimeRasterDisplayForm::setAlpha(int which, int alpha)
 
 void
 TimeRasterDisplayForm::setIntensityRange(const double minIntensity,
-                                       const double maxIntensity)
+                                         const double maxIntensity)
 {
+  // reset max and min values
+  d_min_val =  10;
+  d_max_val = -10;
+
+  d_cur_min_val = minIntensity;
+  d_cur_max_val = maxIntensity;
   getPlot()->setIntensityRange(minIntensity, maxIntensity);
   getPlot()->replot();
 }
 
 void
-TimeRasterDisplayForm::autoScale(bool en)
+TimeRasterDisplayForm::setMaxIntensity(const QString &m)
 {
-  double min_int = d_min_val;
-  double max_int = d_max_val;
+  double new_max = m.toDouble();
+  if(new_max > d_cur_min_val)
+    setIntensityRange(d_cur_min_val, new_max);
+}
 
-  getPlot()->setIntensityRange(min_int, max_int);
-  getPlot()->replot();
+void
+TimeRasterDisplayForm::setMinIntensity(const QString &m)
+{
+  double new_min = m.toDouble();
+  if(new_min < d_cur_max_val)
+    setIntensityRange(new_min, d_cur_max_val);
+}
+
+void
+TimeRasterDisplayForm::autoScale(bool en)
+{
+  setIntensityRange(d_min_val, d_max_val);
 }



reply via email to

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