GNU Radio 3.4.2 C++ API
|
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 #if QWT_VERSION >= 0x060000 00043 #include <qwt_compat.h> 00044 #endif 00045 00046 class TimeDomainDisplayPlot:public QwtPlot{ 00047 Q_OBJECT 00048 00049 public: 00050 TimeDomainDisplayPlot(int nplots, QWidget*); 00051 virtual ~TimeDomainDisplayPlot(); 00052 00053 void PlotNewData(const std::vector<double*> dataPoints, 00054 const int64_t numDataPoints, const double timeInterval); 00055 00056 virtual void replot(); 00057 00058 public slots: 00059 void setYaxis(double min, double max); 00060 void setXaxis(double min, double max); 00061 void setTitle(int which, QString title); 00062 void setColor(int which, QString color); 00063 00064 void resizeSlot( QSize *s ); 00065 void SetSampleRate(double sr, double units, 00066 const std::string &strunits); 00067 00068 #if QWT_VERSION < 0x060000 00069 void OnPickerPointSelected(const QwtDoublePoint & p); 00070 #else 00071 void OnPickerPointSelected(const QPointF & p); 00072 #endif 00073 00074 signals: 00075 void plotPointSelected(const QPointF p); 00076 00077 protected slots: 00078 void LegendEntryChecked(QwtPlotItem *plotItem, bool on); 00079 00080 protected: 00081 00082 private: 00083 void _resetXAxisPoints(); 00084 00085 int _nplots; 00086 std::vector<QwtPlotCurve*> _plot_curve; 00087 00088 QwtPlotPanner* _panner; 00089 QwtPlotZoomer* _zoomer; 00090 00091 QwtDblClickPlotPicker *_picker; 00092 QwtPlotMagnifier *_magnifier; 00093 00094 std::vector<double*> _dataPoints; 00095 double* _xAxisPoints; 00096 00097 double _sampleRate; 00098 00099 int64_t _numPoints; 00100 }; 00101 00102 #endif /* TIME_DOMAIN_DISPLAY_PLOT_HPP */