GNU Radio 3.4.2 C++ API
ConstellationDisplayPlot.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 CONSTELLATION_DISPLAY_PLOT_HPP
00024 #define CONSTELLATION_DISPLAY_PLOT_HPP
00025 
00026 #include <stdint.h>
00027 #include <cstdio>
00028 #include <qwt_plot.h>
00029 #include <qwt_painter.h>
00030 #include <qwt_plot_canvas.h>
00031 #include <qwt_plot_curve.h>
00032 #include <qwt_scale_engine.h>
00033 #include <qwt_scale_widget.h>
00034 #include <qwt_plot_zoomer.h>
00035 #include <qwt_plot_panner.h>
00036 #include <qwt_plot_marker.h>
00037 #include <gruel/high_res_timer.h>
00038 #include <qwt_symbol.h>
00039 #include <qtgui_util.h>
00040 
00041 #if QWT_VERSION >= 0x060000
00042 #include <qwt_point_3d.h>  // doesn't seem necessary, but is...
00043 #include <qwt_compat.h>
00044 #endif
00045 
00046 class ConstellationDisplayPlot : public QwtPlot
00047 {
00048   Q_OBJECT
00049 
00050 public:
00051   ConstellationDisplayPlot(QWidget*);
00052   virtual ~ConstellationDisplayPlot();
00053 
00054   void PlotNewData(const double* realDataPoints, 
00055                    const double* imagDataPoints, 
00056                    const int64_t numDataPoints,
00057                    const double timeInterval);
00058     
00059   virtual void replot();
00060 
00061   void set_xaxis(double min, double max);
00062   void set_yaxis(double min, double max);
00063   void set_axis(double xmin, double xmax,
00064                 double ymin, double ymax);
00065   void set_pen_size(int size);
00066 
00067 public slots:
00068   void resizeSlot( QSize *s );
00069 
00070 #if QWT_VERSION < 0x060000
00071   void OnPickerPointSelected(const QwtDoublePoint & p);
00072 #else
00073   void OnPickerPointSelected(const QPointF & p);
00074 #endif
00075 
00076 signals:
00077   void plotPointSelected(const QPointF p);
00078 
00079 protected slots:
00080   void LegendEntryChecked(QwtPlotItem *plotItem, bool on);
00081 
00082 protected:
00083 
00084 private:
00085   QwtPlotCurve* _plot_curve;
00086 
00087   QwtPlotPanner* _panner;
00088   QwtPlotZoomer* _zoomer;
00089   
00090   QwtDblClickPlotPicker *_picker;
00091 
00092   double* _realDataPoints;
00093   double* _imagDataPoints;
00094 
00095   gruel::high_res_timer_type _lastReplot;
00096 
00097   int64_t _numPoints;
00098   int64_t _penSize;
00099 };
00100 
00101 #endif /* CONSTELLATION_DISPLAY_PLOT_HPP */