commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] [gnuradio] 05/08: qtgui: enable/disable waterfall lege


From: git
Subject: [Commit-gnuradio] [gnuradio] 05/08: qtgui: enable/disable waterfall legend.
Date: Mon, 6 Apr 2015 06:03:45 +0000 (UTC)

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

jcorgan pushed a commit to branch master
in repository gnuradio.

commit 5ec001c34cb6eca8f12280de80023e3f3429013b
Author: Tom Rondeau <address@hidden>
Date:   Sun Apr 5 13:51:19 2015 -0400

    qtgui: enable/disable waterfall legend.
    
    The waterfall plots have a different concept of the legend than the
    others. It shows the intensity, but not the plot names. This allows us
    to enable or disable showing the intesity as the right axis by setting
    the Legend to Yes or No in the GRC properties box (or calling
    disable_legend() on the waterfall object).
---
 gr-qtgui/include/gnuradio/qtgui/DisplayPlot.h      |  3 +--
 .../include/gnuradio/qtgui/WaterfallDisplayPlot.h  |  4 ++++
 gr-qtgui/lib/WaterfallDisplayPlot.cc               | 28 +++++++++++++++++++---
 3 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/gr-qtgui/include/gnuradio/qtgui/DisplayPlot.h 
b/gr-qtgui/include/gnuradio/qtgui/DisplayPlot.h
index 19b1182..3d7b29b 100644
--- a/gr-qtgui/include/gnuradio/qtgui/DisplayPlot.h
+++ b/gr-qtgui/include/gnuradio/qtgui/DisplayPlot.h
@@ -125,8 +125,6 @@ public:
   DisplayPlot(int nplots, QWidget*);
   virtual ~DisplayPlot();
 
-  void disableLegend();
-
   virtual void replot() = 0;
 
   const QColor getLineColor1 () const;
@@ -191,6 +189,7 @@ public:
   // void PlotNewData(...);
 
 public slots:
+  virtual void disableLegend();
   virtual void setYaxis(double min, double max);
   virtual void setXaxis(double min, double max);
   virtual void setLineLabel(int which, QString label);
diff --git a/gr-qtgui/include/gnuradio/qtgui/WaterfallDisplayPlot.h 
b/gr-qtgui/include/gnuradio/qtgui/WaterfallDisplayPlot.h
index 37c6183..f885deb 100644
--- a/gr-qtgui/include/gnuradio/qtgui/WaterfallDisplayPlot.h
+++ b/gr-qtgui/include/gnuradio/qtgui/WaterfallDisplayPlot.h
@@ -96,6 +96,9 @@ public slots:
   void setUserDefinedLowIntensityColor(QColor);
   void setUserDefinedHighIntensityColor(QColor);
   void setPlotPosHalf(bool half);
+  void disableLegend();
+  void enableLegend();
+  void enableLegend(bool en);
 
 signals:
   void updatedLowerIntensityLevel(const double);
@@ -108,6 +111,7 @@ private:
   double d_stop_frequency;
   int    d_xaxis_multiplier;
   bool   d_half_freq;
+  bool   d_legend_enabled;
 
   std::vector<WaterfallData*> d_data;
 
diff --git a/gr-qtgui/lib/WaterfallDisplayPlot.cc 
b/gr-qtgui/lib/WaterfallDisplayPlot.cc
index ef1ec3b..8564758 100644
--- a/gr-qtgui/lib/WaterfallDisplayPlot.cc
+++ b/gr-qtgui/lib/WaterfallDisplayPlot.cc
@@ -140,6 +140,7 @@ WaterfallDisplayPlot::WaterfallDisplayPlot(int nplots, 
QWidget* parent)
   resize(parent->width(), parent->height());
   d_numPoints = 1024;
   d_half_freq = false;
+  d_legend_enabled = true;
 
   setAxisTitle(QwtPlot::xBottom, "Frequency (Hz)");
   setAxisScaleDraw(QwtPlot::xBottom, new FreqDisplayScaleDraw(0));
@@ -564,7 +565,7 @@ WaterfallDisplayPlot::_updateIntensityRangeDisplay()
   for(int i = 0; i < d_nplots; i++) {
 #if QWT_VERSION < 0x060000
     rightAxis->setColorMap(d_spectrogram[i]->data()->range(),
-                          d_spectrogram[i]->colorMap());
+                           d_spectrogram[i]->colorMap());
     setAxisScale(QwtPlot::yRight,
                 d_spectrogram[i]->data()->range().minValue(),
                 d_spectrogram[i]->data()->range().maxValue());
@@ -585,7 +586,7 @@ WaterfallDisplayPlot::_updateIntensityRangeDisplay()
       rightAxis->setColorMap(intv, new ColorMap_Cool()); break;
     case INTENSITY_COLOR_MAP_TYPE_USER_DEFINED:
       rightAxis->setColorMap(intv, new 
ColorMap_UserDefined(d_user_defined_low_intensity_color,
-                                                           
d_user_defined_high_intensity_color));
+                                                            
d_user_defined_high_intensity_color));
       break;
     default:
       rightAxis->setColorMap(intv, new ColorMap_MultiColor()); break;
@@ -593,7 +594,7 @@ WaterfallDisplayPlot::_updateIntensityRangeDisplay()
     setAxisScale(QwtPlot::yRight, intv.minValue(), intv.maxValue());
 #endif
 
-    enableAxis(QwtPlot::yRight);
+    enableAxis(d_legend_enabled);
 
     plotLayout()->setAlignCanvasToScales(true);
 
@@ -607,6 +608,27 @@ WaterfallDisplayPlot::_updateIntensityRangeDisplay()
 }
 
 void
+WaterfallDisplayPlot::disableLegend()
+{
+  d_legend_enabled = false;
+  enableAxis(QwtPlot::yRight, false);
+}
+
+void
+WaterfallDisplayPlot::enableLegend()
+{
+  d_legend_enabled = true;
+  enableAxis(QwtPlot::yRight, true);
+}
+
+void
+WaterfallDisplayPlot::enableLegend(bool en)
+{
+  d_legend_enabled = en;
+  enableAxis(QwtPlot::yRight, en);
+}
+
+void
 WaterfallDisplayPlot::setPlotPosHalf(bool half)
 {
   d_half_freq = half;



reply via email to

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