GNU Radio C++ API Reference: FrequencyDisplayPlot.h Source File

| GNU Radio C++ API Reference 3.10.12.0 The Free & Open Software Radio Ecosystem |

Loading...
Searching...
No Matches
FrequencyDisplayPlot.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2008-2011 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 FREQUENCY_DISPLAY_PLOT_HPP
12#define FREQUENCY_DISPLAY_PLOT_HPP
13
14#include <gnuradio/qtgui/DisplayPlot.h>
15#include <cstdint>
16#include <cstdio>
17#include <vector>
18
19/*!
20 * \brief QWidget for displaying frequency domain (PSD) plots.
21 * \ingroup qtgui_blk
22 */
23 class FrequencyDisplayPlot : public DisplayPlot
24{
25 Q_OBJECT
26
27 Q_PROPERTY(QColor min_fft_color READ getMinFFTColor WRITE setMinFFTColor)
28 Q_PROPERTY(QColor max_fft_color READ getMaxFFTColor WRITE setMaxFFTColor)
29 Q_PROPERTY(bool min_fft_visible READ getMinFFTVisible WRITE setMinFFTVisible)
30 Q_PROPERTY(bool max_fft_visible READ getMaxFFTVisible WRITE setMaxFFTVisible)
31 Q_PROPERTY(QColor marker_lower_intensity_color READ getMarkerLowerIntensityColor WRITE
32 setMarkerLowerIntensityColor)
33 Q_PROPERTY(bool marker_lower_intensity_visible READ getMarkerLowerIntensityVisible
34 WRITE setMarkerLowerIntensityVisible)
35 Q_PROPERTY(QColor marker_upper_intensity_color READ getMarkerUpperIntensityColor WRITE
36 setMarkerUpperIntensityColor)
37 Q_PROPERTY(bool marker_upper_intensity_visible READ getMarkerUpperIntensityVisible
38 WRITE setMarkerUpperIntensityVisible)
39 Q_PROPERTY(QColor marker_peak_amplitude_color READ getMarkerPeakAmplitudeColor WRITE
40 setMarkerPeakAmplitudeColor)
41 Q_PROPERTY(
42 QColor marker_noise_floor_amplitude_color READ getMarkerNoiseFloorAmplitudeColor
43 WRITE setMarkerNoiseFloorAmplitudeColor)
44 Q_PROPERTY(
45 bool marker_noise_floor_amplitude_visible READ getMarkerNoiseFloorAmplitudeVisible
46 WRITE setMarkerNoiseFloorAmplitudeVisible)
47 Q_PROPERTY(QColor marker_CF_color READ getMarkerCFColor WRITE setMarkerCFColor)
48
49public:
50 FrequencyDisplayPlot(int nplots, QWidget*);
51 ~FrequencyDisplayPlot() override;
52
53 void setFrequencyRange(const double,
54 const double,
55 const double units = 1000.0,
56 const std::string& strunits = "kHz");
57 double getStartFrequency() const;
58 double getStopFrequency() const;
59
60 void plotNewData(const std::vector<const double*> dataPoints,
61 const int64_t numDataPoints,
62 const double noiseFloorAmplitude,
63 const double peakFrequency,
64 const double peakAmplitude,
65 const double timeInterval);
66
67 // Old method to be removed
68 void plotNewData(const double* dataPoints,
69 const int64_t numDataPoints,
70 const double noiseFloorAmplitude,
71 const double peakFrequency,
72 const double peakAmplitude,
73 const double timeInterval);
74
75 void replot() override;
76
77 void setYaxis(double min, double max) override;
78 double getYMin() const;
79 double getYMax() const;
80
81 void setTraceColour(QColor);
82 void setBGColour(QColor c);
83 void showCFMarker(const bool);
84
85 bool getMaxFFTVisible() const;
86 bool getMinFFTVisible() const;
87 const QColor getMinFFTColor() const;
88 const QColor getMaxFFTColor() const;
89 const QColor getMarkerLowerIntensityColor() const;
90 bool getMarkerLowerIntensityVisible() const;
91 const QColor getMarkerUpperIntensityColor() const;
92 bool getMarkerUpperIntensityVisible() const;
93 const QColor getMarkerPeakAmplitudeColor() const;
94 bool getMarkerNoiseFloorAmplitudeVisible() const;
95 const QColor getMarkerNoiseFloorAmplitudeColor() const;
96 const QColor getMarkerCFColor() const;
97
98public slots:
99 void setMaxFFTVisible(const bool);
100 void setMinFFTVisible(const bool);
101 void setMinFFTColor(QColor c);
102 void setMaxFFTColor(QColor c);
103 void setMarkerLowerIntensityColor(QColor c);
104 void setMarkerLowerIntensityVisible(bool visible);
105 void setMarkerUpperIntensityColor(QColor c);
106 void setMarkerUpperIntensityVisible(bool visible);
107 void setMarkerPeakAmplitudeColor(QColor c);
108 void setMarkerNoiseFloorAmplitudeVisible(bool visible);
109 void setMarkerNoiseFloorAmplitudeColor(QColor c);
110 void setMarkerCFColor(QColor c);
111
112 void setLowerIntensityLevel(const double);
113 void setUpperIntensityLevel(const double);
114
115 void onPickerPointSelected(const QPointF& p);
116
117 void setAutoScale(bool state);
118 void setAutoScaleShot();
119
120 void setPlotPosHalf(bool half);
121
122 void setYLabel(const std::string& label, const std::string& unit);
123
124 void clearMaxData();
125 void clearMinData();
126
127 void attachTriggerLine(bool en);
128 void setTriggerLine(double value);
129
130private:
131 void _resetXAxisPoints();
132 void _autoScale(double bottom, double top);
133
134 std::vector<std::vector<double>> d_ydata;
135
136 QwtPlotCurve* d_min_fft_plot_curve;
137 QwtPlotCurve* d_max_fft_plot_curve;
138 QColor d_min_fft_color;
139 bool d_min_fft_visible;
140 QColor d_max_fft_color;
141 bool d_max_fft_visible;
142 QColor d_marker_lower_intensity_color;
143 bool d_marker_lower_intensity_visible;
144 QColor d_marker_upper_intensity_color;
145 bool d_marker_upper_intensity_visible;
146 QColor d_marker_peak_amplitude_color;
147 QColor d_marker_noise_floor_amplitude_color;
148 bool d_marker_noise_floor_amplitude_visible;
149 QColor d_marker_cf_color;
150
151 double d_start_frequency = -1;
152 double d_stop_frequency = 1;
153 double d_center_frequency;
154 double d_ymax = 10;
155 double d_ymin = -120;
156 bool d_half_freq = false;
157
158 QwtPlotMarker* d_lower_intensity_marker;
159 QwtPlotMarker* d_upper_intensity_marker;
160
161 QwtPlotMarker* d_marker_peak_amplitude;
162 QwtPlotMarker* d_marker_noise_floor_amplitude;
163 QwtPlotMarker* d_marker_cf;
164
165 std::vector<double> d_xdata;
166 int d_xdata_multiplier;
167
168 std::vector<double> d_min_fft_data;
169 std::vector<double> d_max_fft_data;
170
171 double d_peak_frequency;
172 double d_peak_amplitude;
173
174 double d_noise_floor_amplitude;
175
176 bool d_autoscale_shot = false;
177
178 QwtPlotMarker* d_trigger_line;
179};
180
181#endif /* FREQUENCY_DISPLAY_PLOT_HPP */
DisplayPlot.h
DisplayPlot::DisplayPlot
DisplayPlot(int nplots, QWidget *)
FrequencyDisplayPlot::getYMax
double getYMax() const
FrequencyDisplayPlot::setMarkerLowerIntensityColor
void setMarkerLowerIntensityColor(QColor c)
FrequencyDisplayPlot::showCFMarker
void showCFMarker(const bool)
FrequencyDisplayPlot::min_fft_color
QColor min_fft_color
Definition FrequencyDisplayPlot.h:27
FrequencyDisplayPlot::getMinFFTVisible
bool getMinFFTVisible() const
FrequencyDisplayPlot::setMarkerNoiseFloorAmplitudeVisible
void setMarkerNoiseFloorAmplitudeVisible(bool visible)
FrequencyDisplayPlot::setAutoScaleShot
void setAutoScaleShot()
FrequencyDisplayPlot::setMarkerCFColor
void setMarkerCFColor(QColor c)
FrequencyDisplayPlot::setMinFFTColor
void setMinFFTColor(QColor c)
FrequencyDisplayPlot::setYLabel
void setYLabel(const std::string &label, const std::string &unit)
FrequencyDisplayPlot::max_fft_color
QColor max_fft_color
Definition FrequencyDisplayPlot.h:28
FrequencyDisplayPlot::setMarkerUpperIntensityColor
void setMarkerUpperIntensityColor(QColor c)
FrequencyDisplayPlot::marker_lower_intensity_color
QColor marker_lower_intensity_color
Definition FrequencyDisplayPlot.h:31
FrequencyDisplayPlot::setPlotPosHalf
void setPlotPosHalf(bool half)
FrequencyDisplayPlot::getMarkerLowerIntensityVisible
bool getMarkerLowerIntensityVisible() const
FrequencyDisplayPlot::setMarkerPeakAmplitudeColor
void setMarkerPeakAmplitudeColor(QColor c)
FrequencyDisplayPlot::FrequencyDisplayPlot
FrequencyDisplayPlot(int nplots, QWidget *)
FrequencyDisplayPlot::setMarkerNoiseFloorAmplitudeColor
void setMarkerNoiseFloorAmplitudeColor(QColor c)
FrequencyDisplayPlot::setMaxFFTVisible
void setMaxFFTVisible(const bool)
FrequencyDisplayPlot::setTriggerLine
void setTriggerLine(double value)
FrequencyDisplayPlot::getMaxFFTColor
const QColor getMaxFFTColor() const
FrequencyDisplayPlot::marker_CF_color
QColor marker_CF_color
Definition FrequencyDisplayPlot.h:38
FrequencyDisplayPlot::getStartFrequency
double getStartFrequency() const
FrequencyDisplayPlot::plotNewData
void plotNewData(const std::vector< const double * > dataPoints, const int64_t numDataPoints, const double noiseFloorAmplitude, const double peakFrequency, const double peakAmplitude, const double timeInterval)
FrequencyDisplayPlot::marker_lower_intensity_visible
bool marker_lower_intensity_visible
Definition FrequencyDisplayPlot.h:32
FrequencyDisplayPlot::getMarkerLowerIntensityColor
const QColor getMarkerLowerIntensityColor() const
FrequencyDisplayPlot::setAutoScale
void setAutoScale(bool state)
FrequencyDisplayPlot::getMaxFFTVisible
bool getMaxFFTVisible() const
FrequencyDisplayPlot::attachTriggerLine
void attachTriggerLine(bool en)
FrequencyDisplayPlot::getMarkerCFColor
const QColor getMarkerCFColor() const
FrequencyDisplayPlot::marker_noise_floor_amplitude_visible
bool marker_noise_floor_amplitude_visible
Definition FrequencyDisplayPlot.h:37
FrequencyDisplayPlot::marker_peak_amplitude_color
QColor marker_peak_amplitude_color
Definition FrequencyDisplayPlot.h:35
FrequencyDisplayPlot::getMarkerNoiseFloorAmplitudeVisible
bool getMarkerNoiseFloorAmplitudeVisible() const
FrequencyDisplayPlot::getMinFFTColor
const QColor getMinFFTColor() const
FrequencyDisplayPlot::setMaxFFTColor
void setMaxFFTColor(QColor c)
FrequencyDisplayPlot::setFrequencyRange
void setFrequencyRange(const double, const double, const double units=1000.0, const std::string &strunits="kHz")
FrequencyDisplayPlot::setBGColour
void setBGColour(QColor c)
FrequencyDisplayPlot::setLowerIntensityLevel
void setLowerIntensityLevel(const double)
FrequencyDisplayPlot::getMarkerNoiseFloorAmplitudeColor
const QColor getMarkerNoiseFloorAmplitudeColor() const
FrequencyDisplayPlot::setUpperIntensityLevel
void setUpperIntensityLevel(const double)
FrequencyDisplayPlot::setTraceColour
void setTraceColour(QColor)
FrequencyDisplayPlot::getYMin
double getYMin() const
FrequencyDisplayPlot::setYaxis
void setYaxis(double min, double max) override
FrequencyDisplayPlot::replot
void replot() override
FrequencyDisplayPlot::marker_upper_intensity_color
QColor marker_upper_intensity_color
Definition FrequencyDisplayPlot.h:33
FrequencyDisplayPlot::clearMinData
void clearMinData()
FrequencyDisplayPlot::getMarkerUpperIntensityColor
const QColor getMarkerUpperIntensityColor() const
FrequencyDisplayPlot::setMarkerLowerIntensityVisible
void setMarkerLowerIntensityVisible(bool visible)
FrequencyDisplayPlot::getStopFrequency
double getStopFrequency() const
FrequencyDisplayPlot::min_fft_visible
bool min_fft_visible
Definition FrequencyDisplayPlot.h:29
FrequencyDisplayPlot::setMinFFTVisible
void setMinFFTVisible(const bool)
FrequencyDisplayPlot::getMarkerPeakAmplitudeColor
const QColor getMarkerPeakAmplitudeColor() const
FrequencyDisplayPlot::marker_noise_floor_amplitude_color
QColor marker_noise_floor_amplitude_color
Definition FrequencyDisplayPlot.h:36
FrequencyDisplayPlot::setMarkerUpperIntensityVisible
void setMarkerUpperIntensityVisible(bool visible)
FrequencyDisplayPlot::getMarkerUpperIntensityVisible
bool getMarkerUpperIntensityVisible() const
FrequencyDisplayPlot::max_fft_visible
bool max_fft_visible
Definition FrequencyDisplayPlot.h:30
FrequencyDisplayPlot::clearMaxData
void clearMaxData()
FrequencyDisplayPlot::onPickerPointSelected
void onPickerPointSelected(const QPointF &p)
FrequencyDisplayPlot::marker_upper_intensity_visible
bool marker_upper_intensity_visible
Definition FrequencyDisplayPlot.h:34
std
STL namespace.