Imported Upstream version 3.2.2
[debian/gnuradio] / gr-qtgui / src / lib / FrequencyDisplayPlot.h
1 #ifndef FREQUENCY_DISPLAY_PLOT_HPP
2 #define FREQUENCY_DISPLAY_PLOT_HPP
3
4 #include <cstdio>
5 #include <qwt_plot.h>
6 #include <qwt_painter.h>
7 #include <qwt_plot_canvas.h>
8 #include <qwt_plot_curve.h>
9 #include <qwt_scale_engine.h>
10 #include <qwt_scale_widget.h>
11 #include <qwt_plot_zoomer.h>
12 #include <qwt_plot_panner.h>
13 #include <qwt_plot_marker.h>
14 #include <highResTimeFunctions.h>
15 #include <qwt_symbol.h>
16
17 class FrequencyDisplayPlot:public QwtPlot{
18   Q_OBJECT
19
20 public:
21   FrequencyDisplayPlot(QWidget*);
22   virtual ~FrequencyDisplayPlot();
23
24   void SetFrequencyRange(const double, const double, 
25                          const double, const bool,
26                          const double units=1000.0, 
27                          const std::string &strunits = "kHz");
28   double GetStartFrequency()const;
29   double GetStopFrequency()const;
30
31   void PlotNewData(const double* dataPoints, const int64_t numDataPoints,
32                    const double noiseFloorAmplitude, const double peakFrequency,
33                    const double peakAmplitude);
34   
35   void ClearMaxData();
36   void ClearMinData();
37   
38   void SetMaxFFTVisible(const bool);
39   void SetMinFFTVisible(const bool);
40                                    
41   virtual void replot();
42
43   void set_yaxis(double min, double max);
44
45 public slots:
46   void SetLowerIntensityLevel(const double);
47   void SetUpperIntensityLevel(const double);
48
49 protected:
50
51 private:
52   void _resetXAxisPoints();
53   
54   double _startFrequency;
55   double _stopFrequency;
56   double _maxYAxis;
57   double _minYAxis;
58   
59   QwtPlotCurve* _fft_plot_curve;
60   QwtPlotCurve* _min_fft_plot_curve;
61   QwtPlotCurve* _max_fft_plot_curve;
62
63   QwtPlotMarker* _lower_intensity_marker;
64   QwtPlotMarker* _upper_intensity_marker;
65
66   QwtPlotPanner* _panner;
67   QwtPlotZoomer* _zoomer;
68
69   QwtPlotMarker *_markerPeakAmplitude;
70   QwtPlotMarker *_markerNoiseFloorAmplitude;
71   
72   double* _dataPoints;
73   double* _xAxisPoints;
74
75   double* _minFFTPoints;
76   double* _maxFFTPoints;
77   int64_t _numPoints;
78
79   double _peakFrequency;
80   double _peakAmplitude;
81
82   double _noiseFloorAmplitude;
83
84   timespec _lastReplot;
85
86   bool _useCenterFrequencyFlag;
87
88   double _displayIntervalTime;
89 };
90
91 #endif /* FREQUENCY_DISPLAY_PLOT_HPP */