root / gr-qtgui / src / lib / fftdisplay.h @ a63a5e70
History | View | Annotate | Download (1.2 kB)
| 1 | #ifndef FFT_DISPLAY_H
|
|---|---|
| 2 | #define FFT_DISPLAY_H
|
| 3 | |
| 4 | #include <gr_complex.h> |
| 5 | |
| 6 | #include <vector> |
| 7 | |
| 8 | #include <qwidget.h> |
| 9 | #include <qwt_plot.h> |
| 10 | #include <qevent.h> |
| 11 | |
| 12 | class fft_display_event:public QCustomEvent{
|
| 13 | public:
|
| 14 | fft_display_event(std::vector<gr_complex>*, const float, const float); |
| 15 | ~fft_display_event(); |
| 16 | |
| 17 | const std::vector<gr_complex>& get_fft_data()const; |
| 18 | float get_start_frequency()const; |
| 19 | float get_stop_frequency()const; |
| 20 | |
| 21 | static const int EVENT_TYPE_ID; |
| 22 | protected:
|
| 23 | |
| 24 | private:
|
| 25 | std::vector<gr_complex> d_fft_data; |
| 26 | float d_start_frequency;
|
| 27 | float d_stop_frequency;
|
| 28 | }; |
| 29 | |
| 30 | class fft_display:public QwtPlot{
|
| 31 | Q_OBJECT |
| 32 | public: |
| 33 | fft_display(const unsigned int, QWidget* = ((QWidget*)0)); |
| 34 | virtual ~fft_display(); |
| 35 | |
| 36 | virtual void customEvent(QCustomEvent*);
|
| 37 | |
| 38 | void set_start_frequency(const float); |
| 39 | float get_start_frequency()const; |
| 40 | |
| 41 | void set_stop_frequency(const float); |
| 42 | float get_stop_frequency()const; |
| 43 | |
| 44 | unsigned int get_fft_bin_size()const; |
| 45 | |
| 46 | public slots: |
| 47 | virtual void set_data( const std::vector<gr_complex>& ); |
| 48 | virtual void update_display();
|
| 49 | |
| 50 | protected:
|
| 51 | |
| 52 | private:
|
| 53 | std::vector<gr_complex>* d_fft_data; |
| 54 | double* d_plot_data;
|
| 55 | double* d_x_data;
|
| 56 | unsigned int d_fft_bin_size; |
| 57 | float d_start_frequency;
|
| 58 | float d_stop_frequency;
|
| 59 | }; |
| 60 | |
| 61 | #endif /* FFT_DISPLAY_H */ |