kopia lustrzana https://github.com/f4exb/sdrangel
Spectrum markers: implemented histogram markers max power hold
rodzic
111c8d4a99
commit
7a00e51dc6
|
@ -1180,13 +1180,36 @@ void GLSpectrum::drawMarkers()
|
||||||
|
|
||||||
if (m_histogramMarkers.at(i).m_markerType == SpectrumHistogramMarkerTypePower)
|
if (m_histogramMarkers.at(i).m_markerType == SpectrumHistogramMarkerTypePower)
|
||||||
{
|
{
|
||||||
|
float power = m_currentSpectrum[m_histogramMarkers.at(i).m_fftBin];
|
||||||
ypoint.ry() =
|
ypoint.ry() =
|
||||||
(m_powerScale.getRangeMax() - m_currentSpectrum[m_histogramMarkers.at(i).m_fftBin]) / m_powerScale.getRange();
|
(m_powerScale.getRangeMax() - power) / m_powerScale.getRange();
|
||||||
ypoint.ry() = ypoint.ry() < 0 ?
|
ypoint.ry() = ypoint.ry() < 0 ?
|
||||||
0 : ypoint.ry() > 1 ?
|
0 : ypoint.ry() > 1 ?
|
||||||
1 : ypoint.ry();
|
1 : ypoint.ry();
|
||||||
powerStr = displayScaledF(
|
powerStr = displayScaledF(
|
||||||
m_currentSpectrum[m_histogramMarkers.at(i).m_fftBin],
|
power,
|
||||||
|
m_linear ? 'e' : 'f',
|
||||||
|
m_linear ? 3 : 1,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if (m_histogramMarkers.at(i).m_markerType == SpectrumHistogramMarkerTypePowerMax)
|
||||||
|
{
|
||||||
|
float power = m_currentSpectrum[m_histogramMarkers.at(i).m_fftBin];
|
||||||
|
|
||||||
|
if ((m_histogramMarkers.at(i).m_holdReset) || (power > m_histogramMarkers[i].m_powerMax))
|
||||||
|
{
|
||||||
|
m_histogramMarkers[i].m_powerMax = power;
|
||||||
|
m_histogramMarkers[i].m_holdReset = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ypoint.ry() =
|
||||||
|
(m_powerScale.getRangeMax() - m_histogramMarkers[i].m_powerMax) / m_powerScale.getRange();
|
||||||
|
ypoint.ry() = ypoint.ry() < 0 ?
|
||||||
|
0 : ypoint.ry() > 1 ?
|
||||||
|
1 : ypoint.ry();
|
||||||
|
powerStr = displayScaledF(
|
||||||
|
m_histogramMarkers[i].m_powerMax,
|
||||||
m_linear ? 'e' : 'f',
|
m_linear ? 'e' : 'f',
|
||||||
m_linear ? 3 : 1,
|
m_linear ? 3 : 1,
|
||||||
false
|
false
|
||||||
|
@ -1230,12 +1253,24 @@ void GLSpectrum::drawMarkers()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
textColor.setAlpha(192);
|
textColor.setAlpha(192);
|
||||||
float power0 = m_histogramMarkers.at(0).m_markerType == SpectrumHistogramMarkerTypePower ?
|
float power0, poweri;
|
||||||
m_currentSpectrum[m_histogramMarkers.at(0).m_fftBin] :
|
|
||||||
m_linear ? m_histogramMarkers.at(0).m_power : CalcDb::dbPower(m_histogramMarkers.at(0).m_power);
|
if (m_histogramMarkers.at(0).m_markerType == SpectrumHistogramMarkerTypePower) {
|
||||||
float poweri = m_histogramMarkers.at(i).m_markerType == SpectrumHistogramMarkerTypePower ?
|
power0 = m_currentSpectrum[m_histogramMarkers.at(0).m_fftBin];
|
||||||
m_currentSpectrum[m_histogramMarkers.at(i).m_fftBin] :
|
} else if (m_histogramMarkers.at(0).m_markerType == SpectrumHistogramMarkerTypePowerMax) {
|
||||||
m_linear ? m_histogramMarkers.at(i).m_power : CalcDb::dbPower(m_histogramMarkers.at(i).m_power);
|
power0 = m_histogramMarkers.at(0).m_powerMax;
|
||||||
|
} else {
|
||||||
|
power0 = m_linear ? m_histogramMarkers.at(0).m_power : CalcDb::dbPower(m_histogramMarkers.at(0).m_power);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_histogramMarkers.at(i).m_markerType == SpectrumHistogramMarkerTypePower) {
|
||||||
|
poweri = m_currentSpectrum[m_histogramMarkers.at(i).m_fftBin];
|
||||||
|
} else if (m_histogramMarkers.at(i).m_markerType == SpectrumHistogramMarkerTypePowerMax) {
|
||||||
|
poweri = m_histogramMarkers.at(i).m_powerMax;
|
||||||
|
} else {
|
||||||
|
poweri = m_linear ? m_histogramMarkers.at(i).m_power : CalcDb::dbPower(m_histogramMarkers.at(i).m_power);
|
||||||
|
}
|
||||||
|
|
||||||
QString deltaPowerStr;
|
QString deltaPowerStr;
|
||||||
|
|
||||||
if (m_linear) {
|
if (m_linear) {
|
||||||
|
|
|
@ -27,7 +27,8 @@
|
||||||
|
|
||||||
enum SpectrumHistogramMarkerType {
|
enum SpectrumHistogramMarkerType {
|
||||||
SpectrumHistogramMarkerTypeManual,
|
SpectrumHistogramMarkerTypeManual,
|
||||||
SpectrumHistogramMarkerTypePower
|
SpectrumHistogramMarkerTypePower,
|
||||||
|
SpectrumHistogramMarkerTypePowerMax
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SpectrumHistogramMarker
|
struct SpectrumHistogramMarker
|
||||||
|
@ -36,6 +37,8 @@ struct SpectrumHistogramMarker
|
||||||
float m_frequency;
|
float m_frequency;
|
||||||
int m_fftBin;
|
int m_fftBin;
|
||||||
float m_power;
|
float m_power;
|
||||||
|
bool m_holdReset;
|
||||||
|
float m_powerMax;
|
||||||
SpectrumHistogramMarkerType m_markerType;
|
SpectrumHistogramMarkerType m_markerType;
|
||||||
QColor m_markerColor;
|
QColor m_markerColor;
|
||||||
QString m_frequencyStr;
|
QString m_frequencyStr;
|
||||||
|
@ -49,6 +52,8 @@ struct SpectrumHistogramMarker
|
||||||
m_frequency(0),
|
m_frequency(0),
|
||||||
m_fftBin(0),
|
m_fftBin(0),
|
||||||
m_power(0),
|
m_power(0),
|
||||||
|
m_holdReset(true),
|
||||||
|
m_powerMax(0),
|
||||||
m_markerType(SpectrumHistogramMarkerTypeManual),
|
m_markerType(SpectrumHistogramMarkerTypeManual),
|
||||||
m_markerColor(QColorConstants::White),
|
m_markerColor(QColorConstants::White),
|
||||||
m_frequencyStr(),
|
m_frequencyStr(),
|
||||||
|
@ -62,6 +67,8 @@ struct SpectrumHistogramMarker
|
||||||
float frequency,
|
float frequency,
|
||||||
int fftBin,
|
int fftBin,
|
||||||
float power,
|
float power,
|
||||||
|
bool holdReset,
|
||||||
|
float powerMax,
|
||||||
SpectrumHistogramMarkerType markerType,
|
SpectrumHistogramMarkerType markerType,
|
||||||
QColor markerColor,
|
QColor markerColor,
|
||||||
const QString& frequencyStr,
|
const QString& frequencyStr,
|
||||||
|
@ -73,6 +80,8 @@ struct SpectrumHistogramMarker
|
||||||
m_frequency(frequency),
|
m_frequency(frequency),
|
||||||
m_fftBin(fftBin),
|
m_fftBin(fftBin),
|
||||||
m_power(power),
|
m_power(power),
|
||||||
|
m_holdReset(holdReset),
|
||||||
|
m_powerMax(powerMax),
|
||||||
m_markerType(markerType),
|
m_markerType(markerType),
|
||||||
m_markerColor(markerColor),
|
m_markerColor(markerColor),
|
||||||
m_frequencyStr(frequencyStr),
|
m_frequencyStr(frequencyStr),
|
||||||
|
|
|
@ -250,6 +250,15 @@ void SpectrumMarkersDialog::on_powerMode_currentIndexChanged(int index)
|
||||||
m_histogramMarkers[m_histogramMarkerIndex].m_markerType = (SpectrumHistogramMarkerType) index;
|
m_histogramMarkers[m_histogramMarkerIndex].m_markerType = (SpectrumHistogramMarkerType) index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SpectrumMarkersDialog::on_powerHoldReset_clicked()
|
||||||
|
{
|
||||||
|
if (m_histogramMarkers.size() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_histogramMarkers[m_histogramMarkerIndex].m_holdReset = true;
|
||||||
|
}
|
||||||
|
|
||||||
void SpectrumMarkersDialog::on_wMarkerFrequency_changed(qint64 value)
|
void SpectrumMarkersDialog::on_wMarkerFrequency_changed(qint64 value)
|
||||||
{
|
{
|
||||||
if (m_waterfallMarkers.size() == 0) {
|
if (m_waterfallMarkers.size() == 0) {
|
||||||
|
|
|
@ -68,6 +68,7 @@ private slots:
|
||||||
void on_markerAdd_clicked();
|
void on_markerAdd_clicked();
|
||||||
void on_markerDel_clicked();
|
void on_markerDel_clicked();
|
||||||
void on_powerMode_currentIndexChanged(int index);
|
void on_powerMode_currentIndexChanged(int index);
|
||||||
|
void on_powerHoldReset_clicked();
|
||||||
void on_wMarkerFrequency_changed(qint64 value);
|
void on_wMarkerFrequency_changed(qint64 value);
|
||||||
void on_timeCoarse_valueChanged(int value);
|
void on_timeCoarse_valueChanged(int value);
|
||||||
void on_timeFine_valueChanged(int value);
|
void on_timeFine_valueChanged(int value);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>390</width>
|
<width>418</width>
|
||||||
<height>201</height>
|
<height>201</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>10</y>
|
<y>10</y>
|
||||||
<width>361</width>
|
<width>391</width>
|
||||||
<height>74</height>
|
<height>74</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -367,6 +367,22 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="powerHoldReset">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>24</width>
|
||||||
|
<height>24</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Reset power max hold</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>R</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="powerMode">
|
<widget class="QComboBox" name="powerMode">
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
|
@ -382,7 +398,12 @@
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Pow</string>
|
<string>Cur</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Max</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -449,7 +470,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>10</y>
|
<y>10</y>
|
||||||
<width>361</width>
|
<width>391</width>
|
||||||
<height>93</height>
|
<height>93</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
|
Ładowanie…
Reference in New Issue