GNU Radio 3.4.2 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 #if QWT_VERSION >= 0x060000 00043 #include <qwt_compat.h> 00044 #endif 00045 00046 class FrequencyDisplayPlot:public QwtPlot{ 00047 Q_OBJECT 00048 00049 public: 00050 FrequencyDisplayPlot(QWidget*); 00051 virtual ~FrequencyDisplayPlot(); 00052 00053 void SetFrequencyRange(const double, const double, 00054 const double, const bool, 00055 const double units=1000.0, 00056 const std::string &strunits = "kHz"); 00057 double GetStartFrequency()const; 00058 double GetStopFrequency()const; 00059 00060 void PlotNewData(const double* dataPoints, const int64_t numDataPoints, 00061 const double noiseFloorAmplitude, const double peakFrequency, 00062 const double peakAmplitude, const double timeInterval); 00063 00064 void ClearMaxData(); 00065 void ClearMinData(); 00066 00067 void SetMaxFFTVisible(const bool); 00068 void SetMinFFTVisible(const bool); 00069 00070 virtual void replot(); 00071 00072 void set_yaxis(double min, double max); 00073 00074 void SetTraceColour (QColor); 00075 void SetBGColour (QColor c); 00076 void ShowCFMarker (const bool); 00077 00078 public slots: 00079 void resizeSlot( QSize *e ); 00080 void SetLowerIntensityLevel(const double); 00081 void SetUpperIntensityLevel(const double); 00082 00083 #if QWT_VERSION < 0x060000 00084 void OnPickerPointSelected(const QwtDoublePoint & p); 00085 #else 00086 void OnPickerPointSelected(const QPointF & p); 00087 #endif 00088 00089 signals: 00090 void plotPointSelected(const QPointF p); 00091 00092 protected: 00093 00094 private: 00095 00096 void _resetXAxisPoints(); 00097 00098 double _startFrequency; 00099 double _stopFrequency; 00100 double _maxYAxis; 00101 double _minYAxis; 00102 00103 QwtPlotCurve* _fft_plot_curve; 00104 QwtPlotCurve* _min_fft_plot_curve; 00105 QwtPlotCurve* _max_fft_plot_curve; 00106 00107 QwtPlotMarker* _lower_intensity_marker; 00108 QwtPlotMarker* _upper_intensity_marker; 00109 00110 QwtPlotPanner* _panner; 00111 QwtPlotZoomer* _zoomer; 00112 00113 QwtPlotMarker *_markerPeakAmplitude; 00114 QwtPlotMarker *_markerNoiseFloorAmplitude; 00115 QwtPlotMarker *_markerCF; 00116 00117 QwtDblClickPlotPicker *_picker; 00118 00119 QwtPlotMagnifier *_magnifier; 00120 00121 double* _dataPoints; 00122 double* _xAxisPoints; 00123 int _xAxisMultiplier; 00124 00125 double* _minFFTPoints; 00126 double* _maxFFTPoints; 00127 int64_t _numPoints; 00128 00129 double _peakFrequency; 00130 double _peakAmplitude; 00131 00132 double _noiseFloorAmplitude; 00133 00134 gruel::high_res_timer_type _lastReplot; 00135 00136 bool _useCenterFrequencyFlag; 00137 }; 00138 00139 #endif /* FREQUENCY_DISPLAY_PLOT_HPP */