GNU Radio Manual and C++ API Reference  3.8.1.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)
51  Q_PROPERTY(QColor marker_peak_amplitude_color READ getMarkerPeakAmplitudeColor WRITE
53  Q_PROPERTY(
56  Q_PROPERTY(
59  Q_PROPERTY(QColor marker_CF_color READ getMarkerCFColor WRITE setMarkerCFColor)
60 
61 public:
62  FrequencyDisplayPlot(int nplots, QWidget*);
63  virtual ~FrequencyDisplayPlot();
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;
102  const bool getMarkerLowerIntensityVisible() const;
103  const QColor getMarkerUpperIntensityColor() const;
104  const bool getMarkerUpperIntensityVisible() const;
105  const QColor getMarkerPeakAmplitudeColor() const;
106  const bool getMarkerNoiseFloorAmplitudeVisible() const;
107  const QColor getMarkerNoiseFloorAmplitudeColor() const;
108  const QColor getMarkerCFColor() const;
109 
110 public slots:
111  void setMaxFFTVisible(const bool);
112  void setMinFFTVisible(const bool);
113  void setMinFFTColor(QColor c);
114  void setMaxFFTColor(QColor c);
115  void setMarkerLowerIntensityColor(QColor c);
116  void setMarkerLowerIntensityVisible(bool visible);
117  void setMarkerUpperIntensityColor(QColor c);
118  void setMarkerUpperIntensityVisible(bool visible);
119  void setMarkerPeakAmplitudeColor(QColor c);
120  void setMarkerNoiseFloorAmplitudeVisible(bool visible);
121  void setMarkerNoiseFloorAmplitudeColor(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);
131  void setAutoScaleShot();
132 
133  void setPlotPosHalf(bool half);
134 
135  void setYLabel(const std::string& label, const std::string& unit);
136 
137  void clearMaxData();
138  void clearMinData();
139 
140  void attachTriggerLine(bool en);
141  void setTriggerLine(double value);
142 
143 private:
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 */
void setAutoScale(bool state)
void setMarkerLowerIntensityVisible(bool visible)
double getYMax() const
bool min_fft_visible
Definition: FrequencyDisplayPlot.h:41
const QColor getMinFFTColor() const
void onPickerPointSelected6(const QPointF &p)
void setFrequencyRange(const double, const double, const double units=1000.0, const std::string &strunits="kHz")
void setMarkerCFColor(QColor c)
const bool getMaxFFTVisible() const
QWidget base plot to build QTGUI plotting tools.
Definition: DisplayPlot.h:61
float min(float a, float b)
double getStopFrequency() const
void plotNewData(const std::vector< double *> dataPoints, const int64_t numDataPoints, const double noiseFloorAmplitude, const double peakFrequency, const double peakAmplitude, const double timeInterval)
void setUpperIntensityLevel(const double)
void setTriggerLine(double value)
STL namespace.
void setMaxFFTColor(QColor c)
void attachTriggerLine(bool en)
double getStartFrequency() const
const QColor getMarkerLowerIntensityColor() const
double getYMin() const
void setMarkerPeakAmplitudeColor(QColor c)
void setPlotPosHalf(bool half)
QColor min_fft_color
Definition: FrequencyDisplayPlot.h:39
bool marker_lower_intensity_visible
Definition: FrequencyDisplayPlot.h:46
QColor marker_CF_color
Definition: FrequencyDisplayPlot.h:59
QColor marker_noise_floor_amplitude_color
Definition: FrequencyDisplayPlot.h:55
void showCFMarker(const bool)
void setLowerIntensityLevel(const double)
const QColor getMarkerNoiseFloorAmplitudeColor() const
const QColor getMarkerUpperIntensityColor() const
void onPickerPointSelected(const QwtDoublePoint &p)
bool max_fft_visible
Definition: FrequencyDisplayPlot.h:42
bool marker_upper_intensity_visible
Definition: FrequencyDisplayPlot.h:50
void setYaxis(double min, double max)
QWidget for displaying frequency domain (PSD) plots.
Definition: FrequencyDisplayPlot.h:35
const bool getMarkerUpperIntensityVisible() const
void setMarkerNoiseFloorAmplitudeVisible(bool visible)
void setYLabel(const std::string &label, const std::string &unit)
void setMarkerUpperIntensityColor(QColor c)
void setMinFFTVisible(const bool)
void setTraceColour(QColor)
QColor marker_upper_intensity_color
Definition: FrequencyDisplayPlot.h:48
const QColor getMarkerPeakAmplitudeColor() const
const bool getMinFFTVisible() const
void setMarkerNoiseFloorAmplitudeColor(QColor c)
const QColor getMaxFFTColor() const
void setBGColour(QColor c)
const bool getMarkerLowerIntensityVisible() const
QColor max_fft_color
Definition: FrequencyDisplayPlot.h:40
void setMinFFTColor(QColor c)
void setMarkerLowerIntensityColor(QColor c)
const bool getMarkerNoiseFloorAmplitudeVisible() const
bool marker_noise_floor_amplitude_visible
Definition: FrequencyDisplayPlot.h:58
void setMaxFFTVisible(const bool)
void setMarkerUpperIntensityVisible(bool visible)
const QColor getMarkerCFColor() const
QColor marker_peak_amplitude_color
Definition: FrequencyDisplayPlot.h:52
QColor marker_lower_intensity_color
Definition: FrequencyDisplayPlot.h:44