GNU Radio Manual and C++ API Reference  v3.9.2.0-89-gb7c7001e
The Free & Open Software Radio Ecosystem
EyeDisplayPlot.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2020 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 #ifndef EYE_DISPLAY_PLOT_H
11 #define EYE_DISPLAY_PLOT_H
12 
14 #include <gnuradio/tags.h>
15 #include <cstdint>
16 #include <cstdio>
17 #include <vector>
18 
19 /*!
20  * \brief QWidget for displaying eye pattern plots.
21  * \ingroup qtgui_blk
22  */
24 {
25  Q_OBJECT
26 
27  Q_PROPERTY(QColor tag_text_color READ getTagTextColor WRITE setTagTextColor)
28  Q_PROPERTY(QColor tag_background_color READ getTagBackgroundColor WRITE
30  Q_PROPERTY(Qt::BrushStyle tag_background_style READ getTagBackgroundStyle WRITE
32 
33 public:
34  EyeDisplayPlot(unsigned int nplots, unsigned int curve_index, QWidget* parent);
35  ~EyeDisplayPlot() override;
36 
37  void plotNewData(const std::vector<double*> dataPoints,
38  const int64_t numDataPoints,
39  int d_sps,
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  void setLineColor(unsigned int which, QColor color) override;
54  void setLineWidth(unsigned int which, int width) override;
55  void setLineMarker(unsigned int which, QwtSymbol::Style marker) override;
56  void setLineStyle(unsigned int which, Qt::PenStyle style) override;
57  void setMarkerAlpha(unsigned int which, int alpha) override;
58 
59 public slots:
60  void setSampleRate(double sr, double units, const std::string& strunits);
61 
62  void setAutoScale(bool state);
64 
65  void legendEntryChecked(QwtPlotItem* plotItem, bool on) override;
66  void legendEntryChecked(const QVariant& plotItem, bool on, int index) override;
67 
68  void enableTagMarker(unsigned int which, bool en);
69 
70  void setYLabel(const std::string& label, const std::string& unit = "");
71 
72  void attachTriggerLines(bool en);
73  void setTriggerLines(double x, double y);
74 
75  void setTagTextColor(QColor c);
76  void setTagBackgroundColor(QColor c);
77  void setTagBackgroundStyle(Qt::BrushStyle b);
78 
79  void setLineLabel(unsigned int which, QString label) override;
80 
81 private:
82  void _resetXAxisPoints();
83  void _autoScale(double bottom, double top);
84 
85  std::vector<double*> d_ydata;
86 
87  double* d_xdata;
88 
89  double d_sample_rate;
90 
91  unsigned int d_curve_index;
92  unsigned int nplots;
93  int d_sps;
94  unsigned int d_numPointsPerPeriod;
95  unsigned int d_numPeriods;
96 
97  bool d_autoscale_shot;
98 
99  std::vector<std::vector<QwtPlotMarker*>> d_tag_markers;
100  std::vector<bool> d_tag_markers_en;
101 
102  QList<QColor> colors;
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 /* EYE_DISPLAY_PLOT_H */
QWidget base plot to build QTGUI plotting tools.
Definition: DisplayPlot.h:50
QWidget for displaying eye pattern plots.
Definition: EyeDisplayPlot.h:24
void enableTagMarker(unsigned int which, bool en)
~EyeDisplayPlot() override
void setYLabel(const std::string &label, const std::string &unit="")
void attachTriggerLines(bool en)
const QColor getTagBackgroundColor()
void setLineLabel(unsigned int which, QString label) override
void setTagBackgroundColor(QColor c)
void stemPlot(bool en)
void setTagTextColor(QColor c)
void setTriggerLines(double x, double y)
void setAutoScale(bool state)
void plotNewData(const std::vector< double * > dataPoints, const int64_t numDataPoints, int d_sps, const double timeInterval, const std::vector< std::vector< gr::tag_t >> &tags=std::vector< std::vector< gr::tag_t >>())
double sampleRate() const
const Qt::BrushStyle getTagBackgroundStyle()
void setLineMarker(unsigned int which, QwtSymbol::Style marker) override
void legendEntryChecked(const QVariant &plotItem, bool on, int index) override
void setLineStyle(unsigned int which, Qt::PenStyle style) override
void replot() override
void setMarkerAlpha(unsigned int which, int alpha) override
const QColor getTagTextColor()
void setAutoScaleShot()
void setSampleRate(double sr, double units, const std::string &strunits)
Qt::BrushStyle tag_background_style
Definition: EyeDisplayPlot.h:31
void setTagBackgroundStyle(Qt::BrushStyle b)
void setLineColor(unsigned int which, QColor color) override
void legendEntryChecked(QwtPlotItem *plotItem, bool on) override
QColor tag_text_color
Definition: EyeDisplayPlot.h:27
EyeDisplayPlot(unsigned int nplots, unsigned int curve_index, QWidget *parent)
QColor tag_background_color
Definition: EyeDisplayPlot.h:29
void setLineWidth(unsigned int which, int width) override