GNU Radio Manual and C++ API Reference  3.7.9.2
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
TimeDomainDisplayPlot.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2008-2012 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 TIME_DOMAIN_DISPLAY_PLOT_H
24 #define TIME_DOMAIN_DISPLAY_PLOT_H
25 
26 #include <stdint.h>
27 #include <cstdio>
28 #include <vector>
30 #include <gnuradio/tags.h>
31 
32 /*!
33  * \brief QWidget for displaying time domain plots.
34  * \ingroup qtgui_blk
35  */
37 {
38  Q_OBJECT
39 
40  Q_PROPERTY ( QColor tag_text_color READ getTagTextColor WRITE setTagTextColor )
41  Q_PROPERTY ( QColor tag_background_color READ getTagBackgroundColor WRITE setTagBackgroundColor )
42  Q_PROPERTY ( Qt::BrushStyle tag_background_style READ getTagBackgroundStyle WRITE setTagBackgroundStyle )
43 
44 public:
45  TimeDomainDisplayPlot(int nplots, QWidget*);
46  virtual ~TimeDomainDisplayPlot();
47 
48  void plotNewData(const std::vector<double*> dataPoints,
49  const int64_t numDataPoints, const double timeInterval,
50  const std::vector< std::vector<gr::tag_t> > &tags \
51  = std::vector< std::vector<gr::tag_t> >());
52 
53  void replot();
54 
55  void stemPlot(bool en);
56 
57  double sampleRate() const;
58 
59  const QColor getTagTextColor();
60  const QColor getTagBackgroundColor();
61  const Qt::BrushStyle getTagBackgroundStyle();
62 
63 public slots:
64  void setSampleRate(double sr, double units,
65  const std::string &strunits);
66 
67  void setAutoScale(bool state);
68  void setAutoScaleShot();
69  void setSemilogx(bool en);
70  void setSemilogy(bool en);
71 
72  void legendEntryChecked(QwtPlotItem *plotItem, bool on);
73  void legendEntryChecked(const QVariant &plotItem, bool on, int index);
74 
75  void enableTagMarker(int which, bool en);
76 
77  void setYLabel(const std::string &label,
78  const std::string &unit="");
79 
80  void attachTriggerLines(bool en);
81  void setTriggerLines(double x, double y);
82 
83  void setTagTextColor(QColor c);
84  void setTagBackgroundColor(QColor c);
85  void setTagBackgroundStyle(Qt::BrushStyle b);
86 
87 private:
88  void _resetXAxisPoints();
89  void _autoScale(double bottom, double top);
90 
91  std::vector<double*> d_ydata;
92  double* d_xdata;
93 
94  double d_sample_rate;
95 
96  bool d_semilogx;
97  bool d_semilogy;
98  bool d_autoscale_shot;
99 
100  std::vector< std::vector<QwtPlotMarker*> > d_tag_markers;
101  std::vector<bool> d_tag_markers_en;
102 
103  QColor d_tag_text_color;
104  QColor d_tag_background_color;
105  Qt::BrushStyle d_tag_background_style;
106 
107  QwtPlotMarker *d_trigger_lines[2];
108 };
109 
110 #endif /* TIME_DOMAIN_DISPLAY_PLOT_H */
void setAutoScale(bool state)
void setYLabel(const std::string &label, const std::string &unit="")
void setSemilogx(bool en)
void plotNewData(const std::vector< double * > dataPoints, const int64_t numDataPoints, const double timeInterval, const std::vector< std::vector< gr::tag_t > > &tags=std::vector< std::vector< gr::tag_t > >())
virtual ~TimeDomainDisplayPlot()
void attachTriggerLines(bool en)
QWidget base plot to build QTGUI plotting tools.
Definition: DisplayPlot.h:61
void setTagBackgroundStyle(Qt::BrushStyle b)
void setTagTextColor(QColor c)
const QColor getTagBackgroundColor()
TimeDomainDisplayPlot(int nplots, QWidget *)
const QColor getTagTextColor()
double sampleRate() const
void setTagBackgroundColor(QColor c)
void setSampleRate(double sr, double units, const std::string &strunits)
void stemPlot(bool en)
const Qt::BrushStyle getTagBackgroundStyle()
QWidget for displaying time domain plots.
Definition: TimeDomainDisplayPlot.h:36
void setTriggerLines(double x, double y)
void enableTagMarker(int which, bool en)
void setSemilogy(bool en)
void legendEntryChecked(QwtPlotItem *plotItem, bool on)