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
WaterfallDisplayPlot.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2008-2012 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 WATERFALL_DISPLAY_PLOT_H
24 #define WATERFALL_DISPLAY_PLOT_H
25 
26 #include <stdint.h>
27 #include <cstdio>
28 #include <vector>
29 #include <qwt_plot_spectrogram.h>
33 
34 #if QWT_VERSION < 0x060000
36 #else
37 #include <qwt_compat.h>
38 #endif
39 
40 /*!
41  * \brief QWidget for displaying waterfall (spectrogram) plots.
42  * \ingroup qtgui_blk
43  */
45 {
46  Q_OBJECT
47 
48  Q_PROPERTY ( int intensity_color_map_type1 READ getIntensityColorMapType1 WRITE setIntensityColorMapType1 )
49  Q_PROPERTY ( QColor low_intensity_color READ getUserDefinedLowIntensityColor WRITE setUserDefinedLowIntensityColor )
50  Q_PROPERTY ( QColor high_intensity_color READ getUserDefinedHighIntensityColor WRITE setUserDefinedHighIntensityColor )
51  Q_PROPERTY(int color_map_title_font_size READ getColorMapTitleFontSize WRITE setColorMapTitleFontSize)
52 
53 
54 public:
55  WaterfallDisplayPlot(int nplots, QWidget*);
56  virtual ~WaterfallDisplayPlot();
57 
58  void resetAxis();
59 
60  void setFrequencyRange(const double, const double,
61  const double units=1000.0,
62  const std::string &strunits = "kHz");
63  double getStartFrequency() const;
64  double getStopFrequency() const;
65 
66  void plotNewData(const std::vector<double*> dataPoints,
67  const int64_t numDataPoints,
68  const double timePerFFT,
69  const gr::high_res_timer_type timestamp,
70  const int droppedFrames);
71 
72  // to be removed
73  void plotNewData(const double* dataPoints,
74  const int64_t numDataPoints,
75  const double timePerFFT,
76  const gr::high_res_timer_type timestamp,
77  const int droppedFrames);
78 
79  void setIntensityRange(const double minIntensity, const double maxIntensity);
80  double getMinIntensity(int which) const;
81  double getMaxIntensity(int which) const;
82 
83  void replot(void);
84  void clearData();
85 
86  int getIntensityColorMapType(int) const;
87  int getIntensityColorMapType1() const;
88  int getColorMapTitleFontSize() const;
89  const QColor getUserDefinedLowIntensityColor() const;
90  const QColor getUserDefinedHighIntensityColor() const;
91 
92  int getAlpha(int which);
93  void setAlpha(int which, int alpha);
94 
95  int getNumRows() const;
96 
97 public slots:
98  void setIntensityColorMapType(const int, const int, const QColor, const QColor);
99  void setIntensityColorMapType1(int);
100  void setColorMapTitleFontSize(int tfs);
101  void setUserDefinedLowIntensityColor(QColor);
103  void setPlotPosHalf(bool half);
104  void disableLegend();
105  void enableLegend();
106  void enableLegend(bool en);
107  void setNumRows(int nrows);
108 
109 signals:
110  void updatedLowerIntensityLevel(const double);
111  void updatedUpperIntensityLevel(const double);
112 
113 private:
114  void _updateIntensityRangeDisplay();
115 
116  double d_start_frequency;
117  double d_stop_frequency;
118  double d_center_frequency;
119  int d_xaxis_multiplier;
120  bool d_half_freq;
121  bool d_legend_enabled;
122  int d_nrows;
123 
124  std::vector<WaterfallData*> d_data;
125 
126 #if QWT_VERSION < 0x060000
127  std::vector<PlotWaterfall*> d_spectrogram;
128 #else
129  std::vector<QwtPlotSpectrogram*> d_spectrogram;
130 #endif
131 
132  std::vector<int> d_intensity_color_map_type;
133  QColor d_user_defined_low_intensity_color;
134  QColor d_user_defined_high_intensity_color;
135  int d_color_bar_title_font_size;
136 };
137 
138 #endif /* WATERFALL_DISPLAY_PLOT_H */
QWidget for displaying waterfall (spectrogram) plots.
Definition: WaterfallDisplayPlot.h:44
void setIntensityColorMapType1(int)
void setUserDefinedLowIntensityColor(QColor)
QWidget base plot to build QTGUI plotting tools.
Definition: DisplayPlot.h:61
const QColor getUserDefinedLowIntensityColor() const
void setIntensityRange(const double minIntensity, const double maxIntensity)
int getNumRows() const
void plotNewData(const std::vector< double * > dataPoints, const int64_t numDataPoints, const double timePerFFT, const gr::high_res_timer_type timestamp, const int droppedFrames)
int getColorMapTitleFontSize() const
double getMaxIntensity(int which) const
double getStartFrequency() const
void setColorMapTitleFontSize(int tfs)
virtual ~WaterfallDisplayPlot()
void setAlpha(int which, int alpha)
double getStopFrequency() const
void updatedUpperIntensityLevel(const double)
void setIntensityColorMapType(const int, const int, const QColor, const QColor)
void setFrequencyRange(const double, const double, const double units=1000.0, const std::string &strunits="kHz")
int getAlpha(int which)
WaterfallDisplayPlot(int nplots, QWidget *)
signed long long high_res_timer_type
Typedef for the timer tick count.
Definition: high_res_timer.h:49
double getMinIntensity(int which) const
int getIntensityColorMapType1() const
void setPlotPosHalf(bool half)
void updatedLowerIntensityLevel(const double)
void setUserDefinedHighIntensityColor(QColor)
void setNumRows(int nrows)
const QColor getUserDefinedHighIntensityColor() const
int getIntensityColorMapType(int) const