GNU Radio Manual and C++ API Reference 3.7.14.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
30namespace gr {
31namespace qtgui {
32
34 INT = 0,
43};
44
45} /* namespace qtgui */
46} /* namespace gr */
47
49{
50public:
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
70protected:
71private:
72 unsigned int _frequencyPrecision;
73 double _centerFrequency;
74};
75
77{
78public:
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
99protected:
100private:
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{
110public:
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
123protected:
124private:
125};
126
127namespace gr {
128namespace qtgui {
129
134};
135
136} /* namespace qtgui */
137} /* namespace gr */
138
139
140enum {
148};
149
150class ColorMap_MultiColor : public QwtLinearColorMap
151{
152public:
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
161class ColorMap_WhiteHot : public QwtLinearColorMap
162{
163public:
164 ColorMap_WhiteHot() : QwtLinearColorMap(Qt::black, Qt::white) {}
165};
166
167class ColorMap_BlackHot : public QwtLinearColorMap
168{
169public:
170 ColorMap_BlackHot() : QwtLinearColorMap(Qt::white, Qt::black) {}
171};
172
173class ColorMap_Incandescent : public QwtLinearColorMap
174{
175public:
176 ColorMap_Incandescent() : QwtLinearColorMap(Qt::black, Qt::white)
177 {
178 addColorStop(0.5, Qt::darkRed);
179 }
180};
181
182class ColorMap_Sunset : public QwtLinearColorMap
183{
184public:
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
195class ColorMap_Cool : public QwtLinearColorMap
196{
197public:
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
208class ColorMap_UserDefined : public QwtLinearColorMap
209{
210public:
211 ColorMap_UserDefined(QColor low, QColor high) : QwtLinearColorMap(low, high) {}
212};
213
214#endif // QTGUI_TYPES_H
Definition: qtgui_types.h:168
ColorMap_BlackHot()
Definition: qtgui_types.h:170
Definition: qtgui_types.h:196
ColorMap_Cool()
Definition: qtgui_types.h:198
Definition: qtgui_types.h:174
ColorMap_Incandescent()
Definition: qtgui_types.h:176
Definition: qtgui_types.h:151
ColorMap_MultiColor()
Definition: qtgui_types.h:153
Definition: qtgui_types.h:183
ColorMap_Sunset()
Definition: qtgui_types.h:185
Definition: qtgui_types.h:209
ColorMap_UserDefined(QColor low, QColor high)
Definition: qtgui_types.h:211
Definition: qtgui_types.h:162
ColorMap_WhiteHot()
Definition: qtgui_types.h:164
Definition: qtgui_types.h:109
FreqDisplayScaleDraw(const unsigned int precision)
Definition: qtgui_types.h:111
virtual void initiateUpdate(void)
Definition: qtgui_types.h:121
virtual QwtText label(double value) const
Definition: qtgui_types.h:116
Definition: qtgui_types.h:49
virtual void setCenterFrequency(const double newFreq)
Definition: qtgui_types.h:68
virtual ~FreqOffsetAndPrecisionClass()
Definition: qtgui_types.h:57
virtual unsigned int getFrequencyPrecision() const
Definition: qtgui_types.h:59
FreqOffsetAndPrecisionClass(const int freqPrecision)
Definition: qtgui_types.h:51
virtual void setFrequencyPrecision(const unsigned int newPrecision)
Definition: qtgui_types.h:61
virtual double getCenterFrequency() const
Definition: qtgui_types.h:66
Definition: qtgui_types.h:77
TimeScaleData()
Definition: qtgui_types.h:79
virtual ~TimeScaleData()
Definition: qtgui_types.h:85
virtual double getSecondsPerLine() const
Definition: qtgui_types.h:96
virtual void setZeroTime(const gr::high_res_timer_type newTime)
Definition: qtgui_types.h:89
virtual void setSecondsPerLine(const double newTime)
Definition: qtgui_types.h:94
virtual gr::high_res_timer_type getZeroTime() const
Definition: qtgui_types.h:87
data_type_t
Definition: qtgui_types.h:33
@ INT_VEC
Definition: qtgui_types.h:39
@ INT
Definition: qtgui_types.h:34
@ DOUBLE
Definition: qtgui_types.h:36
@ FLOAT_VEC
Definition: qtgui_types.h:40
@ STRING
Definition: qtgui_types.h:38
@ DOUBLE_VEC
Definition: qtgui_types.h:41
@ COMPLEX_VEC
Definition: qtgui_types.h:42
@ COMPLEX
Definition: qtgui_types.h:37
@ FLOAT
Definition: qtgui_types.h:35
graph_t
Definition: qtgui_types.h:130
@ NUM_GRAPH_VERT
Definition: qtgui_types.h:133
@ NUM_GRAPH_NONE
Definition: qtgui_types.h:131
@ NUM_GRAPH_HORIZ
Definition: qtgui_types.h:132
Include this header to use the message passing features.
Definition: basic_block.h:45
high_res_timer_type high_res_timer_epoch(void)
Get the tick count at the epoch.
Definition: high_res_timer.h:159
signed long long high_res_timer_type
Typedef for the timer tick count.
Definition: high_res_timer.h:49
@ INTENSITY_COLOR_MAP_TYPE_BLACK_HOT
Definition: qtgui_types.h:143
@ INTENSITY_COLOR_MAP_TYPE_WHITE_HOT
Definition: qtgui_types.h:142
@ INTENSITY_COLOR_MAP_TYPE_USER_DEFINED
Definition: qtgui_types.h:145
@ INTENSITY_COLOR_MAP_TYPE_INCANDESCENT
Definition: qtgui_types.h:144
@ INTENSITY_COLOR_MAP_TYPE_COOL
Definition: qtgui_types.h:147
@ INTENSITY_COLOR_MAP_TYPE_SUNSET
Definition: qtgui_types.h:146
@ INTENSITY_COLOR_MAP_TYPE_MULTI_COLOR
Definition: qtgui_types.h:141