GNU Radio Manual and C++ API Reference  3.9.1.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  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 
11 #ifndef WATERFALL_DISPLAY_PLOT_H
12 #define WATERFALL_DISPLAY_PLOT_H
13 
17 #include <qwt_plot_spectrogram.h>
18 #include <cstdint>
19 #include <cstdio>
20 #include <vector>
21 
22 #if QWT_VERSION < 0x060000
24 #else
25 #include <qwt_compat.h>
26 #endif
27 
28 /*!
29  * \brief QWidget for displaying waterfall (spectrogram) plots.
30  * \ingroup qtgui_blk
31  */
33 {
34  Q_OBJECT
35 
38  Q_PROPERTY(QColor low_intensity_color READ getUserDefinedLowIntensityColor WRITE
40  Q_PROPERTY(QColor high_intensity_color READ getUserDefinedHighIntensityColor WRITE
42  Q_PROPERTY(int color_map_title_font_size READ getColorMapTitleFontSize WRITE
44 
45 
46 public:
47  WaterfallDisplayPlot(int nplots, QWidget*);
48  ~WaterfallDisplayPlot() override;
49 
50  void resetAxis();
51 
52  void setFrequencyRange(const double,
53  const double,
54  const double units = 1000.0,
55  const std::string& strunits = "kHz");
56  double getStartFrequency() const;
57  double getStopFrequency() const;
58 
59  void plotNewData(const std::vector<double*> dataPoints,
60  const int64_t numDataPoints,
61  const double timePerFFT,
62  const gr::high_res_timer_type timestamp,
63  const int droppedFrames);
64 
65  // to be removed
66  void plotNewData(const double* dataPoints,
67  const int64_t numDataPoints,
68  const double timePerFFT,
69  const gr::high_res_timer_type timestamp,
70  const int droppedFrames);
71 
72  void setIntensityRange(const double minIntensity, const double maxIntensity);
73  double getMinIntensity(unsigned int which) const;
74  double getMaxIntensity(unsigned int which) const;
75 
76  void replot(void) override;
77  void clearData();
78 
79  int getIntensityColorMapType(unsigned int) const;
80  int getIntensityColorMapType1() const;
81  int getColorMapTitleFontSize() const;
82  const QColor getUserDefinedLowIntensityColor() const;
83  const QColor getUserDefinedHighIntensityColor() const;
84 
85  int getAlpha(unsigned int which);
86  void setAlpha(unsigned int which, int alpha);
87 
88  int getNumRows() const;
89 
90 public slots:
91  void
92  setIntensityColorMapType(const unsigned int, const int, const QColor, const QColor);
93  void setIntensityColorMapType1(int);
94  void setColorMapTitleFontSize(int tfs);
97  void setPlotPosHalf(bool half);
98  void disableLegend() override;
99  void enableLegend();
100  void enableLegend(bool en);
101  void setNumRows(int nrows);
102 
103 signals:
104  void updatedLowerIntensityLevel(const double);
105  void updatedUpperIntensityLevel(const double);
106 
107 private:
108  void _updateIntensityRangeDisplay();
109 
110  double d_start_frequency;
111  double d_stop_frequency;
112  double d_center_frequency;
113  int d_xaxis_multiplier;
114  bool d_half_freq;
115  bool d_legend_enabled;
116  int d_nrows;
117 
118  std::vector<WaterfallData*> d_data;
119 
120 #if QWT_VERSION < 0x060000
121  std::vector<PlotWaterfall*> d_spectrogram;
122 #else
123  std::vector<QwtPlotSpectrogram*> d_spectrogram;
124 #endif
125 
126  std::vector<int> d_intensity_color_map_type;
127  QColor d_user_defined_low_intensity_color;
128  QColor d_user_defined_high_intensity_color;
129  int d_color_bar_title_font_size;
130 };
131 
132 #endif /* WATERFALL_DISPLAY_PLOT_H */
high_res_timer.h
WaterfallDisplayPlot::enableLegend
void enableLegend()
WaterfallDisplayPlot::setUserDefinedLowIntensityColor
void setUserDefinedLowIntensityColor(QColor)
WaterfallDisplayPlot::low_intensity_color
QColor low_intensity_color
Definition: WaterfallDisplayPlot.h:39
WaterfallDisplayPlot::getStopFrequency
double getStopFrequency() const
WaterfallDisplayPlot::resetAxis
void resetAxis()
DisplayPlot.h
WaterfallDisplayPlot::setColorMapTitleFontSize
void setColorMapTitleFontSize(int tfs)
WaterfallDisplayPlot::getUserDefinedLowIntensityColor
const QColor getUserDefinedLowIntensityColor() const
WaterfallDisplayPlot::high_intensity_color
QColor high_intensity_color
Definition: WaterfallDisplayPlot.h:41
WaterfallDisplayPlot::WaterfallDisplayPlot
WaterfallDisplayPlot(int nplots, QWidget *)
WaterfallDisplayPlot::setIntensityColorMapType1
void setIntensityColorMapType1(int)
WaterfallDisplayPlot::plotNewData
void plotNewData(const std::vector< double * > dataPoints, const int64_t numDataPoints, const double timePerFFT, const gr::high_res_timer_type timestamp, const int droppedFrames)
WaterfallDisplayPlot::getIntensityColorMapType1
int getIntensityColorMapType1() const
DisplayPlot
QWidget base plot to build QTGUI plotting tools.
Definition: DisplayPlot.h:49
plot_waterfall.h
WaterfallDisplayPlot::setIntensityColorMapType
void setIntensityColorMapType(const unsigned int, const int, const QColor, const QColor)
WaterfallDisplayPlot::getMinIntensity
double getMinIntensity(unsigned int which) const
WaterfallDisplayPlot::color_map_title_font_size
int color_map_title_font_size
Definition: WaterfallDisplayPlot.h:43
WaterfallDisplayPlot::getMaxIntensity
double getMaxIntensity(unsigned int which) const
WaterfallDisplayPlot::~WaterfallDisplayPlot
~WaterfallDisplayPlot() override
gr::high_res_timer_type
signed long long high_res_timer_type
Typedef for the timer tick count.
Definition: high_res_timer.h:38
WaterfallDisplayPlot::getNumRows
int getNumRows() const
WaterfallDisplayPlot::setAlpha
void setAlpha(unsigned int which, int alpha)
WaterfallDisplayPlot::updatedLowerIntensityLevel
void updatedLowerIntensityLevel(const double)
WaterfallDisplayPlot
QWidget for displaying waterfall (spectrogram) plots.
Definition: WaterfallDisplayPlot.h:32
WaterfallDisplayPlot::setFrequencyRange
void setFrequencyRange(const double, const double, const double units=1000.0, const std::string &strunits="kHz")
WaterfallDisplayPlot::getIntensityColorMapType
int getIntensityColorMapType(unsigned int) const
WaterfallDisplayPlot::setUserDefinedHighIntensityColor
void setUserDefinedHighIntensityColor(QColor)
WaterfallDisplayPlot::intensity_color_map_type1
int intensity_color_map_type1
Definition: WaterfallDisplayPlot.h:37
WaterfallDisplayPlot::updatedUpperIntensityLevel
void updatedUpperIntensityLevel(const double)
WaterfallDisplayPlot::replot
void replot(void) override
WaterfallDisplayPlot::getColorMapTitleFontSize
int getColorMapTitleFontSize() const
WaterfallDisplayPlot::setPlotPosHalf
void setPlotPosHalf(bool half)
WaterfallDisplayPlot::disableLegend
void disableLegend() override
waterfallGlobalData.h
WaterfallDisplayPlot::getAlpha
int getAlpha(unsigned int which)
WaterfallDisplayPlot::getUserDefinedHighIntensityColor
const QColor getUserDefinedHighIntensityColor() const
WaterfallDisplayPlot::setNumRows
void setNumRows(int nrows)
WaterfallDisplayPlot::getStartFrequency
double getStartFrequency() const
WaterfallDisplayPlot::clearData
void clearData()
WaterfallDisplayPlot::setIntensityRange
void setIntensityRange(const double minIntensity, const double maxIntensity)