GNU Radio Manual and C++ API Reference  3.10.9.1
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  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 
11 #ifndef QTGUI_TYPES_H
12 #define QTGUI_TYPES_H
13 
15 #include <qwt_color_map.h>
16 #include <qwt_scale_draw.h>
17 #include <qwt_text.h>
18 
19 namespace gr {
20 namespace qtgui {
21 
23  INT = 0,
32 };
33 
34 } /* namespace qtgui */
35 } /* namespace gr */
36 
38 {
39 public:
40  FreqOffsetAndPrecisionClass(const int freqPrecision)
41  {
42  _frequencyPrecision = freqPrecision;
43  _centerFrequency = 0;
44  }
45 
47 
48  virtual unsigned int getFrequencyPrecision() const { return _frequencyPrecision; }
49 
50  virtual void setFrequencyPrecision(const unsigned int newPrecision)
51  {
52  _frequencyPrecision = newPrecision;
53  }
54 
55  virtual double getCenterFrequency() const { return _centerFrequency; }
56 
57  virtual void setCenterFrequency(const double newFreq) { _centerFrequency = newFreq; }
58 
59 protected:
60 private:
61  unsigned int _frequencyPrecision;
62  double _centerFrequency;
63 };
64 
66 {
67 public:
69  {
70  _zeroTime = 0;
71  _secondsPerLine = 1.0;
72  }
73 
74  virtual ~TimeScaleData() {}
75 
76  virtual gr::high_res_timer_type getZeroTime() const { return _zeroTime; }
77 
78  virtual void setZeroTime(const gr::high_res_timer_type newTime)
79  {
80  _zeroTime = newTime - gr::high_res_timer_epoch();
81  }
82 
83  virtual void setSecondsPerLine(const double newTime) { _secondsPerLine = newTime; }
84 
85  virtual double getSecondsPerLine() const { return _secondsPerLine; }
86 
87 
88 protected:
89 private:
90  gr::high_res_timer_type _zeroTime;
91  double _secondsPerLine;
92 };
93 
94 /***********************************************************************
95  * Text scale widget to provide X (freq) axis text
96  **********************************************************************/
98 {
99 public:
100  FreqDisplayScaleDraw(const unsigned int precision)
101  : QwtScaleDraw(), FreqOffsetAndPrecisionClass(precision)
102  {
103  }
104 
105  QwtText label(double value) const override
106  {
107  return QString("%1").arg(value, 0, 'f', getFrequencyPrecision());
108  }
109 
110  virtual void initiateUpdate(void) { invalidateCache(); }
111 
112 protected:
113 private:
114 };
115 
116 namespace gr {
117 namespace qtgui {
118 
119 enum graph_t {
123 };
124 
133 };
134 
135 } /* namespace qtgui */
136 } /* namespace gr */
137 
138 
139 class ColorMap_MultiColor : public QwtLinearColorMap
140 {
141 public:
142  ColorMap_MultiColor() : QwtLinearColorMap(Qt::darkCyan, Qt::white)
143  {
144  addColorStop(0.25, Qt::cyan);
145  addColorStop(0.5, Qt::yellow);
146  addColorStop(0.75, Qt::red);
147  }
148 };
149 
150 class ColorMap_WhiteHot : public QwtLinearColorMap
151 {
152 public:
153  ColorMap_WhiteHot() : QwtLinearColorMap(Qt::black, Qt::white) {}
154 };
155 
156 class ColorMap_BlackHot : public QwtLinearColorMap
157 {
158 public:
159  ColorMap_BlackHot() : QwtLinearColorMap(Qt::white, Qt::black) {}
160 };
161 
162 class ColorMap_Incandescent : public QwtLinearColorMap
163 {
164 public:
165  ColorMap_Incandescent() : QwtLinearColorMap(Qt::black, Qt::white)
166  {
167  addColorStop(0.5, Qt::darkRed);
168  }
169 };
170 
171 class ColorMap_Sunset : public QwtLinearColorMap
172 {
173 public:
174  ColorMap_Sunset() : QwtLinearColorMap(QColor(0, 0, 0, 0), QColor(255, 255, 193, 255))
175  {
176  addColorStop(0.167, QColor(86, 0, 153, 45));
177  addColorStop(0.333, QColor(147, 51, 119, 91));
178  addColorStop(0.500, QColor(226, 51, 71, 140));
179  addColorStop(0.667, QColor(255, 109, 0, 183));
180  addColorStop(0.833, QColor(255, 183, 0, 221));
181  }
182 };
183 
184 class ColorMap_Cool : public QwtLinearColorMap
185 {
186 public:
187  ColorMap_Cool() : QwtLinearColorMap(QColor(0, 0, 0, 0), QColor(255, 255, 255, 255))
188  {
189  addColorStop(0.167, QColor(0, 0, 127, 25));
190  addColorStop(0.333, QColor(0, 63, 153, 86));
191  addColorStop(0.500, QColor(76, 114, 178, 127));
192  addColorStop(0.667, QColor(153, 165, 204, 178));
193  addColorStop(0.833, QColor(204, 216, 229, 211));
194  }
195 };
196 
197 class ColorMap_UserDefined : public QwtLinearColorMap
198 {
199 public:
200  ColorMap_UserDefined(QColor low, QColor high) : QwtLinearColorMap(low, high) {}
201 };
202 
203 #endif // QTGUI_TYPES_H
Definition: qtgui_types.h:157
ColorMap_BlackHot()
Definition: qtgui_types.h:159
Definition: qtgui_types.h:185
ColorMap_Cool()
Definition: qtgui_types.h:187
Definition: qtgui_types.h:163
ColorMap_Incandescent()
Definition: qtgui_types.h:165
Definition: qtgui_types.h:140
ColorMap_MultiColor()
Definition: qtgui_types.h:142
Definition: qtgui_types.h:172
ColorMap_Sunset()
Definition: qtgui_types.h:174
Definition: qtgui_types.h:198
ColorMap_UserDefined(QColor low, QColor high)
Definition: qtgui_types.h:200
Definition: qtgui_types.h:151
ColorMap_WhiteHot()
Definition: qtgui_types.h:153
Definition: qtgui_types.h:98
FreqDisplayScaleDraw(const unsigned int precision)
Definition: qtgui_types.h:100
virtual void initiateUpdate(void)
Definition: qtgui_types.h:110
QwtText label(double value) const override
Definition: qtgui_types.h:105
Definition: qtgui_types.h:38
virtual void setCenterFrequency(const double newFreq)
Definition: qtgui_types.h:57
virtual ~FreqOffsetAndPrecisionClass()
Definition: qtgui_types.h:46
virtual unsigned int getFrequencyPrecision() const
Definition: qtgui_types.h:48
FreqOffsetAndPrecisionClass(const int freqPrecision)
Definition: qtgui_types.h:40
virtual void setFrequencyPrecision(const unsigned int newPrecision)
Definition: qtgui_types.h:50
virtual double getCenterFrequency() const
Definition: qtgui_types.h:55
Definition: qtgui_types.h:66
TimeScaleData()
Definition: qtgui_types.h:68
virtual ~TimeScaleData()
Definition: qtgui_types.h:74
virtual double getSecondsPerLine() const
Definition: qtgui_types.h:85
virtual void setZeroTime(const gr::high_res_timer_type newTime)
Definition: qtgui_types.h:78
virtual void setSecondsPerLine(const double newTime)
Definition: qtgui_types.h:83
virtual gr::high_res_timer_type getZeroTime() const
Definition: qtgui_types.h:76
intensity_t
Definition: qtgui_types.h:125
@ INTENSITY_COLOR_MAP_TYPE_MULTI_COLOR
Definition: qtgui_types.h:126
@ INTENSITY_COLOR_MAP_TYPE_USER_DEFINED
Definition: qtgui_types.h:130
@ INTENSITY_COLOR_MAP_TYPE_WHITE_HOT
Definition: qtgui_types.h:127
@ INTENSITY_COLOR_MAP_TYPE_SUNSET
Definition: qtgui_types.h:131
@ INTENSITY_COLOR_MAP_TYPE_COOL
Definition: qtgui_types.h:132
@ INTENSITY_COLOR_MAP_TYPE_BLACK_HOT
Definition: qtgui_types.h:128
@ INTENSITY_COLOR_MAP_TYPE_INCANDESCENT
Definition: qtgui_types.h:129
data_type_t
Definition: qtgui_types.h:22
@ INT_VEC
Definition: qtgui_types.h:28
@ INT
Definition: qtgui_types.h:23
@ DOUBLE
Definition: qtgui_types.h:25
@ FLOAT_VEC
Definition: qtgui_types.h:29
@ STRING
Definition: qtgui_types.h:27
@ DOUBLE_VEC
Definition: qtgui_types.h:30
@ COMPLEX_VEC
Definition: qtgui_types.h:31
@ COMPLEX
Definition: qtgui_types.h:26
@ FLOAT
Definition: qtgui_types.h:24
graph_t
Definition: qtgui_types.h:119
@ NUM_GRAPH_VERT
Definition: qtgui_types.h:122
@ NUM_GRAPH_NONE
Definition: qtgui_types.h:120
@ NUM_GRAPH_HORIZ
Definition: qtgui_types.h:121
GNU Radio logging wrapper.
Definition: basic_block.h:29
high_res_timer_type high_res_timer_epoch(void)
Get the tick count at the epoch.
Definition: high_res_timer.h:144
signed long long high_res_timer_type
Typedef for the timer tick count.
Definition: high_res_timer.h:40