GNU Radio Manual and C++ API Reference 3.10.5.1
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
34public:
35 TimeDomainDisplayPlot(int nplots, QWidget*);
37
38 // Disable move/delete because of raw QT pointers.
43
44 void plotNewData(const std::vector<double*> dataPoints,
45 const int64_t numDataPoints,
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();
57 const QColor getTagBackgroundColor();
58 const Qt::BrushStyle getTagBackgroundStyle();
59
60public slots:
61 void setSampleRate(double sr, double units, const std::string& strunits);
62
63 void setAutoScale(bool state);
65 void setSemilogx(bool en);
66 void setSemilogy(bool en);
67
68 void legendEntryChecked(QwtPlotItem* plotItem, bool on) override;
69 void legendEntryChecked(const QVariant& plotItem, bool on, int index) override;
70
71 void enableTagMarker(unsigned int which, bool en);
72
73 void setYLabel(const std::string& label, const std::string& unit = "");
74
75 void attachTriggerLines(bool en);
76 void setTriggerLines(double x, double y);
77
78 void setTagTextColor(QColor c);
79 void setTagBackgroundColor(QColor c);
80 void setTagBackgroundStyle(Qt::BrushStyle b);
81
82private:
83 void _resetXAxisPoints();
84 void _autoScale(double bottom, double top);
85
86 std::vector<std::vector<double>> d_ydata;
87 std::vector<double> d_xdata;
88
89 double d_sample_rate;
90
91 bool d_semilogx;
92 bool d_semilogy;
93 bool d_autoscale_shot;
94
95 std::vector<std::vector<QwtPlotMarker*>> d_tag_markers;
96 std::vector<bool> d_tag_markers_en;
97
98 QColor d_tag_text_color = Qt::black;
99 QColor d_tag_background_color = Qt::white;
100 Qt::BrushStyle d_tag_background_style = Qt::NoBrush;
101
102 QwtPlotMarker* d_trigger_lines[2];
103};
104
105#endif /* TIME_DOMAIN_DISPLAY_PLOT_H */
QWidget base plot to build QTGUI plotting tools.
Definition: DisplayPlot.h:42
QWidget for displaying time domain plots.
Definition: TimeDomainDisplayPlot.h:25
TimeDomainDisplayPlot & operator=(TimeDomainDisplayPlot &&)=delete
void enableTagMarker(unsigned int which, bool en)
double sampleRate() const
void legendEntryChecked(QwtPlotItem *plotItem, bool on) override
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 > >())
void setSemilogy(bool en)
void setYLabel(const std::string &label, const std::string &unit="")
void stemPlot(bool en)
const QColor getTagTextColor()
void setSemilogx(bool en)
TimeDomainDisplayPlot & operator=(const TimeDomainDisplayPlot &)=delete
void setTagTextColor(QColor c)
TimeDomainDisplayPlot(int nplots, QWidget *)
TimeDomainDisplayPlot(TimeDomainDisplayPlot &&)=delete
void setTriggerLines(double x, double y)
QColor tag_text_color
Definition: TimeDomainDisplayPlot.h:28
void setSampleRate(double sr, double units, const std::string &strunits)
TimeDomainDisplayPlot(const TimeDomainDisplayPlot &)=delete
void legendEntryChecked(const QVariant &plotItem, bool on, int index) override
void setAutoScale(bool state)
void replot() override
QColor tag_background_color
Definition: TimeDomainDisplayPlot.h:30
void setTagBackgroundColor(QColor c)
~TimeDomainDisplayPlot() override
void attachTriggerLines(bool en)
void setTagBackgroundStyle(Qt::BrushStyle b)
const QColor getTagBackgroundColor()
const Qt::BrushStyle getTagBackgroundStyle()
Qt::BrushStyle tag_background_style
Definition: TimeDomainDisplayPlot.h:32