GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
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 
15 #include <cstdint>
16 #include <cstdio>
17 #include <vector>
18 
19 /*!
20  * \brief QWidget for displaying 1D-vector plots.
21  * \ingroup qtgui_blk
22  */
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)
39  Q_PROPERTY(QColor marker_ref_level_color READ getMarkerRefLevelAmplitudeColor WRITE
43 
44 public:
45  VectorDisplayPlot(int nplots, QWidget*);
46  ~VectorDisplayPlot() override;
47 
48  // Disable move/copy because of raw QT pointers.
53 
54  void setXAxisValues(const double start, const double step = 1.0);
55 
56  void plotNewData(const std::vector<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  const bool getMaxVecVisible() const;
80  const bool getMinVecVisible() const;
81  const QColor getMinVecColor() const;
82  const QColor getMaxVecColor() const;
83  const QColor getMarkerLowerIntensityColor() const;
84  const bool getMarkerLowerIntensityVisible() const;
85  const QColor getMarkerUpperIntensityColor() const;
86  const bool getMarkerUpperIntensityVisible() const;
88  const QColor getMarkerRefLevelAmplitudeColor() const;
89 
90 public slots:
91  void setMaxVecVisible(const bool);
92  void setMinVecVisible(const bool);
93  void setMinVecColor(QColor c);
94  void setMaxVecColor(QColor c);
96  void setMarkerLowerIntensityVisible(bool visible);
98  void setMarkerUpperIntensityVisible(bool visible);
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 
109 private:
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 */
QWidget base plot to build QTGUI plotting tools.
Definition: DisplayPlot.h:42
QWidget for displaying 1D-vector plots.
Definition: VectorDisplayPlot.h:24
QColor marker_upper_intensity_color
Definition: VectorDisplayPlot.h:36
void replot() override
void plotNewData(const std::vector< double * > dataPoints, const int64_t numDataPoints, const double refLevel, const double timeInterval)
void setUpperIntensityLevel(const double)
double getYMax() const
const bool getMarkerUpperIntensityVisible() const
void setYAxisLabel(const QString &label)
void setMinVecColor(QColor c)
~VectorDisplayPlot() override
void setYAxisUnit(const QString &unit)
void setMarkerRefLevelAmplitudeVisible(bool visible)
bool min_vec_visible
Definition: VectorDisplayPlot.h:29
double getYMin() const
const QColor getMarkerUpperIntensityColor() const
VectorDisplayPlot & operator=(VectorDisplayPlot &&)=delete
void onPickerPointSelected(const QPointF &p)
QColor marker_lower_intensity_color
Definition: VectorDisplayPlot.h:32
void setMarkerLowerIntensityColor(QColor c)
void setMaxVecColor(QColor c)
void setLowerIntensityLevel(const double)
bool max_vec_visible
Definition: VectorDisplayPlot.h:30
VectorDisplayPlot & operator=(const VectorDisplayPlot &)=delete
void setXAxisValues(const double start, const double step=1.0)
VectorDisplayPlot(const VectorDisplayPlot &)=delete
void setXAxisLabel(const QString &label)
QColor min_vec_color
Definition: VectorDisplayPlot.h:27
void setAutoScale(bool state)
void setMinVecVisible(const bool)
void setMaxVecVisible(const bool)
VectorDisplayPlot(VectorDisplayPlot &&)=delete
void setXAxisUnit(const QString &unit)
VectorDisplayPlot(int nplots, QWidget *)
void setTraceColour(QColor)
const bool getMarkerRefLevelAmplitudeVisible() const
const QColor getMinVecColor() const
void setMarkerUpperIntensityVisible(bool visible)
const bool getMaxVecVisible() const
bool marker_ref_level_visible
Definition: VectorDisplayPlot.h:42
const bool getMinVecVisible() const
void setMarkerLowerIntensityVisible(bool visible)
const bool getMarkerLowerIntensityVisible() const
void setMarkerUpperIntensityColor(QColor c)
void setMarkerRefLevelAmplitudeColor(QColor c)
void setBGColour(QColor c)
QColor max_vec_color
Definition: VectorDisplayPlot.h:28
QColor marker_ref_level_color
Definition: VectorDisplayPlot.h:40
const QColor getMarkerRefLevelAmplitudeColor() const
const QColor getMaxVecColor() const
bool marker_lower_intensity_visible
Definition: VectorDisplayPlot.h:34
const QColor getMarkerLowerIntensityColor() const
void setYaxis(double min, double max) override
bool marker_upper_intensity_visible
Definition: VectorDisplayPlot.h:38
float min(float a, float b)