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

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

Loading...
Searching...
No Matches
VectorDisplayPlot.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2014 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 VECTOR_DISPLAY_PLOT_HPP
12#define VECTOR_DISPLAY_PLOT_HPP
13
14#include <gnuradio/qtgui/DisplayPlot.h>
15#include <cstdint>
16#include <cstdio>
17#include <vector>
18
19/*!
20 * \brief QWidget for displaying 1D-vector plots.
21 * \ingroup qtgui_blk
22 */
23 class VectorDisplayPlot : public DisplayPlot
24{
25 Q_OBJECT
26
27 Q_PROPERTY(QColor min_vec_color READ getMinVecColor WRITE setMinVecColor)
28 Q_PROPERTY(QColor max_vec_color READ getMaxVecColor WRITE setMaxVecColor)
29 Q_PROPERTY(bool min_vec_visible READ getMinVecVisible WRITE setMinVecVisible)
30 Q_PROPERTY(bool max_vec_visible READ getMaxVecVisible WRITE setMaxVecVisible)
31 Q_PROPERTY(QColor marker_lower_intensity_color READ getMarkerLowerIntensityColor WRITE
32 setMarkerLowerIntensityColor)
33 Q_PROPERTY(bool marker_lower_intensity_visible READ getMarkerLowerIntensityVisible
34 WRITE setMarkerLowerIntensityVisible)
35 Q_PROPERTY(QColor marker_upper_intensity_color READ getMarkerUpperIntensityColor WRITE
36 setMarkerUpperIntensityColor)
37 Q_PROPERTY(bool marker_upper_intensity_visible READ getMarkerUpperIntensityVisible
38 WRITE setMarkerUpperIntensityVisible)
39 Q_PROPERTY(QColor marker_ref_level_color READ getMarkerRefLevelAmplitudeColor WRITE
40 setMarkerRefLevelAmplitudeColor)
41 Q_PROPERTY(bool marker_ref_level_visible READ getMarkerRefLevelAmplitudeVisible WRITE
42 setMarkerRefLevelAmplitudeVisible)
43
44public:
45 VectorDisplayPlot(int nplots, QWidget*);
46 ~VectorDisplayPlot() override;
47
48 // Disable move/copy because of raw QT pointers.
49 VectorDisplayPlot(const VectorDisplayPlot&) = delete;
50 VectorDisplayPlot(VectorDisplayPlot&&) = delete;
51 VectorDisplayPlot& operator=(const VectorDisplayPlot&) = delete;
52 VectorDisplayPlot& operator=(VectorDisplayPlot&&) = delete;
53
54 void setXAxisValues(const double start, const double step = 1.0);
55
56 void plotNewData(const std::vector<const double*> dataPoints,
57 const int64_t numDataPoints,
58 const double refLevel,
59 const double timeInterval);
60
61 void clearMaxData();
62 void clearMinData();
63
64 void replot() override;
65
66 void setYaxis(double min, double max) override;
67 double getYMin() const;
68 double getYMax() const;
69
70 void setXAxisLabel(const QString& label);
71 void setYAxisLabel(const QString& label);
72
73 void setXAxisUnit(const QString& unit);
74 void setYAxisUnit(const QString& unit);
75
76 void setTraceColour(QColor);
77 void setBGColour(QColor c);
78
79 bool getMaxVecVisible() const;
80 bool getMinVecVisible() const;
81 const QColor getMinVecColor() const;
82 const QColor getMaxVecColor() const;
83 const QColor getMarkerLowerIntensityColor() const;
84 bool getMarkerLowerIntensityVisible() const;
85 const QColor getMarkerUpperIntensityColor() const;
86 bool getMarkerUpperIntensityVisible() const;
87 bool getMarkerRefLevelAmplitudeVisible() const;
88 const QColor getMarkerRefLevelAmplitudeColor() const;
89
90public slots:
91 void setMaxVecVisible(const bool);
92 void setMinVecVisible(const bool);
93 void setMinVecColor(QColor c);
94 void setMaxVecColor(QColor c);
95 void setMarkerLowerIntensityColor(QColor c);
96 void setMarkerLowerIntensityVisible(bool visible);
97 void setMarkerUpperIntensityColor(QColor c);
98 void setMarkerUpperIntensityVisible(bool visible);
99 void setMarkerRefLevelAmplitudeVisible(bool visible);
100 void setMarkerRefLevelAmplitudeColor(QColor c);
101
102 void setLowerIntensityLevel(const double);
103 void setUpperIntensityLevel(const double);
104
105 void onPickerPointSelected(const QPointF& p);
106
107 void setAutoScale(bool state);
108
109private:
110 void _resetXAxisPoints();
111 void _autoScale(double bottom, double top);
112
113 std::vector<std::vector<double>> d_ydata;
114
115 QwtPlotCurve* d_min_vec_plot_curve;
116 QwtPlotCurve* d_max_vec_plot_curve;
117 QColor d_min_vec_color;
118 bool d_min_vec_visible;
119 QColor d_max_vec_color;
120 bool d_max_vec_visible;
121 QColor d_marker_lower_intensity_color;
122 bool d_marker_lower_intensity_visible;
123 QColor d_marker_upper_intensity_color;
124 bool d_marker_upper_intensity_visible;
125 QColor d_marker_ref_level_color;
126 bool d_marker_ref_level_visible;
127
128 double d_x_axis_start = 0;
129 double d_x_axis_step = 1.0;
130
131 double d_ymax = 10;
132 double d_ymin = -10;
133
134 QwtPlotMarker* d_lower_intensity_marker;
135 QwtPlotMarker* d_upper_intensity_marker;
136
137 QwtPlotMarker* d_marker_ref_level;
138
139 std::vector<double> d_xdata;
140
141 QString d_x_axis_label;
142 QString d_y_axis_label;
143
144 std::vector<double> d_min_vec_data;
145 std::vector<double> d_max_vec_data;
146
147 double d_ref_level;
148};
149
150#endif /* VECTOR_DISPLAY_PLOT_HPP */
DisplayPlot.h
DisplayPlot::DisplayPlot
DisplayPlot(int nplots, QWidget *)
VectorDisplayPlot::clearMaxData
void clearMaxData()
VectorDisplayPlot::marker_upper_intensity_color
QColor marker_upper_intensity_color
Definition VectorDisplayPlot.h:33
VectorDisplayPlot::replot
void replot() override
VectorDisplayPlot::setUpperIntensityLevel
void setUpperIntensityLevel(const double)
VectorDisplayPlot::getYMax
double getYMax() const
VectorDisplayPlot::setYAxisLabel
void setYAxisLabel(const QString &label)
VectorDisplayPlot::clearMinData
void clearMinData()
VectorDisplayPlot::setMinVecColor
void setMinVecColor(QColor c)
VectorDisplayPlot::getMarkerUpperIntensityVisible
bool getMarkerUpperIntensityVisible() const
VectorDisplayPlot::setYAxisUnit
void setYAxisUnit(const QString &unit)
VectorDisplayPlot::setMarkerRefLevelAmplitudeVisible
void setMarkerRefLevelAmplitudeVisible(bool visible)
VectorDisplayPlot::min_vec_visible
bool min_vec_visible
Definition VectorDisplayPlot.h:29
VectorDisplayPlot::getYMin
double getYMin() const
VectorDisplayPlot::getMarkerUpperIntensityColor
const QColor getMarkerUpperIntensityColor() const
VectorDisplayPlot::onPickerPointSelected
void onPickerPointSelected(const QPointF &p)
VectorDisplayPlot::marker_lower_intensity_color
QColor marker_lower_intensity_color
Definition VectorDisplayPlot.h:31
VectorDisplayPlot::setMarkerLowerIntensityColor
void setMarkerLowerIntensityColor(QColor c)
VectorDisplayPlot::plotNewData
void plotNewData(const std::vector< const double * > dataPoints, const int64_t numDataPoints, const double refLevel, const double timeInterval)
VectorDisplayPlot::getMarkerRefLevelAmplitudeVisible
bool getMarkerRefLevelAmplitudeVisible() const
VectorDisplayPlot::setMaxVecColor
void setMaxVecColor(QColor c)
VectorDisplayPlot::setLowerIntensityLevel
void setLowerIntensityLevel(const double)
VectorDisplayPlot::max_vec_visible
bool max_vec_visible
Definition VectorDisplayPlot.h:30
VectorDisplayPlot::setXAxisValues
void setXAxisValues(const double start, const double step=1.0)
VectorDisplayPlot::setXAxisLabel
void setXAxisLabel(const QString &label)
VectorDisplayPlot::min_vec_color
QColor min_vec_color
Definition VectorDisplayPlot.h:27
VectorDisplayPlot::setAutoScale
void setAutoScale(bool state)
VectorDisplayPlot::setMinVecVisible
void setMinVecVisible(const bool)
VectorDisplayPlot::setMaxVecVisible
void setMaxVecVisible(const bool)
VectorDisplayPlot::setXAxisUnit
void setXAxisUnit(const QString &unit)
VectorDisplayPlot::VectorDisplayPlot
VectorDisplayPlot(int nplots, QWidget *)
VectorDisplayPlot::getMarkerLowerIntensityVisible
bool getMarkerLowerIntensityVisible() const
VectorDisplayPlot::setTraceColour
void setTraceColour(QColor)
VectorDisplayPlot::getMinVecColor
const QColor getMinVecColor() const
VectorDisplayPlot::setMarkerUpperIntensityVisible
void setMarkerUpperIntensityVisible(bool visible)
VectorDisplayPlot::marker_ref_level_visible
bool marker_ref_level_visible
Definition VectorDisplayPlot.h:36
VectorDisplayPlot::setMarkerLowerIntensityVisible
void setMarkerLowerIntensityVisible(bool visible)
VectorDisplayPlot::setMarkerUpperIntensityColor
void setMarkerUpperIntensityColor(QColor c)
VectorDisplayPlot::setMarkerRefLevelAmplitudeColor
void setMarkerRefLevelAmplitudeColor(QColor c)
VectorDisplayPlot::setBGColour
void setBGColour(QColor c)
VectorDisplayPlot::getMaxVecVisible
bool getMaxVecVisible() const
VectorDisplayPlot::max_vec_color
QColor max_vec_color
Definition VectorDisplayPlot.h:28
VectorDisplayPlot::marker_ref_level_color
QColor marker_ref_level_color
Definition VectorDisplayPlot.h:35
VectorDisplayPlot::getMarkerRefLevelAmplitudeColor
const QColor getMarkerRefLevelAmplitudeColor() const
VectorDisplayPlot::getMaxVecColor
const QColor getMaxVecColor() const
VectorDisplayPlot::marker_lower_intensity_visible
bool marker_lower_intensity_visible
Definition VectorDisplayPlot.h:32
VectorDisplayPlot::getMarkerLowerIntensityColor
const QColor getMarkerLowerIntensityColor() const
VectorDisplayPlot::setYaxis
void setYaxis(double min, double max) override
VectorDisplayPlot::marker_upper_intensity_visible
bool marker_upper_intensity_visible
Definition VectorDisplayPlot.h:34
VectorDisplayPlot::getMinVecVisible
bool getMinVecVisible() const
std
STL namespace.