gr-baz Package
ConstellationDisplayPlot.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2008,2009,2010,2011 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef CONSTELLATION_DISPLAY_PLOT_HPP
24 #define CONSTELLATION_DISPLAY_PLOT_HPP
25 
26 #include <stdint.h>
27 #include <cstdio>
28 #include <qwt_plot.h>
29 #include <qwt_painter.h>
30 #include <qwt_plot_canvas.h>
31 #include <qwt_plot_curve.h>
32 #include <qwt_scale_engine.h>
33 #include <qwt_scale_widget.h>
34 #include <qwt_plot_zoomer.h>
35 #include <qwt_plot_panner.h>
36 #include <qwt_plot_marker.h>
37 #include <gruel/high_res_timer.h>
38 #include <qwt_symbol.h>
39 #include <qtgui_util.h>
40 
41 #if QWT_VERSION >= 0x060000
42 #include <qwt_point_3d.h> // doesn't seem necessary, but is...
43 #include <qwt_compat.h>
44 #endif
45 
46 class ConstellationDisplayPlot : public QwtPlot
47 {
48  Q_OBJECT
49 
50 public:
51  ConstellationDisplayPlot(QWidget*);
52  virtual ~ConstellationDisplayPlot();
53 
54  void PlotNewData(const double* realDataPoints,
55  const double* imagDataPoints,
56  const int64_t numDataPoints,
57  const double timeInterval);
58 
59  virtual void replot();
60 
61  void set_xaxis(double min, double max);
62  void set_yaxis(double min, double max);
63  void set_axis(double xmin, double xmax,
64  double ymin, double ymax);
65  void set_pen_size(int size);
66 
67 public slots:
68  void resizeSlot( QSize *s );
69 
70  // Because of the preprocessing of slots in QT, these are no
71  // easily separated by the version check. Make one for each
72  // version until it's worked out.
73  void OnPickerPointSelected(const QwtDoublePoint & p);
74  void OnPickerPointSelected6(const QPointF & p);
75 
76 signals:
77  void plotPointSelected(const QPointF p);
78 
79 protected slots:
80  void LegendEntryChecked(QwtPlotItem *plotItem, bool on);
81 
82 protected:
83 
84 private:
85  QwtPlotCurve* _plot_curve;
86 
87  QwtPlotPanner* _panner;
88  QwtPlotZoomer* _zoomer;
89 
90  QwtDblClickPlotPicker *_picker;
91 
92  double* _realDataPoints;
93  double* _imagDataPoints;
94 
95  gruel::high_res_timer_type _lastReplot;
96 
97  int64_t _numPoints;
98  int64_t _penSize;
99 };
100 
101 #endif /* CONSTELLATION_DISPLAY_PLOT_HPP */