commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] [gnuradio] 07/23: qtgui: Mostly adds sunset and cool c


From: git
Subject: [Commit-gnuradio] [gnuradio] 07/23: qtgui: Mostly adds sunset and cool color schemes for waterfall/raster plots.
Date: Thu, 26 Jun 2014 19:54:43 +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 40b9339f9c891574d02399fa91c66f32fab65779
Author: Tom Rondeau <address@hidden>
Date:   Tue Jun 24 18:55:46 2014 -0400

    qtgui: Mostly adds sunset and cool color schemes for waterfall/raster plots.
---
 gr-qtgui/grc/qtgui_time_raster_x.xml          |  8 +++++
 gr-qtgui/grc/qtgui_waterfall_sink_x.xml       |  8 +++++
 gr-qtgui/include/gnuradio/qtgui/form_menus.h  | 51 ++++++++++++++++++++++++++-
 gr-qtgui/include/gnuradio/qtgui/qtgui_types.h | 34 +++++++++++++++++-
 gr-qtgui/lib/TimeRasterDisplayPlot.cc         | 18 ++++++++--
 gr-qtgui/lib/WaterfallDisplayPlot.cc          | 28 +++++++++++++--
 gr-qtgui/lib/spectrumdisplayform.ui           | 10 ++++++
 gr-qtgui/swig/qtgui_swig.i                    |  4 ++-
 8 files changed, 154 insertions(+), 7 deletions(-)

diff --git a/gr-qtgui/grc/qtgui_time_raster_x.xml 
b/gr-qtgui/grc/qtgui_time_raster_x.xml
index db13ce5..db878eb 100644
--- a/gr-qtgui/grc/qtgui_time_raster_x.xml
+++ b/gr-qtgui/grc/qtgui_time_raster_x.xml
@@ -148,6 +148,14 @@ $(gui_hint()($win))</make>
       <name>Incandescent</name>
       <key>3</key>
     </option>
+    <option>
+      <name>Sunset</name>
+      <key>5</key>
+    </option>
+    <option>
+      <name>Cool</name>
+      <key>6</key>
+    </option>
     <tab>Config</tab>
   </param>
 
diff --git a/gr-qtgui/grc/qtgui_waterfall_sink_x.xml 
b/gr-qtgui/grc/qtgui_waterfall_sink_x.xml
index 943aa9d..fcd8d97 100644
--- a/gr-qtgui/grc/qtgui_waterfall_sink_x.xml
+++ b/gr-qtgui/grc/qtgui_waterfall_sink_x.xml
@@ -168,6 +168,14 @@ $(gui_hint()($win))</make>
       <name>Incandescent</name>
       <key>3</key>
     </option>
+    <option>
+      <name>Sunset</name>
+      <key>5</key>
+    </option>
+    <option>
+      <name>Cool</name>
+      <key>6</key>
+    </option>
     <tab>Config</tab>
   </param>
 
diff --git a/gr-qtgui/include/gnuradio/qtgui/form_menus.h 
b/gr-qtgui/include/gnuradio/qtgui/form_menus.h
index 1b26d28..d22577e 100644
--- a/gr-qtgui/include/gnuradio/qtgui/form_menus.h
+++ b/gr-qtgui/include/gnuradio/qtgui/form_menus.h
@@ -41,6 +41,8 @@ public:
   LineColorMenu(int which, QWidget *parent)
     : QMenu("Line Color", parent), d_which(which)
   {
+    d_grp = new QActionGroup(this);
+
     d_act.push_back(new QAction("Blue", this));
     d_act.push_back(new QAction("Red", this));
     d_act.push_back(new QAction("Green", this));
@@ -70,6 +72,8 @@ public:
     QListIterator<QAction*> i(d_act);
     while(i.hasNext()) {
       QAction *a = i.next();
+      a->setCheckable(true);
+      a->setActionGroup(d_grp);
       addAction(a);
     }
   }
@@ -108,6 +112,7 @@ public slots:
   void getDarkGray() { emit whichTrigger(d_which, "darkgray"); }
 
 private:
+  QActionGroup *d_grp;
   QList<QAction *> d_act;
   int d_which;
 };
@@ -124,6 +129,8 @@ public:
   LineWidthMenu(int which, QWidget *parent)
     : QMenu("Line Width", parent), d_which(which)
   {
+    d_grp = new QActionGroup(this);
+
     d_act.push_back(new QAction("1", this));
     d_act.push_back(new QAction("2", this));
     d_act.push_back(new QAction("3", this));
@@ -149,6 +156,8 @@ public:
     QListIterator<QAction*> i(d_act);
     while(i.hasNext()) {
       QAction *a = i.next();
+      a->setCheckable(true);
+      a->setActionGroup(d_grp);
       addAction(a);
     }
   }
@@ -185,6 +194,7 @@ public slots:
   void getTen()   { emit whichTrigger(d_which, 10); }
 
 private:
+  QActionGroup *d_grp;
   QList<QAction *> d_act;
   int d_which;
 };
@@ -201,6 +211,8 @@ public:
   LineStyleMenu(int which, QWidget *parent)
     : QMenu("Line Style", parent), d_which(which)
   {
+    d_grp = new QActionGroup(this);
+
     d_act.push_back(new QAction("None", this));
     d_act.push_back(new QAction("Solid", this));
     d_act.push_back(new QAction("Dash", this));
@@ -218,6 +230,8 @@ public:
     QListIterator<QAction*> i(d_act);
     while(i.hasNext()) {
       QAction *a = i.next();
+      a->setCheckable(true);
+      a->setActionGroup(d_grp);
       addAction(a);
     }
   }
@@ -250,6 +264,7 @@ public slots:
   void getDashDotDot() { emit whichTrigger(d_which, Qt::DashDotDotLine); }
 
 private:
+  QActionGroup *d_grp;
   QList<QAction *> d_act;
   int d_which;
 };
@@ -266,6 +281,8 @@ public:
   LineMarkerMenu(int which, QWidget *parent)
     : QMenu("Line Marker", parent), d_which(which)
   {
+    d_grp = new QActionGroup(this);
+
     d_act.push_back(new QAction("None", this));
     d_act.push_back(new QAction("Circle", this));
     d_act.push_back(new QAction("Rectangle", this));
@@ -301,6 +318,8 @@ public:
     QListIterator<QAction*> i(d_act);
     while(i.hasNext()) {
       QAction *a = i.next();
+      a->setCheckable(true);
+      a->setActionGroup(d_grp);
       addAction(a);
     }
   }
@@ -342,6 +361,7 @@ public slots:
   void getHexagon()   { emit whichTrigger(d_which, QwtSymbol::Hexagon); }
 
 private:
+  QActionGroup *d_grp;
   QList<QAction *> d_act;
   int d_which;
 };
@@ -358,6 +378,8 @@ public:
   MarkerAlphaMenu(int which, QWidget *parent)
     : QMenu("Line Transparency", parent), d_which(which)
   {
+    d_grp = new QActionGroup(this);
+
     d_act.push_back(new QAction("None", this));
     d_act.push_back(new QAction("Low", this));
     d_act.push_back(new QAction("Medium", this));
@@ -373,6 +395,8 @@ public:
     QListIterator<QAction*> i(d_act);
     while(i.hasNext()) {
       QAction *a = i.next();
+      a->setCheckable(true);
+      a->setActionGroup(d_grp);
       addAction(a);
     }
   }
@@ -404,6 +428,7 @@ public slots:
   void getOff()    { emit whichTrigger(d_which, 0); }
 
 private:
+  QActionGroup *d_grp;
   QList<QAction *> d_act;
   int d_which;
 };
@@ -607,6 +632,8 @@ public:
   FFTSizeMenu(QWidget *parent)
     : QMenu("FFT Size", parent)
   {
+    d_grp = new QActionGroup(this);
+
     d_act.push_back(new QAction("32", this));
     d_act.push_back(new QAction("64", this));
     d_act.push_back(new QAction("128", this));
@@ -646,6 +673,8 @@ public:
     QListIterator<QAction*> i(d_act);
     while(i.hasNext()) {
       QAction *a = i.next();
+      a->setCheckable(true);
+      a->setActionGroup(d_grp);
       addAction(a);
     }
   }
@@ -723,6 +752,8 @@ public:
   FFTAverageMenu(QWidget *parent)
     : QMenu("FFT Average", parent)
   {
+    d_grp = new QActionGroup(this);
+
     d_off = 1.0;
     d_high = 0.05;
     d_medium = 0.1;
@@ -754,6 +785,8 @@ public:
     QListIterator<QAction*> i(d_act);
     while(i.hasNext()) {
       QAction *a = i.next();
+      a->setCheckable(true);
+      a->setActionGroup(d_grp);
       addAction(a);
     }
   }
@@ -995,10 +1028,14 @@ public:
   ColorMapMenu(int which, QWidget *parent)
     : QMenu("Color Map", parent), d_which(which)
   {
+    d_grp = new QActionGroup(this);
+
     d_act.push_back(new QAction("Multi-Color", this));
     d_act.push_back(new QAction("White Hot", this));
     d_act.push_back(new QAction("Black Hot", this));
     d_act.push_back(new QAction("Incandescent", this));
+    d_act.push_back(new QAction("Sunset", this));
+    d_act.push_back(new QAction("Cool", this));
     d_act.push_back(new QAction("Other", this));
     //d_act.push_back(new OtherDualAction("Min Intensity: ", "Max Intensity: 
", this));
 
@@ -1006,11 +1043,15 @@ public:
     connect(d_act[1], SIGNAL(triggered()), this, SLOT(getWhiteHot()));
     connect(d_act[2], SIGNAL(triggered()), this, SLOT(getBlackHot()));
     connect(d_act[3], SIGNAL(triggered()), this, SLOT(getIncandescent()));
-    connect(d_act[4], SIGNAL(triggered()), this, SLOT(getOther()));
+    connect(d_act[4], SIGNAL(triggered()), this, SLOT(getSunset()));
+    connect(d_act[5], SIGNAL(triggered()), this, SLOT(getCool()));
+    connect(d_act[6], SIGNAL(triggered()), this, SLOT(getOther()));
 
      QListIterator<QAction*> i(d_act);
      while(i.hasNext()) {
        QAction *a = i.next();
+       a->setCheckable(true);
+       a->setActionGroup(d_grp);
        addAction(a);
      }
 
@@ -1044,6 +1085,8 @@ public:
   void getWhiteHot() { emit whichTrigger(d_which, 
INTENSITY_COLOR_MAP_TYPE_WHITE_HOT); }
   void getBlackHot() { emit whichTrigger(d_which, 
INTENSITY_COLOR_MAP_TYPE_BLACK_HOT); }
   void getIncandescent() { emit whichTrigger(d_which, 
INTENSITY_COLOR_MAP_TYPE_INCANDESCENT); }
+  void getSunset() { emit whichTrigger(d_which, 
INTENSITY_COLOR_MAP_TYPE_SUNSET); }
+  void getCool() { emit whichTrigger(d_which, INTENSITY_COLOR_MAP_TYPE_COOL); }
   //void getOther(d_which, const QString &min_str, const QString &max_str)
   void getOther()
   {
@@ -1058,6 +1101,7 @@ public:
   }
 
 private:
+  QActionGroup *d_grp;
   QList<QAction *> d_act;
   OtherDualAction *d_other;
   QColor d_max_value, d_min_value;
@@ -1360,6 +1404,8 @@ public:
   NumberColorMapMenu(int which, QWidget *parent)
     : QMenu("Color Map", parent), d_which(which)
   {
+    d_grp = new QActionGroup(this);
+
     d_act.push_back(new QAction("Black", this));
     d_act.push_back(new QAction("Blue-Red", this));
     d_act.push_back(new QAction("White Hot", this));
@@ -1377,6 +1423,8 @@ public:
      QListIterator<QAction*> i(d_act);
      while(i.hasNext()) {
        QAction *a = i.next();
+       a->setCheckable(true);
+       a->setActionGroup(d_grp);
        addAction(a);
      }
 
@@ -1423,6 +1471,7 @@ public:
   }
 
 private:
+  QActionGroup *d_grp;
   QList<QAction *> d_act;
   QColor d_max_value, d_min_value;
   int d_which;
diff --git a/gr-qtgui/include/gnuradio/qtgui/qtgui_types.h 
b/gr-qtgui/include/gnuradio/qtgui/qtgui_types.h
index cde5254..5640f68 100644
--- a/gr-qtgui/include/gnuradio/qtgui/qtgui_types.h
+++ b/gr-qtgui/include/gnuradio/qtgui/qtgui_types.h
@@ -154,7 +154,9 @@ enum{
   INTENSITY_COLOR_MAP_TYPE_WHITE_HOT = 1,
   INTENSITY_COLOR_MAP_TYPE_BLACK_HOT = 2,
   INTENSITY_COLOR_MAP_TYPE_INCANDESCENT = 3,
-  INTENSITY_COLOR_MAP_TYPE_USER_DEFINED = 4
+  INTENSITY_COLOR_MAP_TYPE_USER_DEFINED = 4,
+  INTENSITY_COLOR_MAP_TYPE_SUNSET = 5,
+  INTENSITY_COLOR_MAP_TYPE_COOL = 6,
 };
 
 class ColorMap_MultiColor: public QwtLinearColorMap
@@ -197,6 +199,36 @@ public:
   }
 };
 
+class ColorMap_Sunset: public QwtLinearColorMap
+{
+public:
+  ColorMap_Sunset():
+    QwtLinearColorMap(QColor(0, 0, 0, 0),
+                      QColor(193, 255, 255, 255))
+  {
+    addColorStop(0.167, QColor( 86,   0, 153,  45));
+    addColorStop(0.333, QColor(147,  51, 119,  91));
+    addColorStop(0.500, QColor(226,  51,  71, 140));
+    addColorStop(0.667, QColor(255, 109,   0, 183));
+    addColorStop(0.833, QColor(255, 183,   0, 221));
+  }
+};
+
+class ColorMap_Cool: public QwtLinearColorMap
+{
+public:
+  ColorMap_Cool():
+    QwtLinearColorMap(QColor(0, 0, 0, 0),
+                      QColor(255, 255, 255, 255))
+  {
+    addColorStop(0.167, QColor( 0,    0, 127, 25));
+    addColorStop(0.333, QColor( 0,   63, 153, 86));
+    addColorStop(0.500, QColor(76,  114, 178, 127));
+    addColorStop(0.667, QColor(153, 165, 204, 178));
+    addColorStop(0.833, QColor(204, 216, 229, 211));
+  }
+};
+
 class ColorMap_UserDefined: public QwtLinearColorMap
 {
 public:
diff --git a/gr-qtgui/lib/TimeRasterDisplayPlot.cc 
b/gr-qtgui/lib/TimeRasterDisplayPlot.cc
index afe326b..2d4ed41 100644
--- a/gr-qtgui/lib/TimeRasterDisplayPlot.cc
+++ b/gr-qtgui/lib/TimeRasterDisplayPlot.cc
@@ -239,7 +239,7 @@ TimeRasterDisplayPlot::TimeRasterDisplayPlot(int nplots,
                             Qt::RightButton, Qt::ControlModifier);
   d_zoomer->setMousePattern(QwtEventPattern::MouseSelect3,
                             Qt::RightButton);
-  
+
   const QColor c(Qt::red);
   d_zoomer->setRubberBandPen(c);
   d_zoomer->setTrackerPen(c);
@@ -301,7 +301,7 @@ TimeRasterDisplayPlot::reset()
     newSize.setWidth(d_cols);
     newSize.setBottom(0);
     newSize.setHeight(d_rows);
-    
+
     d_zoomer->zoom(newSize);
     d_zoomer->setZoomBase(newSize);
     d_zoomer->zoom(0);
@@ -504,6 +504,16 @@ TimeRasterDisplayPlot::setIntensityColorMapType(const int 
which,
       d_raster[which]->setColorMap(new ColorMap_Incandescent());
       break;
     }
+    case INTENSITY_COLOR_MAP_TYPE_SUNSET: {
+      d_color_map_type[which] = newType;
+      d_raster[which]->setColorMap(new ColorMap_Sunset());
+      break;
+    }
+    case INTENSITY_COLOR_MAP_TYPE_COOL: {
+      d_color_map_type[which] = newType;
+      d_raster[which]->setColorMap(new ColorMap_Cool());
+      break;
+    }
     case INTENSITY_COLOR_MAP_TYPE_USER_DEFINED: {
       d_low_intensity = lowColor;
       d_high_intensity = highColor;
@@ -555,6 +565,10 @@ TimeRasterDisplayPlot::_updateIntensityRangeDisplay()
       rightAxis->setColorMap(intv, new ColorMap_BlackHot()); break;
     case INTENSITY_COLOR_MAP_TYPE_INCANDESCENT:
       rightAxis->setColorMap(intv, new ColorMap_Incandescent()); break;
+    case INTENSITY_COLOR_MAP_TYPE_SUNSET:
+      rightAxis->setColorMap(intv, new ColorMap_Sunset()); break;
+    case INTENSITY_COLOR_MAP_TYPE_COOL:
+      rightAxis->setColorMap(intv, new ColorMap_Cool()); break;
     case INTENSITY_COLOR_MAP_TYPE_USER_DEFINED:
       rightAxis->setColorMap(intv, new ColorMap_UserDefined(d_low_intensity,
                                                            d_high_intensity));
diff --git a/gr-qtgui/lib/WaterfallDisplayPlot.cc 
b/gr-qtgui/lib/WaterfallDisplayPlot.cc
index 92fcb38..eb33cba 100644
--- a/gr-qtgui/lib/WaterfallDisplayPlot.cc
+++ b/gr-qtgui/lib/WaterfallDisplayPlot.cc
@@ -81,7 +81,7 @@ private:
 /***********************************************************************
  * Widget to provide mouse pointer coordinate text
  **********************************************************************/
-class WaterfallZoomer: public QwtPlotZoomer, public TimeScaleData, 
+class WaterfallZoomer: public QwtPlotZoomer, public TimeScaleData,
                       public FreqOffsetAndPrecisionClass
 {
 public:
@@ -168,7 +168,7 @@ WaterfallDisplayPlot::WaterfallDisplayPlot(int nplots, 
QWidget* parent)
 
     d_intensity_color_map_type.push_back(INTENSITY_COLOR_MAP_TYPE_MULTI_COLOR);
     setIntensityColorMapType(i, d_intensity_color_map_type[i],
-                            QColor("white"), QColor("white"));    
+                            QColor("white"), QColor("white"));
 
     setAlpha(i, 255/d_nplots);
   }
@@ -456,6 +456,26 @@ WaterfallDisplayPlot::setIntensityColorMapType(const int 
which,
 #endif
       break;
     }
+    case INTENSITY_COLOR_MAP_TYPE_SUNSET: {
+      d_intensity_color_map_type[which] = newType;
+#if QWT_VERSION < 0x060000
+      ColorMap_Sunset colorMap;
+      d_spectrogram[which]->setColorMap(colorMap);
+#else
+      d_spectrogram[which]->setColorMap(new ColorMap_Sunset());
+#endif
+      break;
+    }
+    case INTENSITY_COLOR_MAP_TYPE_COOL: {
+      d_intensity_color_map_type[which] = newType;
+#if QWT_VERSION < 0x060000
+      ColorMap_Cool colorMap;
+      d_spectrogram[which]->setColorMap(colorMap);
+#else
+      d_spectrogram[which]->setColorMap(new ColorMap_Cool());
+#endif
+      break;
+    }
     case INTENSITY_COLOR_MAP_TYPE_USER_DEFINED:{
       d_user_defined_low_intensity_color = lowColor;
       d_user_defined_high_intensity_color = highColor;
@@ -549,6 +569,10 @@ WaterfallDisplayPlot::_updateIntensityRangeDisplay()
       rightAxis->setColorMap(intv, new ColorMap_BlackHot()); break;
     case INTENSITY_COLOR_MAP_TYPE_INCANDESCENT:
       rightAxis->setColorMap(intv, new ColorMap_Incandescent()); break;
+    case INTENSITY_COLOR_MAP_TYPE_SUNSET:
+      rightAxis->setColorMap(intv, new ColorMap_Sunset()); break;
+    case INTENSITY_COLOR_MAP_TYPE_COOL:
+      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));
diff --git a/gr-qtgui/lib/spectrumdisplayform.ui 
b/gr-qtgui/lib/spectrumdisplayform.ui
index ceab55b..1176aec 100644
--- a/gr-qtgui/lib/spectrumdisplayform.ui
+++ b/gr-qtgui/lib/spectrumdisplayform.ui
@@ -448,6 +448,16 @@
          </item>
          <item>
           <property name="text">
+           <string>Sunset</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>Cool</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
            <string>User Defined</string>
           </property>
          </item>
diff --git a/gr-qtgui/swig/qtgui_swig.i b/gr-qtgui/swig/qtgui_swig.i
index af66d18..4859df1 100644
--- a/gr-qtgui/swig/qtgui_swig.i
+++ b/gr-qtgui/swig/qtgui_swig.i
@@ -46,7 +46,9 @@ enum{
   INTENSITY_COLOR_MAP_TYPE_WHITE_HOT = 1,
   INTENSITY_COLOR_MAP_TYPE_BLACK_HOT = 2,
   INTENSITY_COLOR_MAP_TYPE_INCANDESCENT = 3,
-  INTENSITY_COLOR_MAP_TYPE_USER_DEFINED = 4
+  INTENSITY_COLOR_MAP_TYPE_USER_DEFINED = 4,
+  INTENSITY_COLOR_MAP_TYPE_SUNSET = 5,
+  INTENSITY_COLOR_MAP_TYPE_COOL = 6,
 };
 
 %include "gnuradio/qtgui/trigger_mode.h"



reply via email to

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