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