GNU Radio Manual and C++ API Reference  3.8.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  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef VECTOR_DISPLAY_PLOT_HPP
24 #define VECTOR_DISPLAY_PLOT_HPP
25 
27 #include <stdint.h>
28 #include <cstdio>
29 #include <vector>
30 
31 /*!
32  * \brief QWidget for displaying 1D-vector plots.
33  * \ingroup qtgui_blk
34  */
36 {
37  Q_OBJECT
38 
39  Q_PROPERTY(QColor min_vec_color READ getMinVecColor WRITE setMinVecColor)
40  Q_PROPERTY(QColor max_vec_color READ getMaxVecColor WRITE setMaxVecColor)
51  Q_PROPERTY(QColor marker_ref_level_color READ getMarkerRefLevelAmplitudeColor WRITE
55 
56 public:
57  VectorDisplayPlot(int nplots, QWidget*);
58  virtual ~VectorDisplayPlot();
59 
60  void setXAxisValues(const double start, const double step = 1.0);
61 
62  void plotNewData(const std::vector<double*> dataPoints,
63  const int64_t numDataPoints,
64  const double refLevel,
65  const double timeInterval);
66 
67  void clearMaxData();
68  void clearMinData();
69 
70  void replot();
71 
72  void setYaxis(double min, double max);
73  double getYMin() const;
74  double getYMax() const;
75 
76  void setXAxisLabel(const QString& label);
77  void setYAxisLabel(const QString& label);
78 
79  void setXAxisUnit(const QString& unit);
80  void setYAxisUnit(const QString& unit);
81 
82  void setTraceColour(QColor);
83  void setBGColour(QColor c);
84 
85  const bool getMaxVecVisible() const;
86  const bool getMinVecVisible() const;
87  const QColor getMinVecColor() const;
88  const QColor getMaxVecColor() const;
89  const QColor getMarkerLowerIntensityColor() const;
90  const bool getMarkerLowerIntensityVisible() const;
91  const QColor getMarkerUpperIntensityColor() const;
92  const bool getMarkerUpperIntensityVisible() const;
93  const bool getMarkerRefLevelAmplitudeVisible() const;
94  const QColor getMarkerRefLevelAmplitudeColor() const;
95 
96 public slots:
97  void setMaxVecVisible(const bool);
98  void setMinVecVisible(const bool);
99  void setMinVecColor(QColor c);
100  void setMaxVecColor(QColor c);
101  void setMarkerLowerIntensityColor(QColor c);
102  void setMarkerLowerIntensityVisible(bool visible);
103  void setMarkerUpperIntensityColor(QColor c);
104  void setMarkerUpperIntensityVisible(bool visible);
105  void setMarkerRefLevelAmplitudeVisible(bool visible);
106  void setMarkerRefLevelAmplitudeColor(QColor c);
107 
108  void setLowerIntensityLevel(const double);
109  void setUpperIntensityLevel(const double);
110 
111  void onPickerPointSelected(const QwtDoublePoint& p);
112  void onPickerPointSelected6(const QPointF& p);
113 
114  void setAutoScale(bool state);
115 
116 private:
117  void _resetXAxisPoints();
118  void _autoScale(double bottom, double top);
119 
120  std::vector<double*> d_ydata;
121 
122  QwtPlotCurve* d_min_vec_plot_curve;
123  QwtPlotCurve* d_max_vec_plot_curve;
124  QColor d_min_vec_color;
125  bool d_min_vec_visible;
126  QColor d_max_vec_color;
127  bool d_max_vec_visible;
128  QColor d_marker_lower_intensity_color;
129  bool d_marker_lower_intensity_visible;
130  QColor d_marker_upper_intensity_color;
131  bool d_marker_upper_intensity_visible;
132  QColor d_marker_ref_level_color;
133  bool d_marker_ref_level_visible;
134 
135  double d_x_axis_start;
136  double d_x_axis_step;
137 
138  double d_ymax;
139  double d_ymin;
140 
141  QwtPlotMarker* d_lower_intensity_marker;
142  QwtPlotMarker* d_upper_intensity_marker;
143 
144  QwtPlotMarker* d_marker_ref_level;
145 
146  double* d_xdata;
147 
148  QString d_x_axis_label;
149  QString d_y_axis_label;
150 
151  double* d_min_vec_data;
152  double* d_max_vec_data;
153 
154  double d_ref_level;
155 };
156 
157 #endif /* VECTOR_DISPLAY_PLOT_HPP */
QWidget for displaying 1D-vector plots.
Definition: VectorDisplayPlot.h:35
void setMinVecVisible(const bool)
bool marker_upper_intensity_visible
Definition: VectorDisplayPlot.h:50
void onPickerPointSelected(const QwtDoublePoint &p)
void setMinVecColor(QColor c)
void setMarkerUpperIntensityVisible(bool visible)
void setLowerIntensityLevel(const double)
QWidget base plot to build QTGUI plotting tools.
Definition: DisplayPlot.h:61
void setMarkerUpperIntensityColor(QColor c)
QColor min_vec_color
Definition: VectorDisplayPlot.h:39
float min(float a, float b)
void setYAxisLabel(const QString &label)
QColor marker_lower_intensity_color
Definition: VectorDisplayPlot.h:44
const QColor getMarkerLowerIntensityColor() const
const bool getMaxVecVisible() const
void setUpperIntensityLevel(const double)
void setMarkerRefLevelAmplitudeVisible(bool visible)
bool marker_ref_level_visible
Definition: VectorDisplayPlot.h:54
void setMarkerRefLevelAmplitudeColor(QColor c)
STL namespace.
bool min_vec_visible
Definition: VectorDisplayPlot.h:41
const bool getMarkerLowerIntensityVisible() const
const QColor getMarkerRefLevelAmplitudeColor() const
void setXAxisUnit(const QString &unit)
const QColor getMinVecColor() const
void onPickerPointSelected6(const QPointF &p)
QColor marker_upper_intensity_color
Definition: VectorDisplayPlot.h:48
QColor max_vec_color
Definition: VectorDisplayPlot.h:40
double getYMax() const
const bool getMinVecVisible() const
QColor marker_ref_level_color
Definition: VectorDisplayPlot.h:52
void setMarkerLowerIntensityVisible(bool visible)
void setAutoScale(bool state)
double getYMin() const
void setYAxisUnit(const QString &unit)
const bool getMarkerRefLevelAmplitudeVisible() const
void setBGColour(QColor c)
void setXAxisLabel(const QString &label)
void setMaxVecColor(QColor c)
const QColor getMarkerUpperIntensityColor() const
bool max_vec_visible
Definition: VectorDisplayPlot.h:42
void setMarkerLowerIntensityColor(QColor c)
const bool getMarkerUpperIntensityVisible() const
bool marker_lower_intensity_visible
Definition: VectorDisplayPlot.h:46
void plotNewData(const std::vector< double *> dataPoints, const int64_t numDataPoints, const double refLevel, const double timeInterval)
void setMaxVecVisible(const bool)
const QColor getMaxVecColor() const
void setTraceColour(QColor)
void setYaxis(double min, double max)
void setXAxisValues(const double start, const double step=1.0)