GNU Radio Manual and C++ API Reference  3.8.1.0
The Free & Open Software Radio Ecosystem
qtgui_types.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2012,2016 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef QTGUI_TYPES_H
24 #define QTGUI_TYPES_H
25 
27 #include <qwt_color_map.h>
28 #include <qwt_scale_draw.h>
29 
30 namespace gr {
31 namespace qtgui {
32 
34  INT = 0,
43 };
44 
45 } /* namespace qtgui */
46 } /* namespace gr */
47 
49 {
50 public:
51  FreqOffsetAndPrecisionClass(const int freqPrecision)
52  {
53  _frequencyPrecision = freqPrecision;
54  _centerFrequency = 0;
55  }
56 
58 
59  virtual unsigned int getFrequencyPrecision() const { return _frequencyPrecision; }
60 
61  virtual void setFrequencyPrecision(const unsigned int newPrecision)
62  {
63  _frequencyPrecision = newPrecision;
64  }
65 
66  virtual double getCenterFrequency() const { return _centerFrequency; }
67 
68  virtual void setCenterFrequency(const double newFreq) { _centerFrequency = newFreq; }
69 
70 protected:
71 private:
72  unsigned int _frequencyPrecision;
73  double _centerFrequency;
74 };
75 
77 {
78 public:
80  {
81  _zeroTime = 0;
82  _secondsPerLine = 1.0;
83  }
84 
85  virtual ~TimeScaleData() {}
86 
87  virtual gr::high_res_timer_type getZeroTime() const { return _zeroTime; }
88 
89  virtual void setZeroTime(const gr::high_res_timer_type newTime)
90  {
91  _zeroTime = newTime - gr::high_res_timer_epoch();
92  }
93 
94  virtual void setSecondsPerLine(const double newTime) { _secondsPerLine = newTime; }
95 
96  virtual double getSecondsPerLine() const { return _secondsPerLine; }
97 
98 
99 protected:
100 private:
101  gr::high_res_timer_type _zeroTime;
102  double _secondsPerLine;
103 };
104 
105 /***********************************************************************
106  * Text scale widget to provide X (freq) axis text
107  **********************************************************************/
109 {
110 public:
111  FreqDisplayScaleDraw(const unsigned int precision)
112  : QwtScaleDraw(), FreqOffsetAndPrecisionClass(precision)
113  {
114  }
115 
116  virtual QwtText label(double value) const
117  {
118  return QString("%1").arg(value, 0, 'f', getFrequencyPrecision());
119  }
120 
121  virtual void initiateUpdate(void) { invalidateCache(); }
122 
123 protected:
124 private:
125 };
126 
127 namespace gr {
128 namespace qtgui {
129 
130 enum graph_t {
134 };
135 
136 } /* namespace qtgui */
137 } /* namespace gr */
138 
139 
140 enum {
148 };
149 
150 class ColorMap_MultiColor : public QwtLinearColorMap
151 {
152 public:
153  ColorMap_MultiColor() : QwtLinearColorMap(Qt::darkCyan, Qt::white)
154  {
155  addColorStop(0.25, Qt::cyan);
156  addColorStop(0.5, Qt::yellow);
157  addColorStop(0.75, Qt::red);
158  }
159 };
160 
161 class ColorMap_WhiteHot : public QwtLinearColorMap
162 {
163 public:
164  ColorMap_WhiteHot() : QwtLinearColorMap(Qt::black, Qt::white) {}
165 };
166 
167 class ColorMap_BlackHot : public QwtLinearColorMap
168 {
169 public:
170  ColorMap_BlackHot() : QwtLinearColorMap(Qt::white, Qt::black) {}
171 };
172 
173 class ColorMap_Incandescent : public QwtLinearColorMap
174 {
175 public:
176  ColorMap_Incandescent() : QwtLinearColorMap(Qt::black, Qt::white)
177  {
178  addColorStop(0.5, Qt::darkRed);
179  }
180 };
181 
182 class ColorMap_Sunset : public QwtLinearColorMap
183 {
184 public:
185  ColorMap_Sunset() : QwtLinearColorMap(QColor(0, 0, 0, 0), QColor(255, 255, 193, 255))
186  {
187  addColorStop(0.167, QColor(86, 0, 153, 45));
188  addColorStop(0.333, QColor(147, 51, 119, 91));
189  addColorStop(0.500, QColor(226, 51, 71, 140));
190  addColorStop(0.667, QColor(255, 109, 0, 183));
191  addColorStop(0.833, QColor(255, 183, 0, 221));
192  }
193 };
194 
195 class ColorMap_Cool : public QwtLinearColorMap
196 {
197 public:
198  ColorMap_Cool() : QwtLinearColorMap(QColor(0, 0, 0, 0), QColor(255, 255, 255, 255))
199  {
200  addColorStop(0.167, QColor(0, 0, 127, 25));
201  addColorStop(0.333, QColor(0, 63, 153, 86));
202  addColorStop(0.500, QColor(76, 114, 178, 127));
203  addColorStop(0.667, QColor(153, 165, 204, 178));
204  addColorStop(0.833, QColor(204, 216, 229, 211));
205  }
206 };
207 
208 class ColorMap_UserDefined : public QwtLinearColorMap
209 {
210 public:
211  ColorMap_UserDefined(QColor low, QColor high) : QwtLinearColorMap(low, high) {}
212 };
213 
214 #endif // QTGUI_TYPES_H
data_type_t
Definition: qtgui_types.h:33
Definition: qtgui_types.h:132
TimeScaleData()
Definition: qtgui_types.h:79
ColorMap_Incandescent()
Definition: qtgui_types.h:176
virtual QwtText label(double value) const
Definition: qtgui_types.h:116
Definition: qtgui_types.h:146
virtual gr::high_res_timer_type getZeroTime() const
Definition: qtgui_types.h:87
high_res_timer_type high_res_timer_epoch(void)
Get the tick count at the epoch.
Definition: high_res_timer.h:159
virtual unsigned int getFrequencyPrecision() const
Definition: qtgui_types.h:59
Definition: qtgui_types.h:76
Definition: qtgui_types.h:108
ColorMap_MultiColor()
Definition: qtgui_types.h:153
Definition: qtgui_types.h:41
Definition: qtgui_types.h:40
Definition: qtgui_types.h:143
virtual void setCenterFrequency(const double newFreq)
Definition: qtgui_types.h:68
Definition: qtgui_types.h:42
graph_t
Definition: qtgui_types.h:130
Definition: qtgui_types.h:38
virtual ~TimeScaleData()
Definition: qtgui_types.h:85
Definition: qtgui_types.h:195
virtual double getSecondsPerLine() const
Definition: qtgui_types.h:96
virtual ~FreqOffsetAndPrecisionClass()
Definition: qtgui_types.h:57
Definition: qtgui_types.h:145
Definition: qtgui_types.h:147
Definition: qtgui_types.h:39
Definition: qtgui_types.h:34
Definition: qtgui_types.h:48
Definition: qtgui_types.h:36
Definition: qtgui_types.h:37
Definition: qtgui_types.h:142
Definition: qtgui_types.h:144
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition: basic_block.h:43
Definition: qtgui_types.h:133
virtual void setZeroTime(const gr::high_res_timer_type newTime)
Definition: qtgui_types.h:89
Definition: qtgui_types.h:182
signed long long high_res_timer_type
Typedef for the timer tick count.
Definition: high_res_timer.h:49
ColorMap_BlackHot()
Definition: qtgui_types.h:170
Definition: qtgui_types.h:35
virtual void initiateUpdate(void)
Definition: qtgui_types.h:121
Definition: qtgui_types.h:150
ColorMap_Sunset()
Definition: qtgui_types.h:185
virtual double getCenterFrequency() const
Definition: qtgui_types.h:66
ColorMap_WhiteHot()
Definition: qtgui_types.h:164
Definition: qtgui_types.h:161
virtual void setSecondsPerLine(const double newTime)
Definition: qtgui_types.h:94
FreqDisplayScaleDraw(const unsigned int precision)
Definition: qtgui_types.h:111
Definition: qtgui_types.h:141
Definition: qtgui_types.h:208
Definition: qtgui_types.h:173
FreqOffsetAndPrecisionClass(const int freqPrecision)
Definition: qtgui_types.h:51
virtual void setFrequencyPrecision(const unsigned int newPrecision)
Definition: qtgui_types.h:61
ColorMap_Cool()
Definition: qtgui_types.h:198
Definition: qtgui_types.h:131
Definition: qtgui_types.h:167
ColorMap_UserDefined(QColor low, QColor high)
Definition: qtgui_types.h:211