GNU Radio Manual and C++ API Reference  3.7.6.2
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
26 #include <stdint.h>
27 #include <cstdio>
28 #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 )
50  Q_PROPERTY ( QColor marker_CF_color READ getMarkerCFColor WRITE setMarkerCFColor )
51 
52 public:
53  FrequencyDisplayPlot(int nplots, QWidget*);
54  virtual ~FrequencyDisplayPlot();
55 
56  void setFrequencyRange(const double, const double,
57  const double units=1000.0,
58  const std::string &strunits = "kHz");
59  double getStartFrequency()const;
60  double getStopFrequency()const;
61 
62  void plotNewData(const std::vector<double*> dataPoints,
63  const int64_t numDataPoints,
64  const double noiseFloorAmplitude, const double peakFrequency,
65  const double peakAmplitude, 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, const double peakFrequency,
71  const double peakAmplitude, const double timeInterval);
72 
73  void clearMaxData();
74  void clearMinData();
75 
76  void replot();
77 
78  void setYaxis(double min, double max);
79  double getYMin() const;
80  double getYMax() const;
81 
82  void setTraceColour (QColor);
83  void setBGColour (QColor c);
84  void showCFMarker (const bool);
85 
86  const bool getMaxFFTVisible() const;
87  const bool getMinFFTVisible() const;
88  const QColor getMinFFTColor() const;
89  const QColor getMaxFFTColor() const;
90  const QColor getMarkerLowerIntensityColor () const;
91  const bool getMarkerLowerIntensityVisible () const;
92  const QColor getMarkerUpperIntensityColor () const;
93  const bool getMarkerUpperIntensityVisible () const;
94  const QColor getMarkerPeakAmplitudeColor () const;
95  const bool getMarkerNoiseFloorAmplitudeVisible () const;
96  const QColor getMarkerNoiseFloorAmplitudeColor () const;
97  const QColor getMarkerCFColor () const;
98 
99 public slots:
100  void setMaxFFTVisible(const bool);
101  void setMinFFTVisible(const bool);
102  void setMinFFTColor (QColor c);
103  void setMaxFFTColor (QColor c);
104  void setMarkerLowerIntensityColor (QColor c);
105  void setMarkerLowerIntensityVisible (bool visible);
106  void setMarkerUpperIntensityColor (QColor c);
107  void setMarkerUpperIntensityVisible (bool visible);
108  void setMarkerPeakAmplitudeColor (QColor c);
109  void setMarkerNoiseFloorAmplitudeVisible (bool visible);
110  void setMarkerNoiseFloorAmplitudeColor (QColor c);
111  void setMarkerCFColor (QColor c);
112 
113  void setLowerIntensityLevel(const double);
114  void setUpperIntensityLevel(const double);
115 
116  void onPickerPointSelected(const QwtDoublePoint & p);
117  void onPickerPointSelected6(const QPointF & p);
118 
119  void setAutoScale(bool state);
120 
121  void setPlotPosHalf(bool half);
122 
123 private:
124  void _resetXAxisPoints();
125  void _autoScale(double bottom, double top);
126 
127  std::vector<double*> d_ydata;
128 
129  QwtPlotCurve* d_min_fft_plot_curve;
130  QwtPlotCurve* d_max_fft_plot_curve;
131  QColor d_min_fft_color;
132  bool d_min_fft_visible;
133  QColor d_max_fft_color;
134  bool d_max_fft_visible;
135  QColor d_marker_lower_intensity_color;
136  bool d_marker_lower_intensity_visible;
137  QColor d_marker_upper_intensity_color;
138  bool d_marker_upper_intensity_visible;
139  QColor d_marker_peak_amplitude_color;
140  QColor d_marker_noise_floor_amplitude_color;
141  bool d_marker_noise_floor_amplitude_visible;
142  QColor d_marker_cf_color;
143 
144  double d_start_frequency;
145  double d_stop_frequency;
146  double d_ymax;
147  double d_ymin;
148  bool d_half_freq;
149 
150  QwtPlotMarker* d_lower_intensity_marker;
151  QwtPlotMarker* d_upper_intensity_marker;
152 
153  QwtPlotMarker *d_marker_peak_amplitude;
154  QwtPlotMarker *d_marker_noise_floor_amplitude;
155  QwtPlotMarker *d_marker_cf;
156 
157  double* d_xdata;
158  int d_xdata_multiplier;
159 
160  double* d_min_fft_data;
161  double* d_max_fft_data;
162 
163  double d_peak_frequency;
164  double d_peak_amplitude;
165 
166  double d_noise_floor_amplitude;
167 };
168 
169 #endif /* FREQUENCY_DISPLAY_PLOT_HPP */
const bool getMarkerNoiseFloorAmplitudeVisible() const
void setAutoScale(bool state)
void setMarkerLowerIntensityVisible(bool visible)
bool min_fft_visible
Definition: FrequencyDisplayPlot.h:41
const bool getMarkerLowerIntensityVisible() const
const bool getMaxFFTVisible() const
const QColor getMaxFFTColor() 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)
QWidget base plot to build QTGUI plotting tools.
Definition: DisplayPlot.h:53
float min(float a, float b)
void setUpperIntensityLevel(const double)
void plotNewData(const std::vector< double * > dataPoints, const int64_t numDataPoints, const double noiseFloorAmplitude, const double peakFrequency, const double peakAmplitude, const double timeInterval)
double getStartFrequency() const
void setMaxFFTColor(QColor c)
void setMarkerPeakAmplitudeColor(QColor c)
void setPlotPosHalf(bool half)
double getYMin() const
QColor min_fft_color
Definition: FrequencyDisplayPlot.h:39
double getYMax() const
bool marker_lower_intensity_visible
Definition: FrequencyDisplayPlot.h:44
QColor marker_CF_color
Definition: FrequencyDisplayPlot.h:50
const bool getMinFFTVisible() const
QColor marker_noise_floor_amplitude_color
Definition: FrequencyDisplayPlot.h:48
const QColor getMarkerNoiseFloorAmplitudeColor() const
void showCFMarker(const bool)
void setLowerIntensityLevel(const double)
void onPickerPointSelected(const QwtDoublePoint &p)
bool max_fft_visible
Definition: FrequencyDisplayPlot.h:42
bool marker_upper_intensity_visible
Definition: FrequencyDisplayPlot.h:46
const bool getMarkerUpperIntensityVisible() const
void setYaxis(double min, double max)
QWidget for displaying frequency domain (PSD) plots.
Definition: FrequencyDisplayPlot.h:35
const QColor getMarkerLowerIntensityColor() const
const QColor getMarkerPeakAmplitudeColor() const
void setMarkerNoiseFloorAmplitudeVisible(bool visible)
double getStopFrequency() const
const QColor getMarkerUpperIntensityColor() const
void setMarkerUpperIntensityColor(QColor c)
void setMinFFTVisible(const bool)
void setTraceColour(QColor)
QColor marker_upper_intensity_color
Definition: FrequencyDisplayPlot.h:45
void setMarkerNoiseFloorAmplitudeColor(QColor c)
const QColor getMinFFTColor() const
void setBGColour(QColor c)
QColor max_fft_color
Definition: FrequencyDisplayPlot.h:40
void setMinFFTColor(QColor c)
void setMarkerLowerIntensityColor(QColor c)
const QColor getMarkerCFColor() const
bool marker_noise_floor_amplitude_visible
Definition: FrequencyDisplayPlot.h:49
void setMaxFFTVisible(const bool)
void setMarkerUpperIntensityVisible(bool visible)
QColor marker_peak_amplitude_color
Definition: FrequencyDisplayPlot.h:47
QColor marker_lower_intensity_color
Definition: FrequencyDisplayPlot.h:43