mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-22 16:08:39 -05:00
Spectrum markers: externalize histogram and waterfall markers
This commit is contained in:
parent
6036f62ae4
commit
1c2c8352f2
@ -147,6 +147,7 @@ set(sdrgui_HEADERS
|
|||||||
gui/scaleengine.h
|
gui/scaleengine.h
|
||||||
gui/scaledimage.h
|
gui/scaledimage.h
|
||||||
gui/sdrangelsplash.h
|
gui/sdrangelsplash.h
|
||||||
|
gui/spectrummarkers.h
|
||||||
gui/tickedslider.h
|
gui/tickedslider.h
|
||||||
gui/transverterbutton.h
|
gui/transverterbutton.h
|
||||||
gui/transverterdialog.h
|
gui/transverterdialog.h
|
||||||
|
@ -1148,7 +1148,7 @@ void GLSpectrum::drawMarkers()
|
|||||||
QPointF ypoint = m_histogramMarkers.at(i).m_point;
|
QPointF ypoint = m_histogramMarkers.at(i).m_point;
|
||||||
QString powerStr = m_histogramMarkers.at(i).m_powerStr;
|
QString powerStr = m_histogramMarkers.at(i).m_powerStr;
|
||||||
|
|
||||||
if (m_histogramMarkers.at(i).m_markerType == HistogramMarkerTypePower)
|
if (m_histogramMarkers.at(i).m_markerType == SpectrumHistogramMarkerTypePower)
|
||||||
{
|
{
|
||||||
ypoint.ry() =
|
ypoint.ry() =
|
||||||
(m_powerScale.getRangeMax() - m_currentSpectrum[m_histogramMarkers.at(i).m_fftBin]) / m_powerScale.getRange();
|
(m_powerScale.getRangeMax() - m_currentSpectrum[m_histogramMarkers.at(i).m_fftBin]) / m_powerScale.getRange();
|
||||||
@ -1195,10 +1195,10 @@ void GLSpectrum::drawMarkers()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float power0 = m_histogramMarkers.at(0).m_markerType == HistogramMarkerTypePower ?
|
float power0 = m_histogramMarkers.at(0).m_markerType == SpectrumHistogramMarkerTypePower ?
|
||||||
m_currentSpectrum[m_histogramMarkers.at(0).m_fftBin] :
|
m_currentSpectrum[m_histogramMarkers.at(0).m_fftBin] :
|
||||||
m_histogramMarkers.at(0).m_power;
|
m_histogramMarkers.at(0).m_power;
|
||||||
float poweri = m_histogramMarkers.at(i).m_markerType == HistogramMarkerTypePower ?
|
float poweri = m_histogramMarkers.at(i).m_markerType == SpectrumHistogramMarkerTypePower ?
|
||||||
m_currentSpectrum[m_histogramMarkers.at(i).m_fftBin] :
|
m_currentSpectrum[m_histogramMarkers.at(i).m_fftBin] :
|
||||||
m_histogramMarkers.at(i).m_power;
|
m_histogramMarkers.at(i).m_power;
|
||||||
QString deltaPowerStr = displayScaledF(
|
QString deltaPowerStr = displayScaledF(
|
||||||
@ -2178,7 +2178,7 @@ void GLSpectrum::mousePressEvent(QMouseEvent* event)
|
|||||||
{
|
{
|
||||||
if (m_histogramMarkers.size() < 2)
|
if (m_histogramMarkers.size() < 2)
|
||||||
{
|
{
|
||||||
m_histogramMarkers.push_back(HistogramMarker());
|
m_histogramMarkers.push_back(SpectrumHistogramMarker());
|
||||||
m_histogramMarkers.back().m_point = pHis;
|
m_histogramMarkers.back().m_point = pHis;
|
||||||
m_histogramMarkers.back().m_frequency = frequency;
|
m_histogramMarkers.back().m_frequency = frequency;
|
||||||
m_histogramMarkers.back().m_fftBin = fftBin;
|
m_histogramMarkers.back().m_fftBin = fftBin;
|
||||||
@ -2223,7 +2223,7 @@ void GLSpectrum::mousePressEvent(QMouseEvent* event)
|
|||||||
{
|
{
|
||||||
if (m_waterfallMarkers.size() < 2)
|
if (m_waterfallMarkers.size() < 2)
|
||||||
{
|
{
|
||||||
m_waterfallMarkers.push_back(WaterfallMarker());
|
m_waterfallMarkers.push_back(SpectrumWaterfallMarker());
|
||||||
m_waterfallMarkers.back().m_point = pWat;
|
m_waterfallMarkers.back().m_point = pWat;
|
||||||
m_waterfallMarkers.back().m_frequency = frequency;
|
m_waterfallMarkers.back().m_frequency = frequency;
|
||||||
m_waterfallMarkers.back().m_frequencyStr = displayScaled(
|
m_waterfallMarkers.back().m_frequencyStr = displayScaled(
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "gui/scaleengine.h"
|
#include "gui/scaleengine.h"
|
||||||
#include "gui/glshadersimple.h"
|
#include "gui/glshadersimple.h"
|
||||||
#include "gui/glshadertextured.h"
|
#include "gui/glshadertextured.h"
|
||||||
|
#include "gui/spectrummarkers.h"
|
||||||
#include "dsp/channelmarker.h"
|
#include "dsp/channelmarker.h"
|
||||||
#include "export.h"
|
#include "export.h"
|
||||||
#include "util/incrementalarray.h"
|
#include "util/incrementalarray.h"
|
||||||
@ -176,112 +177,8 @@ private:
|
|||||||
CSChannelMoving
|
CSChannelMoving
|
||||||
};
|
};
|
||||||
|
|
||||||
enum HistogramMarkerType {
|
QList<SpectrumHistogramMarker> m_histogramMarkers;
|
||||||
HistogramMarkerTypeManual,
|
QList<SpectrumWaterfallMarker> m_waterfallMarkers;
|
||||||
HistogramMarkerTypePower
|
|
||||||
};
|
|
||||||
|
|
||||||
struct HistogramMarker {
|
|
||||||
QPointF m_point;
|
|
||||||
float m_frequency;
|
|
||||||
int m_fftBin;
|
|
||||||
float m_power;
|
|
||||||
HistogramMarkerType m_markerType;
|
|
||||||
QString m_frequencyStr;
|
|
||||||
QString m_powerStr;
|
|
||||||
QString m_deltaFrequencyStr;
|
|
||||||
QString m_deltaPowerStr;
|
|
||||||
HistogramMarker() :
|
|
||||||
m_point(0, 0),
|
|
||||||
m_frequency(0),
|
|
||||||
m_fftBin(0),
|
|
||||||
m_power(0),
|
|
||||||
m_markerType(HistogramMarkerTypeManual),
|
|
||||||
m_frequencyStr(),
|
|
||||||
m_powerStr(),
|
|
||||||
m_deltaFrequencyStr(),
|
|
||||||
m_deltaPowerStr()
|
|
||||||
{}
|
|
||||||
HistogramMarker(
|
|
||||||
const QPointF& point,
|
|
||||||
float frequency,
|
|
||||||
int fftBin,
|
|
||||||
float power,
|
|
||||||
HistogramMarkerType markerType,
|
|
||||||
const QString& frequencyStr,
|
|
||||||
const QString& powerStr,
|
|
||||||
const QString& deltaFrequencyStr,
|
|
||||||
const QString& deltaPowerStr
|
|
||||||
) :
|
|
||||||
m_point(point),
|
|
||||||
m_frequency(frequency),
|
|
||||||
m_fftBin(fftBin),
|
|
||||||
m_power(power),
|
|
||||||
m_markerType(markerType),
|
|
||||||
m_frequencyStr(frequencyStr),
|
|
||||||
m_powerStr(powerStr),
|
|
||||||
m_deltaFrequencyStr(deltaFrequencyStr),
|
|
||||||
m_deltaPowerStr(deltaPowerStr)
|
|
||||||
{}
|
|
||||||
HistogramMarker(const HistogramMarker& other) :
|
|
||||||
m_point(other.m_point),
|
|
||||||
m_frequency(other.m_frequency),
|
|
||||||
m_fftBin(other.m_fftBin),
|
|
||||||
m_power(other.m_power),
|
|
||||||
m_markerType(other.m_markerType),
|
|
||||||
m_frequencyStr(other.m_frequencyStr),
|
|
||||||
m_powerStr(other.m_powerStr),
|
|
||||||
m_deltaFrequencyStr(other.m_deltaFrequencyStr),
|
|
||||||
m_deltaPowerStr(other.m_deltaPowerStr)
|
|
||||||
{}
|
|
||||||
};
|
|
||||||
QList<HistogramMarker> m_histogramMarkers;
|
|
||||||
|
|
||||||
struct WaterfallMarker {
|
|
||||||
QPointF m_point;
|
|
||||||
float m_frequency;
|
|
||||||
float m_time;
|
|
||||||
QString m_frequencyStr;
|
|
||||||
QString m_timeStr;
|
|
||||||
QString m_deltaFrequencyStr;
|
|
||||||
QString m_deltaTimeStr;
|
|
||||||
WaterfallMarker() :
|
|
||||||
m_point(0, 0),
|
|
||||||
m_frequency(0),
|
|
||||||
m_time(0),
|
|
||||||
m_frequencyStr(),
|
|
||||||
m_timeStr(),
|
|
||||||
m_deltaFrequencyStr(),
|
|
||||||
m_deltaTimeStr()
|
|
||||||
{}
|
|
||||||
WaterfallMarker(
|
|
||||||
const QPointF& point,
|
|
||||||
float frequency,
|
|
||||||
float time,
|
|
||||||
const QString& frequencyStr,
|
|
||||||
const QString& timeStr,
|
|
||||||
const QString& deltaFrequencyStr,
|
|
||||||
const QString& deltaTimeStr
|
|
||||||
) :
|
|
||||||
m_point(point),
|
|
||||||
m_frequency(frequency),
|
|
||||||
m_time(time),
|
|
||||||
m_frequencyStr(frequencyStr),
|
|
||||||
m_timeStr(timeStr),
|
|
||||||
m_deltaFrequencyStr(deltaFrequencyStr),
|
|
||||||
m_deltaTimeStr(deltaTimeStr)
|
|
||||||
{}
|
|
||||||
WaterfallMarker(const WaterfallMarker& other) :
|
|
||||||
m_point(other.m_point),
|
|
||||||
m_frequency(other.m_frequency),
|
|
||||||
m_time(other.m_time),
|
|
||||||
m_frequencyStr(other.m_frequencyStr),
|
|
||||||
m_timeStr(other.m_timeStr),
|
|
||||||
m_deltaFrequencyStr(other.m_deltaFrequencyStr),
|
|
||||||
m_deltaTimeStr(other.m_deltaTimeStr)
|
|
||||||
{}
|
|
||||||
};
|
|
||||||
QList<WaterfallMarker> m_waterfallMarkers;
|
|
||||||
|
|
||||||
CursorState m_cursorState;
|
CursorState m_cursorState;
|
||||||
int m_cursorChannel;
|
int m_cursorChannel;
|
||||||
|
124
sdrgui/gui/spectrummarkers.h
Normal file
124
sdrgui/gui/spectrummarkers.h
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2021 Edouard Griffiths, F4EXB //
|
||||||
|
// //
|
||||||
|
// Symbol synchronizer or symbol clock recovery mostly encapsulating //
|
||||||
|
// liquid-dsp's symsync "object" //
|
||||||
|
// //
|
||||||
|
// This program is free software; you can redistribute it and/or modify //
|
||||||
|
// it under the terms of the GNU General Public License as published by //
|
||||||
|
// the Free Software Foundation as version 3 of the License, or //
|
||||||
|
// (at your option) any later version. //
|
||||||
|
// //
|
||||||
|
// This program is distributed in the hope that it will be useful, //
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||||
|
// GNU General Public License V3 for more details. //
|
||||||
|
// //
|
||||||
|
// You should have received a copy of the GNU General Public License //
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef INCLUDE_SPECTRUMMARKERS_H
|
||||||
|
#define INCLUDE_SPECTRUMMARKERS_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
#include <QPointF>
|
||||||
|
|
||||||
|
enum SpectrumHistogramMarkerType {
|
||||||
|
SpectrumHistogramMarkerTypeManual,
|
||||||
|
SpectrumHistogramMarkerTypePower
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SpectrumHistogramMarker
|
||||||
|
{
|
||||||
|
QPointF m_point;
|
||||||
|
float m_frequency;
|
||||||
|
int m_fftBin;
|
||||||
|
float m_power;
|
||||||
|
SpectrumHistogramMarkerType m_markerType;
|
||||||
|
QString m_frequencyStr;
|
||||||
|
QString m_powerStr;
|
||||||
|
QString m_deltaFrequencyStr;
|
||||||
|
QString m_deltaPowerStr;
|
||||||
|
|
||||||
|
SpectrumHistogramMarker() :
|
||||||
|
m_point(0, 0),
|
||||||
|
m_frequency(0),
|
||||||
|
m_fftBin(0),
|
||||||
|
m_power(0),
|
||||||
|
m_markerType(SpectrumHistogramMarkerTypeManual),
|
||||||
|
m_frequencyStr(),
|
||||||
|
m_powerStr(),
|
||||||
|
m_deltaFrequencyStr(),
|
||||||
|
m_deltaPowerStr()
|
||||||
|
{}
|
||||||
|
|
||||||
|
SpectrumHistogramMarker(
|
||||||
|
const QPointF& point,
|
||||||
|
float frequency,
|
||||||
|
int fftBin,
|
||||||
|
float power,
|
||||||
|
SpectrumHistogramMarkerType markerType,
|
||||||
|
const QString& frequencyStr,
|
||||||
|
const QString& powerStr,
|
||||||
|
const QString& deltaFrequencyStr,
|
||||||
|
const QString& deltaPowerStr
|
||||||
|
) :
|
||||||
|
m_point(point),
|
||||||
|
m_frequency(frequency),
|
||||||
|
m_fftBin(fftBin),
|
||||||
|
m_power(power),
|
||||||
|
m_markerType(markerType),
|
||||||
|
m_frequencyStr(frequencyStr),
|
||||||
|
m_powerStr(powerStr),
|
||||||
|
m_deltaFrequencyStr(deltaFrequencyStr),
|
||||||
|
m_deltaPowerStr(deltaPowerStr)
|
||||||
|
{}
|
||||||
|
|
||||||
|
SpectrumHistogramMarker(const SpectrumHistogramMarker& other) = default;
|
||||||
|
SpectrumHistogramMarker& operator=(const SpectrumHistogramMarker&) = default;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SpectrumWaterfallMarker
|
||||||
|
{
|
||||||
|
QPointF m_point;
|
||||||
|
float m_frequency;
|
||||||
|
float m_time;
|
||||||
|
QString m_frequencyStr;
|
||||||
|
QString m_timeStr;
|
||||||
|
QString m_deltaFrequencyStr;
|
||||||
|
QString m_deltaTimeStr;
|
||||||
|
|
||||||
|
SpectrumWaterfallMarker() :
|
||||||
|
m_point(0, 0),
|
||||||
|
m_frequency(0),
|
||||||
|
m_time(0),
|
||||||
|
m_frequencyStr(),
|
||||||
|
m_timeStr(),
|
||||||
|
m_deltaFrequencyStr(),
|
||||||
|
m_deltaTimeStr()
|
||||||
|
{}
|
||||||
|
|
||||||
|
SpectrumWaterfallMarker(
|
||||||
|
const QPointF& point,
|
||||||
|
float frequency,
|
||||||
|
float time,
|
||||||
|
const QString& frequencyStr,
|
||||||
|
const QString& timeStr,
|
||||||
|
const QString& deltaFrequencyStr,
|
||||||
|
const QString& deltaTimeStr
|
||||||
|
) :
|
||||||
|
m_point(point),
|
||||||
|
m_frequency(frequency),
|
||||||
|
m_time(time),
|
||||||
|
m_frequencyStr(frequencyStr),
|
||||||
|
m_timeStr(timeStr),
|
||||||
|
m_deltaFrequencyStr(deltaFrequencyStr),
|
||||||
|
m_deltaTimeStr(deltaTimeStr)
|
||||||
|
{}
|
||||||
|
|
||||||
|
SpectrumWaterfallMarker(const SpectrumWaterfallMarker& other) = default;
|
||||||
|
SpectrumWaterfallMarker& operator=(const SpectrumWaterfallMarker&) = default;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // INCLUDE_SPECTRUMMARKERS_H
|
Loading…
Reference in New Issue
Block a user