GNU Radio Manual and C++ API Reference  3.8.4.0
The Free & Open Software Radio Ecosystem
WaterfallDisplayPlot.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2008-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 WATERFALL_DISPLAY_PLOT_H
24 #define WATERFALL_DISPLAY_PLOT_H
25 
29 #include <qwt_plot_spectrogram.h>
30 #include <stdint.h>
31 #include <cstdio>
32 #include <vector>
33 
34 #if QWT_VERSION < 0x060000
36 #elif QWT_VERSION >= 0x060200
37 #include "qwt_interval.h"
38 
39 typedef QwtInterval QwtDoubleInterval;
40 #elif QWT_VERSION >= 0x060000
41 #include <qwt_compat.h>
42 #include <qwt_point_3d.h> // doesn't seem necessary, but is...
43 #endif
44 
45 /*!
46  * \brief QWidget for displaying waterfall (spectrogram) plots.
47  * \ingroup qtgui_blk
48  */
50 {
51  Q_OBJECT
52 
55  Q_PROPERTY(QColor low_intensity_color READ getUserDefinedLowIntensityColor WRITE
57  Q_PROPERTY(QColor high_intensity_color READ getUserDefinedHighIntensityColor WRITE
59  Q_PROPERTY(int color_map_title_font_size READ getColorMapTitleFontSize WRITE
61 
62 
63 public:
64  WaterfallDisplayPlot(int nplots, QWidget*);
65  virtual ~WaterfallDisplayPlot();
66 
67  void resetAxis();
68 
69  void setFrequencyRange(const double,
70  const double,
71  const double units = 1000.0,
72  const std::string& strunits = "kHz");
73  double getStartFrequency() const;
74  double getStopFrequency() const;
75 
76  void plotNewData(const std::vector<double*> dataPoints,
77  const int64_t numDataPoints,
78  const double timePerFFT,
79  const gr::high_res_timer_type timestamp,
80  const int droppedFrames);
81 
82  // to be removed
83  void plotNewData(const double* dataPoints,
84  const int64_t numDataPoints,
85  const double timePerFFT,
86  const gr::high_res_timer_type timestamp,
87  const int droppedFrames);
88 
89  void setIntensityRange(const double minIntensity, const double maxIntensity);
90  double getMinIntensity(unsigned int which) const;
91  double getMaxIntensity(unsigned int which) const;
92 
93  void replot(void);
94  void clearData();
95 
96  int getIntensityColorMapType(unsigned int) const;
97  int getIntensityColorMapType1() const;
98  int getColorMapTitleFontSize() const;
99  const QColor getUserDefinedLowIntensityColor() const;
100  const QColor getUserDefinedHighIntensityColor() const;
101 
102  int getAlpha(unsigned int which);
103  void setAlpha(unsigned int which, int alpha);
104 
105  int getNumRows() const;
106 
107 public slots:
108  void
109  setIntensityColorMapType(const unsigned int, const int, const QColor, const QColor);
110  void setIntensityColorMapType1(int);
111  void setColorMapTitleFontSize(int tfs);
112  void setUserDefinedLowIntensityColor(QColor);
114  void setPlotPosHalf(bool half);
115  void disableLegend();
116  void enableLegend();
117  void enableLegend(bool en);
118  void setNumRows(int nrows);
119 
120 signals:
121  void updatedLowerIntensityLevel(const double);
122  void updatedUpperIntensityLevel(const double);
123 
124 private:
125  void _updateIntensityRangeDisplay();
126 
127  double d_start_frequency;
128  double d_stop_frequency;
129  double d_center_frequency;
130  int d_xaxis_multiplier;
131  bool d_half_freq;
132  bool d_legend_enabled;
133  int d_nrows;
134 
135  std::vector<WaterfallData*> d_data;
136 
137 #if QWT_VERSION < 0x060000
138  std::vector<PlotWaterfall*> d_spectrogram;
139 #else
140  std::vector<QwtPlotSpectrogram*> d_spectrogram;
141 #endif
142 
143  std::vector<int> d_intensity_color_map_type;
144  QColor d_user_defined_low_intensity_color;
145  QColor d_user_defined_high_intensity_color;
146  int d_color_bar_title_font_size;
147 };
148 
149 #endif /* WATERFALL_DISPLAY_PLOT_H */
QWidget for displaying waterfall (spectrogram) plots.
Definition: WaterfallDisplayPlot.h:49
void setIntensityColorMapType1(int)
QColor low_intensity_color
Definition: WaterfallDisplayPlot.h:56
void setUserDefinedLowIntensityColor(QColor)
QWidget base plot to build QTGUI plotting tools.
Definition: DisplayPlot.h:66
double getStopFrequency() const
void setIntensityRange(const double minIntensity, const double maxIntensity)
int getColorMapTitleFontSize() const
const QColor getUserDefinedLowIntensityColor() const
int getIntensityColorMapType1() const
void plotNewData(const std::vector< double *> dataPoints, const int64_t numDataPoints, const double timePerFFT, const gr::high_res_timer_type timestamp, const int droppedFrames)
double getStartFrequency() const
void setColorMapTitleFontSize(int tfs)
virtual ~WaterfallDisplayPlot()
void updatedUpperIntensityLevel(const double)
double getMinIntensity(unsigned int which) const
double getMaxIntensity(unsigned int which) const
void setFrequencyRange(const double, const double, const double units=1000.0, const std::string &strunits="kHz")
int intensity_color_map_type1
Definition: WaterfallDisplayPlot.h:54
WaterfallDisplayPlot(int nplots, QWidget *)
signed long long high_res_timer_type
Typedef for the timer tick count.
Definition: high_res_timer.h:49
void setAlpha(unsigned int which, int alpha)
int getNumRows() const
void setIntensityColorMapType(const unsigned int, const int, const QColor, const QColor)
void setPlotPosHalf(bool half)
void updatedLowerIntensityLevel(const double)
int getIntensityColorMapType(unsigned int) const
void setUserDefinedHighIntensityColor(QColor)
int getAlpha(unsigned int which)
QColor high_intensity_color
Definition: WaterfallDisplayPlot.h:58
void setNumRows(int nrows)
int color_map_title_font_size
Definition: WaterfallDisplayPlot.h:60
const QColor getUserDefinedHighIntensityColor() const