GNU Radio Manual and C++ API Reference  3.9.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  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 
11 #ifndef TIME_DOMAIN_DISPLAY_PLOT_H
12 #define TIME_DOMAIN_DISPLAY_PLOT_H
13 
15 #include <gnuradio/tags.h>
16 #include <cstdint>
17 #include <cstdio>
18 #include <vector>
19 
20 /*!
21  * \brief QWidget for displaying time domain plots.
22  * \ingroup qtgui_blk
23  */
25 {
26  Q_OBJECT
27 
28  Q_PROPERTY(QColor tag_text_color READ getTagTextColor WRITE setTagTextColor)
29  Q_PROPERTY(QColor tag_background_color READ getTagBackgroundColor WRITE
31  Q_PROPERTY(Qt::BrushStyle tag_background_style READ getTagBackgroundStyle WRITE
33 
34 public:
35  TimeDomainDisplayPlot(int nplots, QWidget*);
36  ~TimeDomainDisplayPlot() override;
37 
38  void plotNewData(const std::vector<double*> dataPoints,
39  const int64_t numDataPoints,
40  const double timeInterval,
41  const std::vector<std::vector<gr::tag_t>>& tags =
42  std::vector<std::vector<gr::tag_t>>());
43 
44  void replot() override;
45 
46  void stemPlot(bool en);
47 
48  double sampleRate() const;
49 
50  const QColor getTagTextColor();
51  const QColor getTagBackgroundColor();
52  const Qt::BrushStyle getTagBackgroundStyle();
53 
54 public slots:
55  void setSampleRate(double sr, double units, const std::string& strunits);
56 
57  void setAutoScale(bool state);
58  void setAutoScaleShot();
59  void setSemilogx(bool en);
60  void setSemilogy(bool en);
61 
62  void legendEntryChecked(QwtPlotItem* plotItem, bool on) override;
63  void legendEntryChecked(const QVariant& plotItem, bool on, int index) override;
64 
65  void enableTagMarker(unsigned int which, bool en);
66 
67  void setYLabel(const std::string& label, const std::string& unit = "");
68 
69  void attachTriggerLines(bool en);
70  void setTriggerLines(double x, double y);
71 
72  void setTagTextColor(QColor c);
73  void setTagBackgroundColor(QColor c);
74  void setTagBackgroundStyle(Qt::BrushStyle b);
75 
76 private:
77  void _resetXAxisPoints();
78  void _autoScale(double bottom, double top);
79 
80  std::vector<double*> d_ydata;
81  double* d_xdata;
82 
83  double d_sample_rate;
84 
85  bool d_semilogx;
86  bool d_semilogy;
87  bool d_autoscale_shot;
88 
89  std::vector<std::vector<QwtPlotMarker*>> d_tag_markers;
90  std::vector<bool> d_tag_markers_en;
91 
92  QColor d_tag_text_color;
93  QColor d_tag_background_color;
94  Qt::BrushStyle d_tag_background_style;
95 
96  QwtPlotMarker* d_trigger_lines[2];
97 };
98 
99 #endif /* TIME_DOMAIN_DISPLAY_PLOT_H */
TimeDomainDisplayPlot::setYLabel
void setYLabel(const std::string &label, const std::string &unit="")
TimeDomainDisplayPlot::legendEntryChecked
void legendEntryChecked(QwtPlotItem *plotItem, bool on) override
TimeDomainDisplayPlot::TimeDomainDisplayPlot
TimeDomainDisplayPlot(int nplots, QWidget *)
DisplayPlot.h
TimeDomainDisplayPlot::setTagTextColor
void setTagTextColor(QColor c)
tags.h
TimeDomainDisplayPlot::sampleRate
double sampleRate() const
TimeDomainDisplayPlot::setTagBackgroundStyle
void setTagBackgroundStyle(Qt::BrushStyle b)
TimeDomainDisplayPlot::tag_background_color
QColor tag_background_color
Definition: TimeDomainDisplayPlot.h:30
TimeDomainDisplayPlot::setTagBackgroundColor
void setTagBackgroundColor(QColor c)
TimeDomainDisplayPlot::setSemilogy
void setSemilogy(bool en)
TimeDomainDisplayPlot::tag_background_style
Qt::BrushStyle tag_background_style
Definition: TimeDomainDisplayPlot.h:32
TimeDomainDisplayPlot::stemPlot
void stemPlot(bool en)
DisplayPlot
QWidget base plot to build QTGUI plotting tools.
Definition: DisplayPlot.h:49
TimeDomainDisplayPlot::setSemilogx
void setSemilogx(bool en)
TimeDomainDisplayPlot::setAutoScaleShot
void setAutoScaleShot()
TimeDomainDisplayPlot::plotNewData
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 >>())
TimeDomainDisplayPlot
QWidget for displaying time domain plots.
Definition: TimeDomainDisplayPlot.h:24
TimeDomainDisplayPlot::getTagTextColor
const QColor getTagTextColor()
TimeDomainDisplayPlot::enableTagMarker
void enableTagMarker(unsigned int which, bool en)
TimeDomainDisplayPlot::replot
void replot() override
TimeDomainDisplayPlot::setSampleRate
void setSampleRate(double sr, double units, const std::string &strunits)
TimeDomainDisplayPlot::tag_text_color
QColor tag_text_color
Definition: TimeDomainDisplayPlot.h:28
TimeDomainDisplayPlot::setAutoScale
void setAutoScale(bool state)
TimeDomainDisplayPlot::getTagBackgroundColor
const QColor getTagBackgroundColor()
TimeDomainDisplayPlot::getTagBackgroundStyle
const Qt::BrushStyle getTagBackgroundStyle()
TimeDomainDisplayPlot::attachTriggerLines
void attachTriggerLines(bool en)
TimeDomainDisplayPlot::setTriggerLines
void setTriggerLines(double x, double y)
TimeDomainDisplayPlot::~TimeDomainDisplayPlot
~TimeDomainDisplayPlot() override