GNU Radio 3.4.0 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_zoomer.h>
00030 #include <qwt_plot_panner.h>
00031 
00032 #include <qtgui_util.h>
00033 #include <plot_waterfall.h>
00034 
00035 #include <gruel/high_res_timer.h>
00036 
00037 class WaterfallDisplayPlot:public QwtPlot{
00038   Q_OBJECT
00039 
00040 public:
00041   WaterfallDisplayPlot(QWidget*);
00042   virtual ~WaterfallDisplayPlot();
00043 
00044   void Reset();
00045 
00046   void SetFrequencyRange(const double, const double, 
00047                          const double, const bool,
00048                          const double units=1000.0, 
00049                          const std::string &strunits = "kHz");
00050   double GetStartFrequency()const;
00051   double GetStopFrequency()const;
00052 
00053   void PlotNewData(const double* dataPoints, const int64_t numDataPoints,
00054                    const double timePerFFT, const gruel::high_res_timer_type timestamp,
00055                    const int droppedFrames);
00056 
00057   void SetIntensityRange(const double minIntensity, const double maxIntensity);
00058 
00059   virtual void replot(void);
00060 
00061   int GetIntensityColorMapType()const;
00062   void SetIntensityColorMapType( const int, const QColor, const QColor );
00063   const QColor GetUserDefinedLowIntensityColor()const;
00064   const QColor GetUserDefinedHighIntensityColor()const;
00065 
00066   enum{
00067     INTENSITY_COLOR_MAP_TYPE_MULTI_COLOR = 0,
00068     INTENSITY_COLOR_MAP_TYPE_WHITE_HOT = 1,
00069     INTENSITY_COLOR_MAP_TYPE_BLACK_HOT = 2,
00070     INTENSITY_COLOR_MAP_TYPE_INCANDESCENT = 3,
00071     INTENSITY_COLOR_MAP_TYPE_USER_DEFINED = 4
00072   };
00073 
00074 public slots:
00075   void resizeSlot( QSize *s );
00076   void OnPickerPointSelected(const QwtDoublePoint & p);
00077  
00078 signals:
00079   void UpdatedLowerIntensityLevel(const double);
00080   void UpdatedUpperIntensityLevel(const double);
00081   void plotPointSelected(const QPointF p);
00082 
00083 protected:
00084 
00085 private:
00086   void _UpdateIntensityRangeDisplay();
00087 
00088   double _startFrequency;
00089   double _stopFrequency;
00090   int    _xAxisMultiplier;
00091 
00092   PlotWaterfall *d_spectrogram;
00093 
00094   QwtPlotPanner* _panner;
00095   QwtPlotZoomer* _zoomer;
00096 
00097   QwtDblClickPlotPicker *_picker;
00098 
00099   WaterfallData* _waterfallData;
00100 
00101   gruel::high_res_timer_type _lastReplot;
00102 
00103   bool _useCenterFrequencyFlag;
00104 
00105   int64_t _numPoints;
00106 
00107   int _intensityColorMapType;
00108   QColor _userDefinedLowIntensityColor;
00109   QColor _userDefinedHighIntensityColor;
00110 };
00111 
00112 #endif /* WATERFALL_DISPLAY_PLOT_HPP */