Loading...
Searching...
No Matches
qtgui_types.h
Go to the documentation of this file.
/* -*- c++ -*- */
/*
* Copyright 2012,2016 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
*/
#ifndef QTGUI_TYPES_H
#define QTGUI_TYPES_H
#include <gnuradio/high_res_timer.h>
#include <qwt_color_map.h>
#include <qwt_scale_draw.h>
#include <qwt_text.h>
namespace gr {
namespace qtgui {
enum data_type_t {
INT = 0,
FLOAT,
DOUBLE,
COMPLEX,
STRING,
INT_VEC,
FLOAT_VEC,
DOUBLE_VEC,
COMPLEX_VEC,
};
} /* namespace qtgui */
} /* namespace gr */
class FreqOffsetAndPrecisionClass
{
public:
FreqOffsetAndPrecisionClass(const int freqPrecision)
{
_frequencyPrecision = freqPrecision;
_centerFrequency = 0;
}
virtual ~FreqOffsetAndPrecisionClass() {}
virtual unsigned int getFrequencyPrecision() const { return _frequencyPrecision; }
virtual void setFrequencyPrecision(const unsigned int newPrecision)
{
_frequencyPrecision = newPrecision;
}
virtual double getCenterFrequency() const { return _centerFrequency; }
virtual void setCenterFrequency(const double newFreq) { _centerFrequency = newFreq; }
protected:
private:
unsigned int _frequencyPrecision;
double _centerFrequency;
};
class TimeScaleData
{
public:
TimeScaleData()
{
_zeroTime = 0;
_secondsPerLine = 1.0;
}
virtual ~TimeScaleData() {}
virtual gr::high_res_timer_type getZeroTime() const { return _zeroTime; }
virtual void setZeroTime(const gr::high_res_timer_type newTime)
{
_zeroTime = newTime - gr::high_res_timer_epoch();
}
virtual void setSecondsPerLine(const double newTime) { _secondsPerLine = newTime; }
virtual double getSecondsPerLine() const { return _secondsPerLine; }
protected:
private:
gr::high_res_timer_type _zeroTime;
double _secondsPerLine;
};
/***********************************************************************
* Text scale widget to provide X (freq) axis text
**********************************************************************/
class FreqDisplayScaleDraw : public QwtScaleDraw, FreqOffsetAndPrecisionClass
{
public:
FreqDisplayScaleDraw(const unsigned int precision)
: QwtScaleDraw(), FreqOffsetAndPrecisionClass(precision)
{
}
QwtText label(double value) const override
{
return QString("%1").arg(value, 0, 'f', getFrequencyPrecision());
}
virtual void initiateUpdate(void) { invalidateCache(); }
protected:
private:
};
namespace gr {
namespace qtgui {
enum graph_t {
NUM_GRAPH_NONE = 0,
NUM_GRAPH_HORIZ,
NUM_GRAPH_VERT,
};
enum intensity_t {
INTENSITY_COLOR_MAP_TYPE_MULTI_COLOR = 0,
INTENSITY_COLOR_MAP_TYPE_WHITE_HOT = 1,
INTENSITY_COLOR_MAP_TYPE_BLACK_HOT = 2,
INTENSITY_COLOR_MAP_TYPE_INCANDESCENT = 3,
INTENSITY_COLOR_MAP_TYPE_USER_DEFINED = 4,
INTENSITY_COLOR_MAP_TYPE_SUNSET = 5,
INTENSITY_COLOR_MAP_TYPE_COOL = 6,
};
} /* namespace qtgui */
} /* namespace gr */
class ColorMap_MultiColor : public QwtLinearColorMap
{
public:
ColorMap_MultiColor() : QwtLinearColorMap(Qt::darkCyan, Qt::white)
{
addColorStop(0.25, Qt::cyan);
addColorStop(0.5, Qt::yellow);
addColorStop(0.75, Qt::red);
}
};
class ColorMap_WhiteHot : public QwtLinearColorMap
{
public:
ColorMap_WhiteHot() : QwtLinearColorMap(Qt::black, Qt::white) {}
};
class ColorMap_BlackHot : public QwtLinearColorMap
{
public:
ColorMap_BlackHot() : QwtLinearColorMap(Qt::white, Qt::black) {}
};
class ColorMap_Incandescent : public QwtLinearColorMap
{
public:
ColorMap_Incandescent() : QwtLinearColorMap(Qt::black, Qt::white)
{
addColorStop(0.5, Qt::darkRed);
}
};
class ColorMap_Sunset : public QwtLinearColorMap
{
public:
ColorMap_Sunset() : QwtLinearColorMap(QColor(0, 0, 0, 0), QColor(255, 255, 193, 255))
{
addColorStop(0.167, QColor(86, 0, 153, 45));
addColorStop(0.333, QColor(147, 51, 119, 91));
addColorStop(0.500, QColor(226, 51, 71, 140));
addColorStop(0.667, QColor(255, 109, 0, 183));
addColorStop(0.833, QColor(255, 183, 0, 221));
}
};
class ColorMap_Cool : public QwtLinearColorMap
{
public:
ColorMap_Cool() : QwtLinearColorMap(QColor(0, 0, 0, 0), QColor(255, 255, 255, 255))
{
addColorStop(0.167, QColor(0, 0, 127, 25));
addColorStop(0.333, QColor(0, 63, 153, 86));
addColorStop(0.500, QColor(76, 114, 178, 127));
addColorStop(0.667, QColor(153, 165, 204, 178));
addColorStop(0.833, QColor(204, 216, 229, 211));
}
};
class ColorMap_UserDefined : public QwtLinearColorMap
{
public:
ColorMap_UserDefined(QColor low, QColor high) : QwtLinearColorMap(low, high) {}
};
#endif // QTGUI_TYPES_H
ColorMap_BlackHot::ColorMap_BlackHot
ColorMap_BlackHot()
Definition qtgui_types.h:159
ColorMap_Cool::ColorMap_Cool
ColorMap_Cool()
Definition qtgui_types.h:187
ColorMap_Incandescent::ColorMap_Incandescent
ColorMap_Incandescent()
Definition qtgui_types.h:165
ColorMap_MultiColor::ColorMap_MultiColor
ColorMap_MultiColor()
Definition qtgui_types.h:142
ColorMap_Sunset::ColorMap_Sunset
ColorMap_Sunset()
Definition qtgui_types.h:174
ColorMap_UserDefined::ColorMap_UserDefined
ColorMap_UserDefined(QColor low, QColor high)
Definition qtgui_types.h:200
ColorMap_WhiteHot::ColorMap_WhiteHot
ColorMap_WhiteHot()
Definition qtgui_types.h:153
FreqDisplayScaleDraw::FreqDisplayScaleDraw
FreqDisplayScaleDraw(const unsigned int precision)
Definition qtgui_types.h:100
FreqDisplayScaleDraw::initiateUpdate
virtual void initiateUpdate(void)
Definition qtgui_types.h:110
FreqDisplayScaleDraw::label
QwtText label(double value) const override
Definition qtgui_types.h:105
FreqOffsetAndPrecisionClass::setCenterFrequency
virtual void setCenterFrequency(const double newFreq)
Definition qtgui_types.h:57
FreqOffsetAndPrecisionClass::~FreqOffsetAndPrecisionClass
virtual ~FreqOffsetAndPrecisionClass()
Definition qtgui_types.h:46
FreqOffsetAndPrecisionClass::getFrequencyPrecision
virtual unsigned int getFrequencyPrecision() const
Definition qtgui_types.h:48
FreqOffsetAndPrecisionClass::FreqOffsetAndPrecisionClass
FreqOffsetAndPrecisionClass(const int freqPrecision)
Definition qtgui_types.h:40
FreqOffsetAndPrecisionClass::setFrequencyPrecision
virtual void setFrequencyPrecision(const unsigned int newPrecision)
Definition qtgui_types.h:50
FreqOffsetAndPrecisionClass::getCenterFrequency
virtual double getCenterFrequency() const
Definition qtgui_types.h:55
TimeScaleData::TimeScaleData
TimeScaleData()
Definition qtgui_types.h:68
TimeScaleData::~TimeScaleData
virtual ~TimeScaleData()
Definition qtgui_types.h:74
TimeScaleData::getSecondsPerLine
virtual double getSecondsPerLine() const
Definition qtgui_types.h:85
TimeScaleData::setZeroTime
virtual void setZeroTime(const gr::high_res_timer_type newTime)
Definition qtgui_types.h:78
TimeScaleData::setSecondsPerLine
virtual void setSecondsPerLine(const double newTime)
Definition qtgui_types.h:83
TimeScaleData::getZeroTime
virtual gr::high_res_timer_type getZeroTime() const
Definition qtgui_types.h:76
high_res_timer.h
gr::qtgui
Definition ber_sink_b.h:20
gr::qtgui::intensity_t
intensity_t
Definition qtgui_types.h:125
gr::qtgui::INTENSITY_COLOR_MAP_TYPE_MULTI_COLOR
@ INTENSITY_COLOR_MAP_TYPE_MULTI_COLOR
Definition qtgui_types.h:126
gr::qtgui::INTENSITY_COLOR_MAP_TYPE_USER_DEFINED
@ INTENSITY_COLOR_MAP_TYPE_USER_DEFINED
Definition qtgui_types.h:130
gr::qtgui::INTENSITY_COLOR_MAP_TYPE_WHITE_HOT
@ INTENSITY_COLOR_MAP_TYPE_WHITE_HOT
Definition qtgui_types.h:127
gr::qtgui::INTENSITY_COLOR_MAP_TYPE_SUNSET
@ INTENSITY_COLOR_MAP_TYPE_SUNSET
Definition qtgui_types.h:131
gr::qtgui::INTENSITY_COLOR_MAP_TYPE_COOL
@ INTENSITY_COLOR_MAP_TYPE_COOL
Definition qtgui_types.h:132
gr::qtgui::INTENSITY_COLOR_MAP_TYPE_BLACK_HOT
@ INTENSITY_COLOR_MAP_TYPE_BLACK_HOT
Definition qtgui_types.h:128
gr::qtgui::INTENSITY_COLOR_MAP_TYPE_INCANDESCENT
@ INTENSITY_COLOR_MAP_TYPE_INCANDESCENT
Definition qtgui_types.h:129
gr::qtgui::data_type_t
data_type_t
Definition qtgui_types.h:22
gr::qtgui::INT_VEC
@ INT_VEC
Definition qtgui_types.h:28
gr::qtgui::INT
@ INT
Definition qtgui_types.h:23
gr::qtgui::DOUBLE
@ DOUBLE
Definition qtgui_types.h:25
gr::qtgui::FLOAT_VEC
@ FLOAT_VEC
Definition qtgui_types.h:29
gr::qtgui::STRING
@ STRING
Definition qtgui_types.h:27
gr::qtgui::DOUBLE_VEC
@ DOUBLE_VEC
Definition qtgui_types.h:30
gr::qtgui::COMPLEX_VEC
@ COMPLEX_VEC
Definition qtgui_types.h:31
gr::qtgui::COMPLEX
@ COMPLEX
Definition qtgui_types.h:26
gr::qtgui::FLOAT
@ FLOAT
Definition qtgui_types.h:24
gr::qtgui::graph_t
graph_t
Definition qtgui_types.h:119
gr::qtgui::NUM_GRAPH_VERT
@ NUM_GRAPH_VERT
Definition qtgui_types.h:122
gr::qtgui::NUM_GRAPH_NONE
@ NUM_GRAPH_NONE
Definition qtgui_types.h:120
gr::qtgui::NUM_GRAPH_HORIZ
@ NUM_GRAPH_HORIZ
Definition qtgui_types.h:121
gr
GNU Radio logging wrapper.
Definition basic_block.h:29
gr::high_res_timer_epoch
high_res_timer_type high_res_timer_epoch(void)
Get the tick count at the epoch.
Definition high_res_timer.h:143
gr::high_res_timer_type
signed long long high_res_timer_type
Typedef for the timer tick count.
Definition high_res_timer.h:41