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