GNU Radio C++ API Reference: EyeDisplayPlot.h Source File

| 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
13#include <gnuradio/qtgui/DisplayPlot.h>
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 */
23 class EyeDisplayPlot : public DisplayPlot
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
29 setTagBackgroundColor)
30 Q_PROPERTY(Qt::BrushStyle tag_background_style READ getTagBackgroundStyle WRITE
31 setTagBackgroundStyle)
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.
38 EyeDisplayPlot(const EyeDisplayPlot&) = delete;
39 EyeDisplayPlot(EyeDisplayPlot&&) = delete;
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);
69 void setAutoScaleShot();
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 */
DisplayPlot.h
DisplayPlot::DisplayPlot
DisplayPlot(int nplots, QWidget *)
EyeDisplayPlot::enableTagMarker
void enableTagMarker(unsigned int which, bool en)
EyeDisplayPlot::getTagBackgroundStyle
Qt::BrushStyle getTagBackgroundStyle() const
EyeDisplayPlot::getTagTextColor
const QColor getTagTextColor() const
EyeDisplayPlot::setYLabel
void setYLabel(const std::string &label, const std::string &unit="")
EyeDisplayPlot::attachTriggerLines
void attachTriggerLines(bool en)
EyeDisplayPlot::setLineLabel
void setLineLabel(unsigned int which, QString label) override
EyeDisplayPlot::setTagBackgroundColor
void setTagBackgroundColor(QColor c)
EyeDisplayPlot::stemPlot
void stemPlot(bool en)
EyeDisplayPlot::getTagBackgroundColor
const QColor getTagBackgroundColor() const
EyeDisplayPlot::setTagTextColor
void setTagTextColor(QColor c)
EyeDisplayPlot::setTriggerLines
void setTriggerLines(double x, double y)
EyeDisplayPlot::setAutoScale
void setAutoScale(bool state)
EyeDisplayPlot::sampleRate
double sampleRate() const
EyeDisplayPlot::setLineMarker
void setLineMarker(unsigned int which, QwtSymbol::Style marker) override
EyeDisplayPlot::setLineStyle
void setLineStyle(unsigned int which, Qt::PenStyle style) override
EyeDisplayPlot::plotNewData
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 > >())
EyeDisplayPlot::replot
void replot() override
EyeDisplayPlot::setMarkerAlpha
void setMarkerAlpha(unsigned int which, int alpha) override
EyeDisplayPlot::setAutoScaleShot
void setAutoScaleShot()
EyeDisplayPlot::setSampleRate
void setSampleRate(double sr, double units, const std::string &strunits)
EyeDisplayPlot::tag_background_style
Qt::BrushStyle tag_background_style
Definition EyeDisplayPlot.h:29
EyeDisplayPlot::setTagBackgroundStyle
void setTagBackgroundStyle(Qt::BrushStyle b)
EyeDisplayPlot::setLineColor
void setLineColor(unsigned int which, QColor color) override
EyeDisplayPlot::legendEntryChecked
void legendEntryChecked(QwtPlotItem *plotItem, bool on) override
EyeDisplayPlot::tag_text_color
QColor tag_text_color
Definition EyeDisplayPlot.h:27
EyeDisplayPlot::EyeDisplayPlot
EyeDisplayPlot(unsigned int nplots, unsigned int curve_index, QWidget *parent)
EyeDisplayPlot::tag_background_color
QColor tag_background_color
Definition EyeDisplayPlot.h:28
EyeDisplayPlot::setLineWidth
void setLineWidth(unsigned int which, int width) override
gr
GNU Radio logging wrapper.
Definition basic_block.h:29
std
STL namespace.
tags.h