GNU Radio C++ API Reference  ga83fa36
The Free & Open Software Radio Ecosystem
matrix_sink.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2023 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 #ifndef INCLUDED_QTGUI_MATRIX_SINK_H
11 #define INCLUDED_QTGUI_MATRIX_SINK_H
12 
13 #include <gnuradio/qtgui/api.h>
14 #include <gnuradio/sync_block.h>
15 #include <qapplication.h>
16 #include <QWidget>
17 
18 namespace gr {
19 namespace qtgui {
20 
21 /*!
22  * \brief A graphical sink that displays a matrix.
23  * \ingroup qtgui
24  * \ingroup qtgui_blk
25  *
26  * \details
27  * This block displays a matrix as a 2D plot. The matrix is
28  * displayed as a contour plot, with the color of each contour
29  * determined by the value of the matrix at that point.
30  *
31  * The matrix is displayed as a 2D plot, with the x and y axes
32  * corresponding to the row and column indices of the matrix,
33  * respectively. The z axis corresponds to the value of the
34  * matrix at that point.
35  *
36  */
37 class QTGUI_API matrix_sink : virtual public gr::sync_block
38 {
39 public:
40  // gr::qtgui::matrix_sink::sptr
41  typedef std::shared_ptr<matrix_sink> sptr;
42 
43  /*!
44  * \brief Build a matrix sink block.
45  *
46  * \param name The name of the block.
47  * \param num_cols The number of columns in the matrix.
48  * \param vlen The vector length of the matrix.
49  * \param contour Whether or not to display the matrix as a contour plot.
50  * \param color_map The color map to use for the contour plot.
51  * \param interpolation The interpolation method to use for the contour plot.
52  * \param parent The parent QWidget.
53  */
54  static sptr make(const std::string& name,
55  unsigned int num_cols,
56  unsigned int vlen,
57  bool contour,
58  const std::string& color_map,
59  const std::string& interpolation,
60  QWidget* parent = nullptr);
61 
62  virtual void exec_() = 0;
63  virtual QWidget* qwidget() = 0;
64  virtual void set_x_start(double x_start) = 0;
65  virtual void set_x_end(double x_end) = 0;
66  virtual void set_y_start(double y_start) = 0;
67  virtual void set_y_end(double y_end) = 0;
68  virtual void set_z_max(double z_max) = 0;
69  virtual void set_z_min(double z_min) = 0;
70  virtual void set_x_axis_label(const std::string& x_axis_label) = 0;
71  virtual void set_y_axis_label(const std::string& y_axis_label) = 0;
72  virtual void set_z_axis_label(const std::string& z_axis_label) = 0;
73 };
74 
75 } // namespace qtgui
76 } // namespace gr
77 
78 #endif /* INCLUDED_QTGUI_MATRIX_SINK_H */
A graphical sink that displays a matrix.
Definition: matrix_sink.h:38
virtual QWidget * qwidget()=0
virtual void set_z_max(double z_max)=0
virtual void set_z_axis_label(const std::string &z_axis_label)=0
virtual void set_y_axis_label(const std::string &y_axis_label)=0
virtual void set_y_start(double y_start)=0
virtual void set_x_start(double x_start)=0
std::shared_ptr< matrix_sink > sptr
Definition: matrix_sink.h:41
virtual void set_z_min(double z_min)=0
virtual void set_x_axis_label(const std::string &x_axis_label)=0
virtual void set_x_end(double x_end)=0
virtual void set_y_end(double y_end)=0
static sptr make(const std::string &name, unsigned int num_cols, unsigned int vlen, bool contour, const std::string &color_map, const std::string &interpolation, QWidget *parent=nullptr)
Build a matrix sink block.
virtual void exec_()=0
synchronous 1:1 input to output with history
Definition: sync_block.h:26
#define QTGUI_API
Definition: gr-qtgui/include/gnuradio/qtgui/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29