GNU Radio C++ API Reference 3.10.12.0
The Free & Open Software Radio Ecosystem
 
Loading...
Searching...
No Matches
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
33public:
34 EyeDisplayPlot(unsigned int nplots, unsigned int curve_index, QWidget* parent);
35 ~EyeDisplayPlot() override;
36
37 // Disable copy&move because of raw QT pointers.
40 EyeDisplayPlot& operator=(const EyeDisplayPlot&) = delete;
41 EyeDisplayPlot& operator=(EyeDisplayPlot&&) = delete;
42
43 void plotNewData(const std::vector<const double*> dataPoints,
44 const int64_t numDataPoints,
45 int d_sps,
46 const double timeInterval,
47 const std::vector<std::vector<gr::tag_t>>& tags =
48 std::vector<std::vector<gr::tag_t>>());
49
50 void replot() override;
51
52 void stemPlot(bool en);
53
54 double sampleRate() const;
55
56 const QColor getTagTextColor() const;
57 const QColor getTagBackgroundColor() const;
58 Qt::BrushStyle getTagBackgroundStyle() const;
59 void setLineColor(unsigned int which, QColor color) override;
60 void setLineWidth(unsigned int which, int width) override;
61 void setLineMarker(unsigned int which, QwtSymbol::Style marker) override;
62 void setLineStyle(unsigned int which, Qt::PenStyle style) override;
63 void setMarkerAlpha(unsigned int which, int alpha) override;
64
65public slots:
66 void setSampleRate(double sr, double units, const std::string& strunits);
67
68 void setAutoScale(bool state);
70
71 void legendEntryChecked(QwtPlotItem* plotItem, bool on) override;
72 void legendEntryChecked(const QVariant& plotItem, bool on, int index) override;
73
74 void enableTagMarker(unsigned int which, bool en);
75
76 void setYLabel(const std::string& label, const std::string& unit = "");
77
78 void attachTriggerLines(bool en);
79 void setTriggerLines(double x, double y);
80
81 void setTagTextColor(QColor c);
82 void setTagBackgroundColor(QColor c);
83 void setTagBackgroundStyle(Qt::BrushStyle b);
84
85 void setLineLabel(unsigned int which, QString label) override;
86
87private:
88 void _resetXAxisPoints();
89 void _autoScale(double bottom, double top);
90
91 std::vector<std::vector<double>> d_ydata;
92
93 std::vector<double> d_xdata;
94
95 double d_sample_rate;
96
97 unsigned int d_curve_index;
98 int d_sps = 4;
99 unsigned int d_numPointsPerPeriod = 2 * d_sps + 1;
100 unsigned int d_numPeriods;
101
102 bool d_autoscale_shot;
103
104 std::vector<std::vector<QwtPlotMarker*>> d_tag_markers;
105 std::vector<bool> d_tag_markers_en;
106
107 QList<QColor> colors;
108 QColor d_tag_text_color;
109 QColor d_tag_background_color;
110 Qt::BrushStyle d_tag_background_style;
111
112 QwtPlotMarker* d_trigger_lines[2];
113};
114
115#endif /* EYE_DISPLAY_PLOT_H */
QWidget base plot to build QTGUI plotting tools.
Definition DisplayPlot.h:42
QWidget for displaying eye pattern plots.
Definition EyeDisplayPlot.h:24
void enableTagMarker(unsigned int which, bool en)
Qt::BrushStyle getTagBackgroundStyle() const
const QColor getTagTextColor() const
void setYLabel(const std::string &label, const std::string &unit="")
void attachTriggerLines(bool en)
void setLineLabel(unsigned int which, QString label) override
void setTagBackgroundColor(QColor c)
void stemPlot(bool en)
const QColor getTagBackgroundColor() const
void setTagTextColor(QColor c)
void setTriggerLines(double x, double y)
void setAutoScale(bool state)
double sampleRate() const
void setLineMarker(unsigned int which, QwtSymbol::Style marker) override
void setLineStyle(unsigned int which, Qt::PenStyle style) override
void plotNewData(const std::vector< const 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 > >())
void replot() override
void setMarkerAlpha(unsigned int which, int alpha) override
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
QColor tag_background_color
Definition EyeDisplayPlot.h:29
void setLineWidth(unsigned int which, int width) override
GNU Radio logging wrapper.
Definition basic_block.h:29
STL namespace.