GNU Radio 3.7.1 C++ API
|
00001 /* -*- c++ -*- */ 00002 /* 00003 * Copyright 2008-2011 Free Software Foundation, Inc. 00004 * 00005 * This file is part of GNU Radio 00006 * 00007 * GNU Radio is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 3, or (at your option) 00010 * any later version. 00011 * 00012 * GNU Radio is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with GNU Radio; see the file COPYING. If not, write to 00019 * the Free Software Foundation, Inc., 51 Franklin Street, 00020 * Boston, MA 02110-1301, USA. 00021 */ 00022 00023 #ifndef FREQUENCY_DISPLAY_PLOT_HPP 00024 #define FREQUENCY_DISPLAY_PLOT_HPP 00025 00026 #include <stdint.h> 00027 #include <cstdio> 00028 #include <vector> 00029 #include <gnuradio/qtgui/DisplayPlot.h> 00030 00031 /*! 00032 * \brief QWidget for displaying frequency domain (PSD) plots. 00033 * \ingroup qtgui_blk 00034 */ 00035 class FrequencyDisplayPlot: public DisplayPlot 00036 { 00037 Q_OBJECT 00038 00039 Q_PROPERTY ( QColor min_fft_color READ getMinFFTColor WRITE setMinFFTColor ) 00040 Q_PROPERTY ( QColor max_fft_color READ getMaxFFTColor WRITE setMaxFFTColor ) 00041 Q_PROPERTY ( bool min_fft_visible READ getMinFFTVisible WRITE setMinFFTVisible ) 00042 Q_PROPERTY ( bool max_fft_visible READ getMaxFFTVisible WRITE setMaxFFTVisible ) 00043 Q_PROPERTY ( QColor marker_lower_intensity_color READ getMarkerLowerIntensityColor WRITE setMarkerLowerIntensityColor ) 00044 Q_PROPERTY ( bool marker_lower_intensity_visible READ getMarkerLowerIntensityVisible WRITE setMarkerLowerIntensityVisible ) 00045 Q_PROPERTY ( QColor marker_upper_intensity_color READ getMarkerUpperIntensityColor WRITE setMarkerUpperIntensityColor ) 00046 Q_PROPERTY ( bool marker_upper_intensity_visible READ getMarkerUpperIntensityVisible WRITE setMarkerUpperIntensityVisible ) 00047 Q_PROPERTY ( QColor marker_peak_amplitude_color READ getMarkerPeakAmplitudeColor WRITE setMarkerPeakAmplitudeColor ) 00048 Q_PROPERTY ( QColor marker_noise_floor_amplitude_color READ getMarkerNoiseFloorAmplitudeColor WRITE setMarkerNoiseFloorAmplitudeColor ) 00049 Q_PROPERTY ( bool marker_noise_floor_amplitude_visible READ getMarkerNoiseFloorAmplitudeVisible WRITE setMarkerNoiseFloorAmplitudeVisible ) 00050 Q_PROPERTY ( QColor marker_CF_color READ getMarkerCFColor WRITE setMarkerCFColor ) 00051 00052 public: 00053 FrequencyDisplayPlot(int nplots, QWidget*); 00054 virtual ~FrequencyDisplayPlot(); 00055 00056 void setFrequencyRange(const double, const double, 00057 const double units=1000.0, 00058 const std::string &strunits = "kHz"); 00059 double getStartFrequency()const; 00060 double getStopFrequency()const; 00061 00062 void plotNewData(const std::vector<double*> dataPoints, 00063 const int64_t numDataPoints, 00064 const double noiseFloorAmplitude, const double peakFrequency, 00065 const double peakAmplitude, const double timeInterval); 00066 00067 // Old method to be removed 00068 void plotNewData(const double* dataPoints, 00069 const int64_t numDataPoints, 00070 const double noiseFloorAmplitude, const double peakFrequency, 00071 const double peakAmplitude, const double timeInterval); 00072 00073 void clearMaxData(); 00074 void clearMinData(); 00075 00076 void replot(); 00077 00078 void setYaxis(double min, double max); 00079 00080 void setTraceColour (QColor); 00081 void setBGColour (QColor c); 00082 void showCFMarker (const bool); 00083 00084 const bool getMaxFFTVisible() const; 00085 const bool getMinFFTVisible() const; 00086 const QColor getMinFFTColor() const; 00087 const QColor getMaxFFTColor() const; 00088 const QColor getMarkerLowerIntensityColor () const; 00089 const bool getMarkerLowerIntensityVisible () const; 00090 const QColor getMarkerUpperIntensityColor () const; 00091 const bool getMarkerUpperIntensityVisible () const; 00092 const QColor getMarkerPeakAmplitudeColor () const; 00093 const bool getMarkerNoiseFloorAmplitudeVisible () const; 00094 const QColor getMarkerNoiseFloorAmplitudeColor () const; 00095 const QColor getMarkerCFColor () const; 00096 00097 public slots: 00098 void setMaxFFTVisible(const bool); 00099 void setMinFFTVisible(const bool); 00100 void setMinFFTColor (QColor c); 00101 void setMaxFFTColor (QColor c); 00102 void setMarkerLowerIntensityColor (QColor c); 00103 void setMarkerLowerIntensityVisible (bool visible); 00104 void setMarkerUpperIntensityColor (QColor c); 00105 void setMarkerUpperIntensityVisible (bool visible); 00106 void setMarkerPeakAmplitudeColor (QColor c); 00107 void setMarkerNoiseFloorAmplitudeVisible (bool visible); 00108 void setMarkerNoiseFloorAmplitudeColor (QColor c); 00109 void setMarkerCFColor (QColor c); 00110 00111 void setLowerIntensityLevel(const double); 00112 void setUpperIntensityLevel(const double); 00113 00114 void onPickerPointSelected(const QwtDoublePoint & p); 00115 void onPickerPointSelected6(const QPointF & p); 00116 00117 void setAutoScale(bool state); 00118 00119 private: 00120 void _resetXAxisPoints(); 00121 void _autoScale(double bottom, double top); 00122 00123 std::vector<double*> _dataPoints; 00124 00125 QwtPlotCurve* _min_fft_plot_curve; 00126 QwtPlotCurve* _max_fft_plot_curve; 00127 QColor _min_fft_color; 00128 bool _min_fft_visible; 00129 QColor _max_fft_color; 00130 bool _max_fft_visible; 00131 QColor _marker_lower_intensity_color; 00132 bool _marker_lower_intensity_visible; 00133 QColor _marker_upper_intensity_color; 00134 bool _marker_upper_intensity_visible; 00135 QColor _marker_peak_amplitude_color; 00136 QColor _marker_noise_floor_amplitude_color; 00137 bool _marker_noise_floor_amplitude_visible; 00138 QColor _marker_CF_color; 00139 00140 double _startFrequency; 00141 double _stopFrequency; 00142 double _maxYAxis; 00143 double _minYAxis; 00144 00145 QwtPlotMarker* _lower_intensity_marker; 00146 QwtPlotMarker* _upper_intensity_marker; 00147 00148 QwtPlotMarker *_markerPeakAmplitude; 00149 QwtPlotMarker *_markerNoiseFloorAmplitude; 00150 QwtPlotMarker *_markerCF; 00151 00152 double* _xAxisPoints; 00153 int _xAxisMultiplier; 00154 00155 double* _minFFTPoints; 00156 double* _maxFFTPoints; 00157 00158 double _peakFrequency; 00159 double _peakAmplitude; 00160 00161 double _noiseFloorAmplitude; 00162 }; 00163 00164 #endif /* FREQUENCY_DISPLAY_PLOT_HPP */