GNU Radio 3.3.0 C++ API
FrequencyDisplayPlot.h
Go to the documentation of this file.
00001 #ifndef FREQUENCY_DISPLAY_PLOT_HPP
00002 #define FREQUENCY_DISPLAY_PLOT_HPP
00003 
00004 #include <cstdio>
00005 #include <qwt_plot.h>
00006 #include <qwt_painter.h>
00007 #include <qwt_plot_canvas.h>
00008 #include <qwt_plot_curve.h>
00009 #include <qwt_scale_engine.h>
00010 #include <qwt_scale_widget.h>
00011 #include <qwt_plot_zoomer.h>
00012 #include <qwt_plot_panner.h>
00013 #include <qwt_plot_marker.h>
00014 #include <highResTimeFunctions.h>
00015 #include <qwt_symbol.h>
00016 
00017 class FrequencyDisplayPlot:public QwtPlot{
00018   Q_OBJECT
00019 
00020 public:
00021   FrequencyDisplayPlot(QWidget*);
00022   virtual ~FrequencyDisplayPlot();
00023 
00024   void SetFrequencyRange(const double, const double, 
00025                          const double, const bool,
00026                          const double units=1000.0, 
00027                          const std::string &strunits = "kHz");
00028   double GetStartFrequency()const;
00029   double GetStopFrequency()const;
00030 
00031   void PlotNewData(const double* dataPoints, const int64_t numDataPoints,
00032                    const double noiseFloorAmplitude, const double peakFrequency,
00033                    const double peakAmplitude, const double timeInterval);
00034   
00035   void ClearMaxData();
00036   void ClearMinData();
00037   
00038   void SetMaxFFTVisible(const bool);
00039   void SetMinFFTVisible(const bool);
00040                                    
00041   virtual void replot();
00042 
00043   void set_yaxis(double min, double max);
00044 
00045 public slots:
00046   void resizeSlot( QSize *e );
00047   void SetLowerIntensityLevel(const double);
00048   void SetUpperIntensityLevel(const double);
00049 
00050 protected:
00051 
00052 private:
00053 
00054   void _resetXAxisPoints();
00055   
00056   double _startFrequency;
00057   double _stopFrequency;
00058   double _maxYAxis;
00059   double _minYAxis;
00060   
00061   QwtPlotCurve* _fft_plot_curve;
00062   QwtPlotCurve* _min_fft_plot_curve;
00063   QwtPlotCurve* _max_fft_plot_curve;
00064 
00065   QwtPlotMarker* _lower_intensity_marker;
00066   QwtPlotMarker* _upper_intensity_marker;
00067 
00068   QwtPlotPanner* _panner;
00069   QwtPlotZoomer* _zoomer;
00070 
00071   QwtPlotMarker *_markerPeakAmplitude;
00072   QwtPlotMarker *_markerNoiseFloorAmplitude;
00073   
00074   double* _dataPoints;
00075   double* _xAxisPoints;
00076 
00077   double* _minFFTPoints;
00078   double* _maxFFTPoints;
00079   int64_t _numPoints;
00080 
00081   double _peakFrequency;
00082   double _peakAmplitude;
00083 
00084   double _noiseFloorAmplitude;
00085 
00086   timespec _lastReplot;
00087 
00088   bool _useCenterFrequencyFlag;
00089 };
00090 
00091 #endif /* FREQUENCY_DISPLAY_PLOT_HPP */