GNU Radio 3.4.0 C++ API
|
00001 /* -*- c++ -*- */ 00002 /* 00003 * Copyright 2008,2009,2010,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 <qwt_plot.h> 00029 #include <qwt_painter.h> 00030 #include <qwt_plot_canvas.h> 00031 #include <qwt_plot_curve.h> 00032 #include <qwt_scale_engine.h> 00033 #include <qwt_scale_widget.h> 00034 #include <qwt_plot_zoomer.h> 00035 #include <qwt_plot_panner.h> 00036 #include <qwt_plot_marker.h> 00037 #include <qwt_plot_magnifier.h> 00038 #include <gruel/high_res_timer.h> 00039 #include <qwt_symbol.h> 00040 #include <qtgui_util.h> 00041 00042 class FrequencyDisplayPlot:public QwtPlot{ 00043 Q_OBJECT 00044 00045 public: 00046 FrequencyDisplayPlot(QWidget*); 00047 virtual ~FrequencyDisplayPlot(); 00048 00049 void SetFrequencyRange(const double, const double, 00050 const double, const bool, 00051 const double units=1000.0, 00052 const std::string &strunits = "kHz"); 00053 double GetStartFrequency()const; 00054 double GetStopFrequency()const; 00055 00056 void PlotNewData(const double* dataPoints, const int64_t numDataPoints, 00057 const double noiseFloorAmplitude, const double peakFrequency, 00058 const double peakAmplitude, const double timeInterval); 00059 00060 void ClearMaxData(); 00061 void ClearMinData(); 00062 00063 void SetMaxFFTVisible(const bool); 00064 void SetMinFFTVisible(const bool); 00065 00066 virtual void replot(); 00067 00068 void set_yaxis(double min, double max); 00069 00070 void SetTraceColour (QColor); 00071 void SetBGColour (QColor c); 00072 void ShowCFMarker (const bool); 00073 00074 public slots: 00075 void resizeSlot( QSize *e ); 00076 void SetLowerIntensityLevel(const double); 00077 void SetUpperIntensityLevel(const double); 00078 00079 void OnPickerPointSelected(const QwtDoublePoint & p); 00080 00081 signals: 00082 void plotPointSelected(const QPointF p); 00083 00084 protected: 00085 00086 private: 00087 00088 void _resetXAxisPoints(); 00089 00090 double _startFrequency; 00091 double _stopFrequency; 00092 double _maxYAxis; 00093 double _minYAxis; 00094 00095 QwtPlotCurve* _fft_plot_curve; 00096 QwtPlotCurve* _min_fft_plot_curve; 00097 QwtPlotCurve* _max_fft_plot_curve; 00098 00099 QwtPlotMarker* _lower_intensity_marker; 00100 QwtPlotMarker* _upper_intensity_marker; 00101 00102 QwtPlotPanner* _panner; 00103 QwtPlotZoomer* _zoomer; 00104 00105 QwtPlotMarker *_markerPeakAmplitude; 00106 QwtPlotMarker *_markerNoiseFloorAmplitude; 00107 QwtPlotMarker *_markerCF; 00108 00109 QwtDblClickPlotPicker *_picker; 00110 QwtPlotMagnifier *_magnifier; 00111 00112 double* _dataPoints; 00113 double* _xAxisPoints; 00114 int _xAxisMultiplier; 00115 00116 double* _minFFTPoints; 00117 double* _maxFFTPoints; 00118 int64_t _numPoints; 00119 00120 double _peakFrequency; 00121 double _peakAmplitude; 00122 00123 double _noiseFloorAmplitude; 00124 00125 gruel::high_res_timer_type _lastReplot; 00126 00127 bool _useCenterFrequencyFlag; 00128 }; 00129 00130 #endif /* FREQUENCY_DISPLAY_PLOT_HPP */