GNU Radio Manual and C++ API Reference 3.7.14.0
The Free & Open Software Radio Ecosystem
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 * 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 FREQUENCY_DISPLAY_PLOT_HPP
24#define FREQUENCY_DISPLAY_PLOT_HPP
25
27#include <stdint.h>
28#include <cstdio>
29#include <vector>
30
31/*!
32 * \brief QWidget for displaying frequency domain (PSD) plots.
33 * \ingroup qtgui_blk
34 */
36{
37 Q_OBJECT
38
39 Q_PROPERTY(QColor min_fft_color READ getMinFFTColor WRITE setMinFFTColor)
40 Q_PROPERTY(QColor max_fft_color READ getMaxFFTColor WRITE setMaxFFTColor)
41 Q_PROPERTY(bool min_fft_visible READ getMinFFTVisible WRITE setMinFFTVisible)
42 Q_PROPERTY(bool max_fft_visible READ getMaxFFTVisible WRITE setMaxFFTVisible)
53 Q_PROPERTY(
56 Q_PROPERTY(
59 Q_PROPERTY(QColor marker_CF_color READ getMarkerCFColor WRITE setMarkerCFColor)
60
61public:
62 FrequencyDisplayPlot(int nplots, QWidget*);
64
65 void setFrequencyRange(const double,
66 const double,
67 const double units = 1000.0,
68 const std::string& strunits = "kHz");
69 double getStartFrequency() const;
70 double getStopFrequency() const;
71
72 void plotNewData(const std::vector<double*> dataPoints,
73 const int64_t numDataPoints,
74 const double noiseFloorAmplitude,
75 const double peakFrequency,
76 const double peakAmplitude,
77 const double timeInterval);
78
79 // Old method to be removed
80 void plotNewData(const double* dataPoints,
81 const int64_t numDataPoints,
82 const double noiseFloorAmplitude,
83 const double peakFrequency,
84 const double peakAmplitude,
85 const double timeInterval);
86
87 void replot();
88
89 void setYaxis(double min, double max);
90 double getYMin() const;
91 double getYMax() const;
92
93 void setTraceColour(QColor);
94 void setBGColour(QColor c);
95 void showCFMarker(const bool);
96
97 const bool getMaxFFTVisible() const;
98 const bool getMinFFTVisible() const;
99 const QColor getMinFFTColor() const;
100 const QColor getMaxFFTColor() const;
101 const QColor getMarkerLowerIntensityColor() const;
103 const QColor getMarkerUpperIntensityColor() const;
105 const QColor getMarkerPeakAmplitudeColor() const;
108 const QColor getMarkerCFColor() const;
109
110public slots:
111 void setMaxFFTVisible(const bool);
112 void setMinFFTVisible(const bool);
113 void setMinFFTColor(QColor c);
114 void setMaxFFTColor(QColor c);
122 void setMarkerCFColor(QColor c);
123
124 void setLowerIntensityLevel(const double);
125 void setUpperIntensityLevel(const double);
126
127 void onPickerPointSelected(const QwtDoublePoint& p);
128 void onPickerPointSelected6(const QPointF& p);
129
130 void setAutoScale(bool state);
132
133 void setPlotPosHalf(bool half);
134
135 void setYLabel(const std::string& label, const std::string& unit);
136
139
140 void attachTriggerLine(bool en);
141 void setTriggerLine(double value);
142
143private:
144 void _resetXAxisPoints();
145 void _autoScale(double bottom, double top);
146
147 std::vector<double*> d_ydata;
148
149 QwtPlotCurve* d_min_fft_plot_curve;
150 QwtPlotCurve* d_max_fft_plot_curve;
151 QColor d_min_fft_color;
152 bool d_min_fft_visible;
153 QColor d_max_fft_color;
154 bool d_max_fft_visible;
155 QColor d_marker_lower_intensity_color;
156 bool d_marker_lower_intensity_visible;
157 QColor d_marker_upper_intensity_color;
158 bool d_marker_upper_intensity_visible;
159 QColor d_marker_peak_amplitude_color;
160 QColor d_marker_noise_floor_amplitude_color;
161 bool d_marker_noise_floor_amplitude_visible;
162 QColor d_marker_cf_color;
163
164 double d_start_frequency;
165 double d_stop_frequency;
166 double d_center_frequency;
167 double d_ymax;
168 double d_ymin;
169 bool d_half_freq;
170
171 QwtPlotMarker* d_lower_intensity_marker;
172 QwtPlotMarker* d_upper_intensity_marker;
173
174 QwtPlotMarker* d_marker_peak_amplitude;
175 QwtPlotMarker* d_marker_noise_floor_amplitude;
176 QwtPlotMarker* d_marker_cf;
177
178 double* d_xdata;
179 int d_xdata_multiplier;
180
181 double* d_min_fft_data;
182 double* d_max_fft_data;
183
184 double d_peak_frequency;
185 double d_peak_amplitude;
186
187 double d_noise_floor_amplitude;
188
189 bool d_autoscale_shot;
190
191 QwtPlotMarker* d_trigger_line;
192};
193
194#endif /* FREQUENCY_DISPLAY_PLOT_HPP */
QWidget base plot to build QTGUI plotting tools.
Definition: DisplayPlot.h:65
QWidget for displaying frequency domain (PSD) plots.
Definition: FrequencyDisplayPlot.h:36
double getYMax() const
void setMarkerLowerIntensityColor(QColor c)
void onPickerPointSelected6(const QPointF &p)
void showCFMarker(const bool)
QColor min_fft_color
Definition: FrequencyDisplayPlot.h:39
void setMarkerNoiseFloorAmplitudeVisible(bool visible)
void setMarkerCFColor(QColor c)
void setMinFFTColor(QColor c)
void setYLabel(const std::string &label, const std::string &unit)
QColor max_fft_color
Definition: FrequencyDisplayPlot.h:40
void setMarkerUpperIntensityColor(QColor c)
QColor marker_lower_intensity_color
Definition: FrequencyDisplayPlot.h:44
void setPlotPosHalf(bool half)
void setYaxis(double min, double max)
void setMarkerPeakAmplitudeColor(QColor c)
FrequencyDisplayPlot(int nplots, QWidget *)
void setMarkerNoiseFloorAmplitudeColor(QColor c)
void setMaxFFTVisible(const bool)
void setTriggerLine(double value)
const QColor getMaxFFTColor() const
QColor marker_CF_color
Definition: FrequencyDisplayPlot.h:59
double getStartFrequency() const
bool marker_lower_intensity_visible
Definition: FrequencyDisplayPlot.h:46
virtual ~FrequencyDisplayPlot()
const bool getMarkerLowerIntensityVisible() const
const QColor getMarkerLowerIntensityColor() const
void setAutoScale(bool state)
void plotNewData(const double *dataPoints, const int64_t numDataPoints, const double noiseFloorAmplitude, const double peakFrequency, const double peakAmplitude, const double timeInterval)
void attachTriggerLine(bool en)
const bool getMarkerUpperIntensityVisible() const
const QColor getMarkerCFColor() const
bool marker_noise_floor_amplitude_visible
Definition: FrequencyDisplayPlot.h:58
QColor marker_peak_amplitude_color
Definition: FrequencyDisplayPlot.h:52
const QColor getMinFFTColor() const
void setMaxFFTColor(QColor c)
void setFrequencyRange(const double, const double, const double units=1000.0, const std::string &strunits="kHz")
void setBGColour(QColor c)
void setLowerIntensityLevel(const double)
const QColor getMarkerNoiseFloorAmplitudeColor() const
void setUpperIntensityLevel(const double)
void setTraceColour(QColor)
double getYMin() const
void onPickerPointSelected(const QwtDoublePoint &p)
QColor marker_upper_intensity_color
Definition: FrequencyDisplayPlot.h:48
const QColor getMarkerUpperIntensityColor() const
void setMarkerLowerIntensityVisible(bool visible)
double getStopFrequency() const
const bool getMarkerNoiseFloorAmplitudeVisible() const
bool min_fft_visible
Definition: FrequencyDisplayPlot.h:41
void plotNewData(const std::vector< double * > dataPoints, const int64_t numDataPoints, const double noiseFloorAmplitude, const double peakFrequency, const double peakAmplitude, const double timeInterval)
void setMinFFTVisible(const bool)
const bool getMaxFFTVisible() const
const QColor getMarkerPeakAmplitudeColor() const
QColor marker_noise_floor_amplitude_color
Definition: FrequencyDisplayPlot.h:55
void setMarkerUpperIntensityVisible(bool visible)
bool max_fft_visible
Definition: FrequencyDisplayPlot.h:42
const bool getMinFFTVisible() const
bool marker_upper_intensity_visible
Definition: FrequencyDisplayPlot.h:50
float min(float a, float b)