gr-baz Package
WaterfallDisplayPlot.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2008,2009,2010,2011 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef WATERFALL_DISPLAY_PLOT_HPP
24 #define WATERFALL_DISPLAY_PLOT_HPP
25 
26 #include <stdint.h>
27 #include <cstdio>
28 #include <qwt_plot.h>
29 #include <qwt_plot_spectrogram.h>
30 #include <qwt_plot_zoomer.h>
31 #include <qwt_plot_panner.h>
32 #include <qtgui_util.h>
33 #include <waterfallGlobalData.h>
34 
35 #include <gruel/high_res_timer.h>
36 
37 #if QWT_VERSION < 0x060000
38 #include <plot_waterfall.h>
39 #else
40 #include <qwt_compat.h>
41 #endif
42 
43 class WaterfallDisplayPlot:public QwtPlot{
44  Q_OBJECT
45 
46 public:
47  WaterfallDisplayPlot(QWidget*);
48  virtual ~WaterfallDisplayPlot();
49 
50  void Reset();
51 
52  void SetFrequencyRange(const double, const double,
53  const double, const bool,
54  const double units=1000.0,
55  const std::string &strunits = "kHz");
56  double GetStartFrequency()const;
57  double GetStopFrequency()const;
58 
59  void PlotNewData(const double* dataPoints, const int64_t numDataPoints,
60  const double timePerFFT, const gruel::high_res_timer_type timestamp,
61  const int droppedFrames);
62 
63  void SetIntensityRange(const double minIntensity, const double maxIntensity);
64 
65  virtual void replot(void);
66 
67  int GetIntensityColorMapType()const;
68  void SetIntensityColorMapType( const int, const QColor, const QColor );
69  const QColor GetUserDefinedLowIntensityColor()const;
70  const QColor GetUserDefinedHighIntensityColor()const;
71 
72  enum{
78  };
79 
80 public slots:
81  void resizeSlot( QSize *s );
82 
83  // Because of the preprocessing of slots in QT, these are no
84  // easily separated by the version check. Make one for each
85  // version until it's worked out.
86  void OnPickerPointSelected(const QwtDoublePoint & p);
87  void OnPickerPointSelected6(const QPointF & p);
88 
89 signals:
90  void UpdatedLowerIntensityLevel(const double);
91  void UpdatedUpperIntensityLevel(const double);
92  void plotPointSelected(const QPointF p);
93 
94 protected:
95 
96 private:
97  void _UpdateIntensityRangeDisplay();
98 
99  double _startFrequency;
100  double _stopFrequency;
101  int _xAxisMultiplier;
102 
103  QwtPlotPanner* _panner;
104  QwtPlotZoomer* _zoomer;
105 
106  QwtDblClickPlotPicker *_picker;
107 
108  WaterfallData *d_data;
109 
110 #if QWT_VERSION < 0x060000
111  PlotWaterfall *d_spectrogram;
112 #else
113  QwtPlotSpectrogram *d_spectrogram;
114 #endif
115 
116  gruel::high_res_timer_type _lastReplot;
117 
118  bool _useCenterFrequencyFlag;
119 
120  int64_t _numPoints;
121 
122  int _intensityColorMapType;
123  QColor _userDefinedLowIntensityColor;
124  QColor _userDefinedHighIntensityColor;
125 };
126 
127 #endif /* WATERFALL_DISPLAY_PLOT_HPP */