GNU Radio 3.4.0 C++ API
TimeDomainDisplayPlot.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 TIME_DOMAIN_DISPLAY_PLOT_HPP
00024 #define TIME_DOMAIN_DISPLAY_PLOT_HPP
00025 
00026 #include <stdint.h>
00027 #include <cstdio>
00028 #include <vector>
00029 #include <qwt_plot.h>
00030 #include <qwt_painter.h>
00031 #include <qwt_plot_canvas.h>
00032 #include <qwt_plot_curve.h>
00033 #include <qwt_scale_engine.h>
00034 #include <qwt_scale_widget.h>
00035 #include <qwt_plot_zoomer.h>
00036 #include <qwt_plot_panner.h>
00037 #include <qwt_plot_magnifier.h>
00038 #include <qwt_plot_marker.h>
00039 #include <qwt_symbol.h>
00040 #include <qtgui_util.h>
00041 
00042 class TimeDomainDisplayPlot:public QwtPlot{
00043   Q_OBJECT
00044 
00045 public:
00046   TimeDomainDisplayPlot(int nplots, QWidget*);
00047   virtual ~TimeDomainDisplayPlot();
00048 
00049   void PlotNewData(const std::vector<double*> dataPoints, 
00050                    const int64_t numDataPoints, const double timeInterval);
00051     
00052   virtual void replot();
00053 
00054 public slots:
00055   void setYaxis(double min, double max);
00056   void setXaxis(double min, double max);
00057   void setTitle(int which, QString title);
00058   void setColor(int which, QString color);
00059 
00060   void resizeSlot( QSize *s );
00061   void SetSampleRate(double sr, double units, 
00062                      const std::string &strunits);
00063 
00064   void OnPickerPointSelected(const QwtDoublePoint & p);
00065 
00066 signals:
00067   void plotPointSelected(const QPointF p);
00068 
00069 protected slots:
00070   void LegendEntryChecked(QwtPlotItem *plotItem, bool on);
00071 
00072 protected:
00073 
00074 private:
00075   void _resetXAxisPoints();
00076 
00077   int _nplots;
00078   std::vector<QwtPlotCurve*> _plot_curve;
00079 
00080   QwtPlotPanner* _panner;
00081   QwtPlotZoomer* _zoomer;
00082   
00083   QwtDblClickPlotPicker *_picker;
00084   QwtPlotMagnifier *_magnifier;
00085   
00086   std::vector<double*> _dataPoints;
00087   double* _xAxisPoints;
00088 
00089   double _sampleRate;
00090 
00091   int64_t _numPoints;
00092 };
00093 
00094 #endif /* TIME_DOMAIN_DISPLAY_PLOT_HPP */