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

| GNU Radio C++ API Reference 3.10.12.0 The Free & Open Software Radio Ecosystem |

Loading...
Searching...
No Matches
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
14#include <gnuradio/qtgui/DisplayPlot.h>
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 */
24 class TimeDomainDisplayPlot : public DisplayPlot
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
30 setTagBackgroundColor)
31 Q_PROPERTY(Qt::BrushStyle tag_background_style READ getTagBackgroundStyle WRITE
32 setTagBackgroundStyle)
33
34public:
35 TimeDomainDisplayPlot(int nplots, QWidget*);
36 ~TimeDomainDisplayPlot() override;
37
38 // Disable move/delete because of raw QT pointers.
39 TimeDomainDisplayPlot(const TimeDomainDisplayPlot&) = delete;
40 TimeDomainDisplayPlot(TimeDomainDisplayPlot&&) = delete;
41 TimeDomainDisplayPlot& operator=(const TimeDomainDisplayPlot&) = delete;
42 TimeDomainDisplayPlot& operator=(TimeDomainDisplayPlot&&) = delete;
43
44 void plotNewData(const std::vector<const 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() const;
57 const QColor getTagBackgroundColor() const;
58 Qt::BrushStyle getTagBackgroundStyle() const;
59
60public slots:
61 void setSampleRate(double sr, double units, const std::string& strunits);
62
63 void setAutoScale(bool state);
64 void setAutoScaleShot();
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 */
DisplayPlot.h
DisplayPlot::DisplayPlot
DisplayPlot(int nplots, QWidget *)
TimeDomainDisplayPlot::getTagBackgroundColor
const QColor getTagBackgroundColor() const
TimeDomainDisplayPlot::plotNewData
void plotNewData(const std::vector< const 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 > >())
TimeDomainDisplayPlot::enableTagMarker
void enableTagMarker(unsigned int which, bool en)
TimeDomainDisplayPlot::sampleRate
double sampleRate() const
TimeDomainDisplayPlot::legendEntryChecked
void legendEntryChecked(QwtPlotItem *plotItem, bool on) override
TimeDomainDisplayPlot::setSemilogy
void setSemilogy(bool en)
TimeDomainDisplayPlot::getTagBackgroundStyle
Qt::BrushStyle getTagBackgroundStyle() const
TimeDomainDisplayPlot::setYLabel
void setYLabel(const std::string &label, const std::string &unit="")
TimeDomainDisplayPlot::stemPlot
void stemPlot(bool en)
TimeDomainDisplayPlot::setSemilogx
void setSemilogx(bool en)
TimeDomainDisplayPlot::setTagTextColor
void setTagTextColor(QColor c)
TimeDomainDisplayPlot::TimeDomainDisplayPlot
TimeDomainDisplayPlot(int nplots, QWidget *)
TimeDomainDisplayPlot::setTriggerLines
void setTriggerLines(double x, double y)
TimeDomainDisplayPlot::tag_text_color
QColor tag_text_color
Definition TimeDomainDisplayPlot.h:28
TimeDomainDisplayPlot::setSampleRate
void setSampleRate(double sr, double units, const std::string &strunits)
TimeDomainDisplayPlot::setAutoScale
void setAutoScale(bool state)
TimeDomainDisplayPlot::replot
void replot() override
TimeDomainDisplayPlot::tag_background_color
QColor tag_background_color
Definition TimeDomainDisplayPlot.h:29
TimeDomainDisplayPlot::getTagTextColor
const QColor getTagTextColor() const
TimeDomainDisplayPlot::setTagBackgroundColor
void setTagBackgroundColor(QColor c)
TimeDomainDisplayPlot::attachTriggerLines
void attachTriggerLines(bool en)
TimeDomainDisplayPlot::setTagBackgroundStyle
void setTagBackgroundStyle(Qt::BrushStyle b)
TimeDomainDisplayPlot::setAutoScaleShot
void setAutoScaleShot()
TimeDomainDisplayPlot::tag_background_style
Qt::BrushStyle tag_background_style
Definition TimeDomainDisplayPlot.h:30
gr
GNU Radio logging wrapper.
Definition basic_block.h:29
std
STL namespace.
tags.h