1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-17 05:41:56 -05:00

GLSpectrum: added markers. Implements #557

This commit is contained in:
f4exb 2020-07-05 03:25:44 +02:00
parent a4a16265a3
commit 49c6027b8e
6 changed files with 780 additions and 211 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 KiB

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -126,6 +126,103 @@ private:
CSChannel,
CSChannelMoving
};
struct HistogramMarker {
QPointF m_point;
float m_frequency;
float m_power;
QString m_frequencyStr;
QString m_powerStr;
QString m_deltaFrequencyStr;
QString m_deltaPowerStr;
HistogramMarker() :
m_point(0, 0),
m_frequency(0),
m_power(0),
m_frequencyStr(),
m_powerStr(),
m_deltaFrequencyStr(),
m_deltaPowerStr()
{}
HistogramMarker(
const QPointF& point,
float frequency,
float power,
const QString& frequencyStr,
const QString& powerStr,
const QString& deltaFrequencyStr,
const QString& deltaPowerStr
) :
m_point(point),
m_frequency(frequency),
m_power(power),
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_power(other.m_power),
m_frequencyStr(other.m_frequencyStr),
m_powerStr(other.m_powerStr),
m_deltaFrequencyStr(other.m_deltaFrequencyStr),
m_deltaPowerStr(other.m_deltaPowerStr)
{}
explicit operator HistogramMarker() const {
return HistogramMarker{static_cast<HistogramMarker>(*this)};
}
};
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)
{}
explicit operator WaterfallMarker() const {
return WaterfallMarker{static_cast<WaterfallMarker>(*this)};
}
};
QList<WaterfallMarker> m_waterfallMarkers;
CursorState m_cursorState;
int m_cursorChannel;
@ -158,12 +255,21 @@ private:
Real m_waterfallShare;
int m_leftMargin;
int m_rightMargin;
int m_topMargin;
int m_frequencyScaleHeight;
int m_histogramHeight;
int m_waterfallHeight;
int m_bottomMargin;
QFont m_textOverlayFont;
QPixmap m_leftMarginPixmap;
QPixmap m_frequencyPixmap;
ScaleEngine m_timeScale;
ScaleEngine m_powerScale;
ScaleEngine m_frequencyScale;
QRectF m_histogramRect;
QRect m_frequencyScaleRect;
QRectF m_waterfallRect;
QMatrix4x4 m_glFrequencyScaleBoxMatrix;
QMatrix4x4 m_glLeftScaleBoxMatrix;
@ -195,6 +301,7 @@ private:
GLShaderTextured m_glShaderFrequencyScale;
GLShaderTextured m_glShaderWaterfall;
GLShaderTextured m_glShaderHistogram;
GLShaderTextured m_glShaderTextOverlay;
int m_matrixLoc;
int m_colorLoc;
IncrementalArray<GLfloat> m_q3TickTime;
@ -224,6 +331,20 @@ private:
void enterEvent(QEvent* event);
void leaveEvent(QEvent* event);
QString displayScaled(int64_t value, char type, int precision, bool showMult);
QString displayScaledF(float value, char type, int precision, bool showMult);
QString displayScaledM(float value, char type, int precision, bool showMult);
int getPrecision(int value);
void drawTextOverlay( //!< Draws a text overlay
const QString& text,
const QColor& color,
const QFont& font,
float shiftX,
float shiftY,
bool leftHalf,
bool topHalf,
const QRectF& glRect);
private slots:
void cleanup();
void tick();

View File

@ -36,6 +36,26 @@ public:
};
typedef QList<Tick> TickList;
ScaleEngine();
void setOrientation(Qt::Orientation orientation);
void setFont(const QFont& font);
void setSize(float size);
float getSize() { return m_size; }
void setRange(Unit::Physical physicalUnit, float rangeMin, float rangeMax);
float getRange() const { return m_rangeMax - m_rangeMin; }
void setMakeOpposite(bool makeOpposite) { m_makeOpposite = makeOpposite; }
void setFixedDecimalPlaces(int decimalPlaces) { m_fixedDecimalPlaces =decimalPlaces; }
float getPosFromValue(double value);
float getValueFromPos(double pos);
const TickList& getTickList();
QString getRangeMinStr();
QString getRangeMaxStr();
float getScaleWidth();
private:
// base configuration
Qt::Orientation m_orientation;
@ -70,26 +90,6 @@ private:
double majorTickValue(int tick);
double minorTickValue(int tick);
public:
ScaleEngine();
void setOrientation(Qt::Orientation orientation);
void setFont(const QFont& font);
void setSize(float size);
float getSize() { return m_size; }
void setRange(Unit::Physical physicalUnit, float rangeMin, float rangeMax);
void setMakeOpposite(bool makeOpposite) { m_makeOpposite = makeOpposite; }
void setFixedDecimalPlaces(int decimalPlaces) { m_fixedDecimalPlaces =decimalPlaces; }
float getPosFromValue(double value);
float getValueFromPos(double pos);
const TickList& getTickList();
QString getRangeMinStr();
QString getRangeMaxStr();
float getScaleWidth();
};
#endif // INCLUDE_SCALEENGINE_H

View File

@ -829,6 +829,20 @@ This shows the spectrum in the passband returned from the sampling device possib
The spectrum display is controlled by the display control (4).
<h4>Spectrum markers</h4>
![Spectrum Markers](../doc/img/Spectrum_Markers.png)
Left click while pressing the Shift key in the spectrum or waterfall window to set the markers. Right click in the same window to remove the last entered marker.
There is a maximum of two markers on each window with a different status:
- the legend of the first marker is the frequency (2) and power (1) or delay (5). The frequency legend appears on the spectrum side closest to the frequency rule.
- the legend of the second marker is the frequency difference with the first marker (3 or 6) and the difference in power (4) or time (7). It appears on the spectrum opposite side of the corresponding first marker legend.
Frequency difference units are Hz suffixed with a multiplier suffix k, M or G for kHz, MHz or GHz respectively.
Time units are seconds suffixed with a divisor suffix m, u, n, p for ms, us, ns or ps respectively.
<h3>8. Status</h3>
![Main Window status](../doc/img/MainWindow_status.png)