Fixes the replotting update. It's now based on a QTimer so it's in the event buffer...
[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, const double timeInterval);
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 resizeSlot( QSize *e );
47   void SetLowerIntensityLevel(const double);
48   void SetUpperIntensityLevel(const double);
49
50 protected:
51
52 private:
53
54   void _resetXAxisPoints();
55   
56   double _startFrequency;
57   double _stopFrequency;
58   double _maxYAxis;
59   double _minYAxis;
60   
61   QwtPlotCurve* _fft_plot_curve;
62   QwtPlotCurve* _min_fft_plot_curve;
63   QwtPlotCurve* _max_fft_plot_curve;
64
65   QwtPlotMarker* _lower_intensity_marker;
66   QwtPlotMarker* _upper_intensity_marker;
67
68   QwtPlotPanner* _panner;
69   QwtPlotZoomer* _zoomer;
70
71   QwtPlotMarker *_markerPeakAmplitude;
72   QwtPlotMarker *_markerNoiseFloorAmplitude;
73   
74   double* _dataPoints;
75   double* _xAxisPoints;
76
77   double* _minFFTPoints;
78   double* _maxFFTPoints;
79   int64_t _numPoints;
80
81   double _peakFrequency;
82   double _peakAmplitude;
83
84   double _noiseFloorAmplitude;
85
86   timespec _lastReplot;
87
88   bool _useCenterFrequencyFlag;
89 };
90
91 #endif /* FREQUENCY_DISPLAY_PLOT_HPP */