GNU Radio Manual and C++ API Reference  3.7.4.1
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qtgui_types.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2012 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 
26 #include <qwt_color_map.h>
27 #include <qwt_scale_draw.h>
29 
31 {
32 public:
33  FreqOffsetAndPrecisionClass(const int freqPrecision)
34  {
35  _frequencyPrecision = freqPrecision;
36  _centerFrequency = 0;
37  }
38 
40  {
41  }
42 
43  virtual unsigned int getFrequencyPrecision() const
44  {
45  return _frequencyPrecision;
46  }
47 
48  virtual void setFrequencyPrecision(const unsigned int newPrecision)
49  {
50  _frequencyPrecision = newPrecision;
51  }
52 
53  virtual double getCenterFrequency() const
54  {
55  return _centerFrequency;
56  }
57 
58  virtual void setCenterFrequency(const double newFreq)
59  {
60  _centerFrequency = newFreq;
61  }
62 
63 protected:
64 
65 private:
66  unsigned int _frequencyPrecision;
67  double _centerFrequency;
68 };
69 
71 {
72 public:
74  {
75  _zeroTime = 0;
76  _secondsPerLine = 1.0;
77  }
78 
79  virtual ~TimeScaleData()
80  {
81  }
82 
84  {
85  return _zeroTime;
86  }
87 
88  virtual void setZeroTime(const gr::high_res_timer_type newTime)
89  {
90  _zeroTime = newTime - gr::high_res_timer_epoch();
91  }
92 
93  virtual void setSecondsPerLine(const double newTime)
94  {
95  _secondsPerLine = newTime;
96  }
97 
98  virtual double getSecondsPerLine() const
99  {
100  return _secondsPerLine;
101  }
102 
103 
104 protected:
105 
106 private:
107  gr::high_res_timer_type _zeroTime;
108  double _secondsPerLine;
109 
110 };
111 
112 /***********************************************************************
113  * Text scale widget to provide X (freq) axis text
114  **********************************************************************/
116 {
117 public:
118  FreqDisplayScaleDraw(const unsigned int precision)
119  : QwtScaleDraw(), FreqOffsetAndPrecisionClass(precision)
120  {
121  }
122 
123  virtual QwtText label(double value) const
124  {
125  return QString("%1").arg(value, 0, 'f', getFrequencyPrecision());
126  }
127 
128  virtual void initiateUpdate(void)
129  {
130  invalidateCache();
131  }
132 
133 protected:
134 
135 private:
136 
137 };
138 
139 namespace gr {
140  namespace qtgui {
141 
142  enum graph_t {
146  };
147 
148  } /* namespace qtgui */
149 } /* namespace gr */
150 
151 
152 enum{
160 };
161 
162 class ColorMap_MultiColor: public QwtLinearColorMap
163 {
164 public:
166  QwtLinearColorMap(Qt::darkCyan, Qt::white)
167  {
168  addColorStop(0.25, Qt::cyan);
169  addColorStop(0.5, Qt::yellow);
170  addColorStop(0.75, Qt::red);
171  }
172 };
173 
174 class ColorMap_WhiteHot: public QwtLinearColorMap
175 {
176 public:
178  QwtLinearColorMap(Qt::black, Qt::white)
179  {
180  }
181 };
182 
183 class ColorMap_BlackHot: public QwtLinearColorMap
184 {
185 public:
187  QwtLinearColorMap(Qt::white, Qt::black)
188  {
189  }
190 };
191 
192 class ColorMap_Incandescent: public QwtLinearColorMap
193 {
194 public:
196  QwtLinearColorMap(Qt::black, Qt::white)
197  {
198  addColorStop(0.5, Qt::darkRed);
199  }
200 };
201 
202 class ColorMap_Sunset: public QwtLinearColorMap
203 {
204 public:
206  QwtLinearColorMap(QColor(0, 0, 0, 0),
207  QColor(255, 255, 193, 255))
208  {
209  addColorStop(0.167, QColor( 86, 0, 153, 45));
210  addColorStop(0.333, QColor(147, 51, 119, 91));
211  addColorStop(0.500, QColor(226, 51, 71, 140));
212  addColorStop(0.667, QColor(255, 109, 0, 183));
213  addColorStop(0.833, QColor(255, 183, 0, 221));
214  }
215 };
216 
217 class ColorMap_Cool: public QwtLinearColorMap
218 {
219 public:
221  QwtLinearColorMap(QColor(0, 0, 0, 0),
222  QColor(255, 255, 255, 255))
223  {
224  addColorStop(0.167, QColor( 0, 0, 127, 25));
225  addColorStop(0.333, QColor( 0, 63, 153, 86));
226  addColorStop(0.500, QColor(76, 114, 178, 127));
227  addColorStop(0.667, QColor(153, 165, 204, 178));
228  addColorStop(0.833, QColor(204, 216, 229, 211));
229  }
230 };
231 
232 class ColorMap_UserDefined: public QwtLinearColorMap
233 {
234 public:
235  ColorMap_UserDefined(QColor low, QColor high):
236  QwtLinearColorMap(low, high)
237  {
238  }
239 };
240 
241 #endif //QTGUI_TYPES_H
Definition: qtgui_types.h:144
TimeScaleData()
Definition: qtgui_types.h:73
virtual gr::high_res_timer_type getZeroTime() const
Definition: qtgui_types.h:83
ColorMap_Incandescent()
Definition: qtgui_types.h:195
virtual double getCenterFrequency() const
Definition: qtgui_types.h:53
Definition: qtgui_types.h:158
high_res_timer_type high_res_timer_epoch(void)
Get the tick count at the epoch.
Definition: high_res_timer.h:150
Definition: qtgui_types.h:70
Definition: qtgui_types.h:115
ColorMap_MultiColor()
Definition: qtgui_types.h:165
Definition: qtgui_types.h:155
virtual void setCenterFrequency(const double newFreq)
Definition: qtgui_types.h:58
graph_t
Definition: qtgui_types.h:142
virtual ~TimeScaleData()
Definition: qtgui_types.h:79
Definition: qtgui_types.h:217
virtual ~FreqOffsetAndPrecisionClass()
Definition: qtgui_types.h:39
Definition: qtgui_types.h:157
Definition: qtgui_types.h:159
virtual unsigned int getFrequencyPrecision() const
Definition: qtgui_types.h:43
Definition: qtgui_types.h:30
Definition: qtgui_types.h:154
Definition: qtgui_types.h:156
Definition: qtgui_types.h:145
virtual void setZeroTime(const gr::high_res_timer_type newTime)
Definition: qtgui_types.h:88
Definition: qtgui_types.h:202
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:186
virtual void initiateUpdate(void)
Definition: qtgui_types.h:128
Definition: qtgui_types.h:162
ColorMap_Sunset()
Definition: qtgui_types.h:205
virtual QwtText label(double value) const
Definition: qtgui_types.h:123
ColorMap_WhiteHot()
Definition: qtgui_types.h:177
Definition: qtgui_types.h:174
virtual void setSecondsPerLine(const double newTime)
Definition: qtgui_types.h:93
FreqDisplayScaleDraw(const unsigned int precision)
Definition: qtgui_types.h:118
Definition: qtgui_types.h:153
virtual double getSecondsPerLine() const
Definition: qtgui_types.h:98
Definition: qtgui_types.h:232
Definition: qtgui_types.h:192
FreqOffsetAndPrecisionClass(const int freqPrecision)
Definition: qtgui_types.h:33
virtual void setFrequencyPrecision(const unsigned int newPrecision)
Definition: qtgui_types.h:48
ColorMap_Cool()
Definition: qtgui_types.h:220
Definition: qtgui_types.h:143
Definition: qtgui_types.h:183
ColorMap_UserDefined(QColor low, QColor high)
Definition: qtgui_types.h:235