GNU Radio Manual and C++ API Reference  3.8.1.0
The Free & Open Software Radio Ecosystem
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 
27 #include <gnuradio/tags.h>
28 #include <stdint.h>
29 #include <cstdio>
30 #include <vector>
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
43  Q_PROPERTY(Qt::BrushStyle tag_background_style READ getTagBackgroundStyle WRITE
45 
46 public:
47  TimeDomainDisplayPlot(int nplots, QWidget*);
48  virtual ~TimeDomainDisplayPlot();
49 
50  void plotNewData(const std::vector<double*> dataPoints,
51  const int64_t numDataPoints,
52  const double timeInterval,
53  const std::vector<std::vector<gr::tag_t>>& tags =
54  std::vector<std::vector<gr::tag_t>>());
55 
56  void replot();
57 
58  void stemPlot(bool en);
59 
60  double sampleRate() const;
61 
62  const QColor getTagTextColor();
63  const QColor getTagBackgroundColor();
64  const Qt::BrushStyle getTagBackgroundStyle();
65 
66 public slots:
67  void setSampleRate(double sr, double units, const std::string& strunits);
68 
69  void setAutoScale(bool state);
70  void setAutoScaleShot();
71  void setSemilogx(bool en);
72  void setSemilogy(bool en);
73 
74  void legendEntryChecked(QwtPlotItem* plotItem, bool on);
75  void legendEntryChecked(const QVariant& plotItem, bool on, int index);
76 
77  void enableTagMarker(unsigned int which, bool en);
78 
79  void setYLabel(const std::string& label, const std::string& unit = "");
80 
81  void attachTriggerLines(bool en);
82  void setTriggerLines(double x, double y);
83 
84  void setTagTextColor(QColor c);
85  void setTagBackgroundColor(QColor c);
86  void setTagBackgroundStyle(Qt::BrushStyle b);
87 
88 private:
89  void _resetXAxisPoints();
90  void _autoScale(double bottom, double top);
91 
92  std::vector<double*> d_ydata;
93  double* d_xdata;
94 
95  double d_sample_rate;
96 
97  bool d_semilogx;
98  bool d_semilogy;
99  bool d_autoscale_shot;
100 
101  std::vector<std::vector<QwtPlotMarker*>> d_tag_markers;
102  std::vector<bool> d_tag_markers_en;
103 
104  QColor d_tag_text_color;
105  QColor d_tag_background_color;
106  Qt::BrushStyle d_tag_background_style;
107 
108  QwtPlotMarker* d_trigger_lines[2];
109 };
110 
111 #endif /* TIME_DOMAIN_DISPLAY_PLOT_H */
void setAutoScale(bool state)
void setYLabel(const std::string &label, const std::string &unit="")
void setSemilogx(bool en)
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()
QColor tag_text_color
Definition: TimeDomainDisplayPlot.h:40
void setTagBackgroundColor(QColor c)
void setSampleRate(double sr, double units, const std::string &strunits)
QColor tag_background_color
Definition: TimeDomainDisplayPlot.h:42
void stemPlot(bool en)
const Qt::BrushStyle getTagBackgroundStyle()
QWidget for displaying time domain plots.
Definition: TimeDomainDisplayPlot.h:36
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 >>())
void enableTagMarker(unsigned int which, bool en)
double sampleRate() const
void setTriggerLines(double x, double y)
void setSemilogy(bool en)
void legendEntryChecked(QwtPlotItem *plotItem, bool on)
Qt::BrushStyle tag_background_style
Definition: TimeDomainDisplayPlot.h:44