GNU Radio 3.4.2 C++ API
WaterfallDisplayPlot.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2008,2009,2010,2011 Free Software Foundation, Inc.
00004  * 
00005  * This file is part of GNU Radio
00006  * 
00007  * GNU Radio is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 3, or (at your option)
00010  * any later version.
00011  * 
00012  * GNU Radio is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with GNU Radio; see the file COPYING.  If not, write to
00019  * the Free Software Foundation, Inc., 51 Franklin Street,
00020  * Boston, MA 02110-1301, USA.
00021  */
00022 
00023 #ifndef WATERFALL_DISPLAY_PLOT_HPP
00024 #define WATERFALL_DISPLAY_PLOT_HPP
00025 
00026 #include <stdint.h>
00027 #include <cstdio>
00028 #include <qwt_plot.h>
00029 #include <qwt_plot_spectrogram.h>
00030 #include <qwt_plot_zoomer.h>
00031 #include <qwt_plot_panner.h>
00032 #include <qtgui_util.h>
00033 #include <waterfallGlobalData.h>
00034 
00035 #include <gruel/high_res_timer.h>
00036 
00037 #if QWT_VERSION < 0x060000
00038 #include <plot_waterfall.h>
00039 #else
00040 #include <qwt_compat.h>
00041 #endif
00042 
00043 class WaterfallDisplayPlot:public QwtPlot{
00044   Q_OBJECT
00045 
00046 public:
00047   WaterfallDisplayPlot(QWidget*);
00048   virtual ~WaterfallDisplayPlot();
00049 
00050   void Reset();
00051 
00052   void SetFrequencyRange(const double, const double, 
00053                          const double, const bool,
00054                          const double units=1000.0, 
00055                          const std::string &strunits = "kHz");
00056   double GetStartFrequency()const;
00057   double GetStopFrequency()const;
00058 
00059   void PlotNewData(const double* dataPoints, const int64_t numDataPoints,
00060                    const double timePerFFT, const gruel::high_res_timer_type timestamp,
00061                    const int droppedFrames);
00062 
00063   void SetIntensityRange(const double minIntensity, const double maxIntensity);
00064 
00065   virtual void replot(void);
00066 
00067   int GetIntensityColorMapType()const;
00068   void SetIntensityColorMapType( const int, const QColor, const QColor );
00069   const QColor GetUserDefinedLowIntensityColor()const;
00070   const QColor GetUserDefinedHighIntensityColor()const;
00071 
00072   enum{
00073     INTENSITY_COLOR_MAP_TYPE_MULTI_COLOR = 0,
00074     INTENSITY_COLOR_MAP_TYPE_WHITE_HOT = 1,
00075     INTENSITY_COLOR_MAP_TYPE_BLACK_HOT = 2,
00076     INTENSITY_COLOR_MAP_TYPE_INCANDESCENT = 3,
00077     INTENSITY_COLOR_MAP_TYPE_USER_DEFINED = 4
00078   };
00079 
00080 public slots:
00081   void resizeSlot( QSize *s );
00082 
00083 #if QWT_VERSION < 0x060000
00084   void OnPickerPointSelected(const QwtDoublePoint & p);
00085 #else
00086   void OnPickerPointSelected(const QPointF & p);
00087 #endif
00088  
00089 signals:
00090   void UpdatedLowerIntensityLevel(const double);
00091   void UpdatedUpperIntensityLevel(const double);
00092   void plotPointSelected(const QPointF p);
00093 
00094 protected:
00095 
00096 private:
00097   void _UpdateIntensityRangeDisplay();
00098 
00099   double _startFrequency;
00100   double _stopFrequency;
00101   int    _xAxisMultiplier;
00102 
00103   QwtPlotPanner* _panner;
00104   QwtPlotZoomer* _zoomer;
00105 
00106   QwtDblClickPlotPicker *_picker;
00107 
00108   WaterfallData *d_data;
00109 
00110 #if QWT_VERSION < 0x060000
00111   PlotWaterfall *d_spectrogram;
00112 #else
00113   QwtPlotSpectrogram *d_spectrogram;
00114 #endif
00115 
00116   gruel::high_res_timer_type _lastReplot;
00117 
00118   bool _useCenterFrequencyFlag;
00119 
00120   int64_t _numPoints;
00121 
00122   int _intensityColorMapType;
00123   QColor _userDefinedLowIntensityColor;
00124   QColor _userDefinedHighIntensityColor;
00125 };
00126 
00127 #endif /* WATERFALL_DISPLAY_PLOT_HPP */