GNU Radio Manual and C++ API Reference  3.9.1.0
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)
39  Q_PROPERTY(QColor marker_ref_level_color READ getMarkerRefLevelAmplitudeColor WRITE
43 
44 public:
45  VectorDisplayPlot(int nplots, QWidget*);
46  ~VectorDisplayPlot() override;
47 
48  void setXAxisValues(const double start, const double step = 1.0);
49 
50  void plotNewData(const std::vector<double*> dataPoints,
51  const int64_t numDataPoints,
52  const double refLevel,
53  const double timeInterval);
54 
55  void clearMaxData();
56  void clearMinData();
57 
58  void replot() override;
59 
60  void setYaxis(double min, double max) override;
61  double getYMin() const;
62  double getYMax() const;
63 
64  void setXAxisLabel(const QString& label);
65  void setYAxisLabel(const QString& label);
66 
67  void setXAxisUnit(const QString& unit);
68  void setYAxisUnit(const QString& unit);
69 
70  void setTraceColour(QColor);
71  void setBGColour(QColor c);
72 
73  const bool getMaxVecVisible() const;
74  const bool getMinVecVisible() const;
75  const QColor getMinVecColor() const;
76  const QColor getMaxVecColor() const;
77  const QColor getMarkerLowerIntensityColor() const;
78  const bool getMarkerLowerIntensityVisible() const;
79  const QColor getMarkerUpperIntensityColor() const;
80  const bool getMarkerUpperIntensityVisible() const;
81  const bool getMarkerRefLevelAmplitudeVisible() const;
82  const QColor getMarkerRefLevelAmplitudeColor() const;
83 
84 public slots:
85  void setMaxVecVisible(const bool);
86  void setMinVecVisible(const bool);
87  void setMinVecColor(QColor c);
88  void setMaxVecColor(QColor c);
89  void setMarkerLowerIntensityColor(QColor c);
90  void setMarkerLowerIntensityVisible(bool visible);
91  void setMarkerUpperIntensityColor(QColor c);
92  void setMarkerUpperIntensityVisible(bool visible);
93  void setMarkerRefLevelAmplitudeVisible(bool visible);
94  void setMarkerRefLevelAmplitudeColor(QColor c);
95 
96  void setLowerIntensityLevel(const double);
97  void setUpperIntensityLevel(const double);
98 
99  void onPickerPointSelected(const QwtDoublePoint& p);
100  void onPickerPointSelected6(const QPointF& p);
101 
102  void setAutoScale(bool state);
103 
104 private:
105  void _resetXAxisPoints();
106  void _autoScale(double bottom, double top);
107 
108  std::vector<double*> d_ydata;
109 
110  QwtPlotCurve* d_min_vec_plot_curve;
111  QwtPlotCurve* d_max_vec_plot_curve;
112  QColor d_min_vec_color;
113  bool d_min_vec_visible;
114  QColor d_max_vec_color;
115  bool d_max_vec_visible;
116  QColor d_marker_lower_intensity_color;
117  bool d_marker_lower_intensity_visible;
118  QColor d_marker_upper_intensity_color;
119  bool d_marker_upper_intensity_visible;
120  QColor d_marker_ref_level_color;
121  bool d_marker_ref_level_visible;
122 
123  double d_x_axis_start;
124  double d_x_axis_step;
125 
126  double d_ymax;
127  double d_ymin;
128 
129  QwtPlotMarker* d_lower_intensity_marker;
130  QwtPlotMarker* d_upper_intensity_marker;
131 
132  QwtPlotMarker* d_marker_ref_level;
133 
134  double* d_xdata;
135 
136  QString d_x_axis_label;
137  QString d_y_axis_label;
138 
139  double* d_min_vec_data;
140  double* d_max_vec_data;
141 
142  double d_ref_level;
143 };
144 
145 #endif /* VECTOR_DISPLAY_PLOT_HPP */
VectorDisplayPlot::marker_ref_level_visible
bool marker_ref_level_visible
Definition: VectorDisplayPlot.h:42
VectorDisplayPlot::setTraceColour
void setTraceColour(QColor)
VectorDisplayPlot::setYAxisLabel
void setYAxisLabel(const QString &label)
VectorDisplayPlot::onPickerPointSelected
void onPickerPointSelected(const QwtDoublePoint &p)
DisplayPlot.h
VectorDisplayPlot::getMaxVecVisible
const bool getMaxVecVisible() const
VectorDisplayPlot::setMinVecColor
void setMinVecColor(QColor c)
VectorDisplayPlot::setUpperIntensityLevel
void setUpperIntensityLevel(const double)
VectorDisplayPlot::setMarkerUpperIntensityVisible
void setMarkerUpperIntensityVisible(bool visible)
VectorDisplayPlot::setMarkerRefLevelAmplitudeVisible
void setMarkerRefLevelAmplitudeVisible(bool visible)
VectorDisplayPlot::setMinVecVisible
void setMinVecVisible(const bool)
VectorDisplayPlot::marker_upper_intensity_visible
bool marker_upper_intensity_visible
Definition: VectorDisplayPlot.h:38
VectorDisplayPlot::setMarkerUpperIntensityColor
void setMarkerUpperIntensityColor(QColor c)
gr::trellis::min
float min(float a, float b)
VectorDisplayPlot::marker_lower_intensity_color
QColor marker_lower_intensity_color
Definition: VectorDisplayPlot.h:32
VectorDisplayPlot::clearMinData
void clearMinData()
VectorDisplayPlot::replot
void replot() override
VectorDisplayPlot::setMarkerRefLevelAmplitudeColor
void setMarkerRefLevelAmplitudeColor(QColor c)
VectorDisplayPlot::min_vec_visible
bool min_vec_visible
Definition: VectorDisplayPlot.h:29
VectorDisplayPlot
QWidget for displaying 1D-vector plots.
Definition: VectorDisplayPlot.h:23
VectorDisplayPlot::onPickerPointSelected6
void onPickerPointSelected6(const QPointF &p)
VectorDisplayPlot::setYaxis
void setYaxis(double min, double max) override
VectorDisplayPlot::getMinVecVisible
const bool getMinVecVisible() const
DisplayPlot
QWidget base plot to build QTGUI plotting tools.
Definition: DisplayPlot.h:49
VectorDisplayPlot::getMarkerRefLevelAmplitudeColor
const QColor getMarkerRefLevelAmplitudeColor() const
VectorDisplayPlot::setXAxisUnit
void setXAxisUnit(const QString &unit)
VectorDisplayPlot::setBGColour
void setBGColour(QColor c)
VectorDisplayPlot::plotNewData
void plotNewData(const std::vector< double * > dataPoints, const int64_t numDataPoints, const double refLevel, const double timeInterval)
VectorDisplayPlot::getMarkerLowerIntensityVisible
const bool getMarkerLowerIntensityVisible() const
VectorDisplayPlot::setYAxisUnit
void setYAxisUnit(const QString &unit)
VectorDisplayPlot::getYMax
double getYMax() const
VectorDisplayPlot::marker_ref_level_color
QColor marker_ref_level_color
Definition: VectorDisplayPlot.h:40
VectorDisplayPlot::setMarkerLowerIntensityVisible
void setMarkerLowerIntensityVisible(bool visible)
VectorDisplayPlot::getMinVecColor
const QColor getMinVecColor() const
VectorDisplayPlot::clearMaxData
void clearMaxData()
VectorDisplayPlot::marker_upper_intensity_color
QColor marker_upper_intensity_color
Definition: VectorDisplayPlot.h:36
VectorDisplayPlot::getYMin
double getYMin() const
VectorDisplayPlot::max_vec_color
QColor max_vec_color
Definition: VectorDisplayPlot.h:28
VectorDisplayPlot::setAutoScale
void setAutoScale(bool state)
VectorDisplayPlot::setXAxisLabel
void setXAxisLabel(const QString &label)
VectorDisplayPlot::setMaxVecColor
void setMaxVecColor(QColor c)
VectorDisplayPlot::getMarkerUpperIntensityColor
const QColor getMarkerUpperIntensityColor() const
VectorDisplayPlot::setXAxisValues
void setXAxisValues(const double start, const double step=1.0)
VectorDisplayPlot::getMarkerRefLevelAmplitudeVisible
const bool getMarkerRefLevelAmplitudeVisible() const
VectorDisplayPlot::setMaxVecVisible
void setMaxVecVisible(const bool)
VectorDisplayPlot::setMarkerLowerIntensityColor
void setMarkerLowerIntensityColor(QColor c)
VectorDisplayPlot::marker_lower_intensity_visible
bool marker_lower_intensity_visible
Definition: VectorDisplayPlot.h:34
VectorDisplayPlot::max_vec_visible
bool max_vec_visible
Definition: VectorDisplayPlot.h:30
VectorDisplayPlot::getMaxVecColor
const QColor getMaxVecColor() const
VectorDisplayPlot::setLowerIntensityLevel
void setLowerIntensityLevel(const double)
VectorDisplayPlot::min_vec_color
QColor min_vec_color
Definition: VectorDisplayPlot.h:27
VectorDisplayPlot::getMarkerUpperIntensityVisible
const bool getMarkerUpperIntensityVisible() const
VectorDisplayPlot::getMarkerLowerIntensityColor
const QColor getMarkerLowerIntensityColor() const