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