GNU Radio Manual and C++ API Reference  3.8.2.0
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  * 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 EYE_DISPLAY_PLOT_H
24 #define EYE_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 eye pattern 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  EyeDisplayPlot(unsigned int nplots, unsigned int curve_index, QWidget* parent);
48  virtual ~EyeDisplayPlot();
49 
50  void plotNewData(const std::vector<double*> dataPoints,
51  const int64_t numDataPoints,
52  int d_sps,
53  const double timeInterval,
54  const std::vector<std::vector<gr::tag_t>>& tags =
55  std::vector<std::vector<gr::tag_t>>());
56 
57  void replot();
58 
59  void stemPlot(bool en);
60 
61  double sampleRate() const;
62 
63  const QColor getTagTextColor();
64  const QColor getTagBackgroundColor();
65  const Qt::BrushStyle getTagBackgroundStyle();
66  void setLineColor(unsigned int which, QColor color);
67  void setLineWidth(unsigned int which, int width);
68  void setLineMarker(unsigned int which, QwtSymbol::Style marker);
69  void setLineStyle(unsigned int which, Qt::PenStyle style);
70  void setMarkerAlpha(unsigned int which, int alpha);
71 
72 public slots:
73  void setSampleRate(double sr, double units, const std::string& strunits);
74 
75  void setAutoScale(bool state);
77 
78  void legendEntryChecked(QwtPlotItem* plotItem, bool on);
79  void legendEntryChecked(const QVariant& plotItem, bool on, int index);
80 
81  void enableTagMarker(unsigned int which, bool en);
82 
83  void setYLabel(const std::string& label, const std::string& unit = "");
84 
85  void attachTriggerLines(bool en);
86  void setTriggerLines(double x, double y);
87 
88  void setTagTextColor(QColor c);
89  void setTagBackgroundColor(QColor c);
90  void setTagBackgroundStyle(Qt::BrushStyle b);
91 
92  void setLineLabel(unsigned int which, QString label);
93 
94 private:
95  void _resetXAxisPoints();
96  void _autoScale(double bottom, double top);
97 
98  std::vector<double*> d_ydata;
99 
100  double* d_xdata;
101 
102  double d_sample_rate;
103 
104  unsigned int d_curve_index;
105  unsigned int nplots;
106  int d_sps;
107  unsigned int d_numPointsPerPeriod;
108  unsigned int d_numPeriods;
109 
110  bool d_autoscale_shot;
111 
112  std::vector<std::vector<QwtPlotMarker*>> d_tag_markers;
113  std::vector<bool> d_tag_markers_en;
114 
115  QList<QColor> colors;
116  QColor d_tag_text_color;
117  QColor d_tag_background_color;
118  Qt::BrushStyle d_tag_background_style;
119 
120  QwtPlotMarker* d_trigger_lines[2];
121 };
122 
123 #endif /* EYE_DISPLAY_PLOT_H */
EyeDisplayPlot::setTagBackgroundStyle
void setTagBackgroundStyle(Qt::BrushStyle b)
EyeDisplayPlot::tag_background_color
QColor tag_background_color
Definition: EyeDisplayPlot.h:42
EyeDisplayPlot::setLineStyle
void setLineStyle(unsigned int which, Qt::PenStyle style)
EyeDisplayPlot::setTagBackgroundColor
void setTagBackgroundColor(QColor c)
EyeDisplayPlot::setMarkerAlpha
void setMarkerAlpha(unsigned int which, int alpha)
DisplayPlot.h
EyeDisplayPlot::getTagTextColor
const QColor getTagTextColor()
EyeDisplayPlot::setLineColor
void setLineColor(unsigned int which, QColor color)
tags.h
EyeDisplayPlot::sampleRate
double sampleRate() const
EyeDisplayPlot::setSampleRate
void setSampleRate(double sr, double units, const std::string &strunits)
EyeDisplayPlot::setLineLabel
void setLineLabel(unsigned int which, QString label)
EyeDisplayPlot::tag_text_color
QColor tag_text_color
Definition: EyeDisplayPlot.h:40
EyeDisplayPlot::setAutoScaleShot
void setAutoScaleShot()
DisplayPlot
QWidget base plot to build QTGUI plotting tools.
Definition: DisplayPlot.h:62
EyeDisplayPlot
QWidget for displaying eye pattern plots.
Definition: EyeDisplayPlot.h:37
EyeDisplayPlot::~EyeDisplayPlot
virtual ~EyeDisplayPlot()
EyeDisplayPlot::legendEntryChecked
void legendEntryChecked(const QVariant &plotItem, bool on, int index)
EyeDisplayPlot::setLineMarker
void setLineMarker(unsigned int which, QwtSymbol::Style marker)
EyeDisplayPlot::setTagTextColor
void setTagTextColor(QColor c)
EyeDisplayPlot::plotNewData
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 >>())
EyeDisplayPlot::replot
void replot()
EyeDisplayPlot::tag_background_style
Qt::BrushStyle tag_background_style
Definition: EyeDisplayPlot.h:44
EyeDisplayPlot::legendEntryChecked
void legendEntryChecked(QwtPlotItem *plotItem, bool on)
EyeDisplayPlot::setLineWidth
void setLineWidth(unsigned int which, int width)
EyeDisplayPlot::attachTriggerLines
void attachTriggerLines(bool en)
EyeDisplayPlot::setAutoScale
void setAutoScale(bool state)
EyeDisplayPlot::getTagBackgroundStyle
const Qt::BrushStyle getTagBackgroundStyle()
EyeDisplayPlot::setTriggerLines
void setTriggerLines(double x, double y)
EyeDisplayPlot::EyeDisplayPlot
EyeDisplayPlot(unsigned int nplots, unsigned int curve_index, QWidget *parent)
EyeDisplayPlot::enableTagMarker
void enableTagMarker(unsigned int which, bool en)
EyeDisplayPlot::getTagBackgroundColor
const QColor getTagBackgroundColor()
EyeDisplayPlot::stemPlot
void stemPlot(bool en)
EyeDisplayPlot::setYLabel
void setYLabel(const std::string &label, const std::string &unit="")