From 5327856827a6b76d752c54c835ced456f80ba6c2 Mon Sep 17 00:00:00 2001 From: f4exb Date: Tue, 15 May 2018 00:30:01 +0200 Subject: [PATCH] Channel Analyzer NG: toggle polar points/segments display --- sdrgui/gui/glscopeng.cpp | 9 ++++-- sdrgui/gui/glscopeng.h | 2 ++ sdrgui/gui/glscopenggui.cpp | 35 +++++++++++++++++++++ sdrgui/gui/glscopenggui.h | 1 + sdrgui/gui/glscopenggui.ui | 58 ++++++++++++++++++++++++++++++++++- sdrgui/gui/glshadersimple.cpp | 5 +++ sdrgui/gui/glshadersimple.h | 1 + 7 files changed, 108 insertions(+), 3 deletions(-) diff --git a/sdrgui/gui/glscopeng.cpp b/sdrgui/gui/glscopeng.cpp index 3bda3ff10..e2cae6be7 100644 --- a/sdrgui/gui/glscopeng.cpp +++ b/sdrgui/gui/glscopeng.cpp @@ -42,7 +42,8 @@ GLScopeNG::GLScopeNG(QWidget* parent) : m_timeOffset(0), m_focusedTraceIndex(0), m_displayGridIntensity(10), - m_displayTraceIntensity(50) + m_displayTraceIntensity(50), + m_displayXYPoints(false) { setAttribute(Qt::WA_OpaquePaintEvent); connect(&m_timer, SIGNAL(timeout()), this, SLOT(tick())); @@ -910,7 +911,11 @@ void GLScopeNG::paintGL() mat.setToIdentity(); mat.translate(-1.0f + 2.0f * rectX, 1.0f - 2.0f * rectY); mat.scale(2.0f * rectW, -2.0f * rectH); - m_glShaderSimple.drawPolyline(mat, color, q3, end -start); + if (m_displayXYPoints) { + m_glShaderSimple.drawPoints(mat, color, q3, end -start); + } else { + m_glShaderSimple.drawPolyline(mat, color, q3, end -start); + } } // XY polar display } // trace length > 0 } // XY mixed + polar display diff --git a/sdrgui/gui/glscopeng.h b/sdrgui/gui/glscopeng.h index 929afe5b4..12f1cca99 100644 --- a/sdrgui/gui/glscopeng.h +++ b/sdrgui/gui/glscopeng.h @@ -74,6 +74,7 @@ public: bool getDataChanged() const { return m_dataChanged; } DisplayMode getDisplayMode() const { return m_displayMode; } + void setDisplayXYPoints(bool value) { m_displayXYPoints = value; } signals: void sampleRateChanged(int); @@ -117,6 +118,7 @@ private: int m_displayGridIntensity; int m_displayTraceIntensity; + bool m_displayXYPoints; ScaleEngine m_x1Scale; //!< Display #1 X scale. Time scale ScaleEngine m_x2Scale; //!< Display #2 X scale. Time scale diff --git a/sdrgui/gui/glscopenggui.cpp b/sdrgui/gui/glscopenggui.cpp index 737d3ff85..55da3719b 100644 --- a/sdrgui/gui/glscopenggui.cpp +++ b/sdrgui/gui/glscopenggui.cpp @@ -422,6 +422,12 @@ void GLScopeNGGUI::on_onlyX_toggled(bool checked) ui->polar->setChecked(false); m_glScope->setDisplayMode(GLScopeNG::DisplayX); } + else + { + if (!ui->onlyY->isChecked() && !ui->horizontalXY->isChecked() && !ui->verticalXY->isChecked() && !ui->polar->isChecked()) { + ui->polar->setChecked(true); + } + } } void GLScopeNGGUI::on_onlyY_toggled(bool checked) @@ -434,6 +440,12 @@ void GLScopeNGGUI::on_onlyY_toggled(bool checked) ui->polar->setChecked(false); m_glScope->setDisplayMode(GLScopeNG::DisplayY); } + else + { + if (!ui->onlyX->isChecked() && !ui->horizontalXY->isChecked() && !ui->verticalXY->isChecked() && !ui->polar->isChecked()) { + ui->polar->setChecked(true); + } + } } void GLScopeNGGUI::on_horizontalXY_toggled(bool checked) @@ -446,6 +458,12 @@ void GLScopeNGGUI::on_horizontalXY_toggled(bool checked) ui->polar->setChecked(false); m_glScope->setDisplayMode(GLScopeNG::DisplayXYH); } + else + { + if (!ui->onlyX->isChecked() && !ui->onlyY->isChecked() && !ui->verticalXY->isChecked() && !ui->polar->isChecked()) { + ui->polar->setChecked(true); + } + } } void GLScopeNGGUI::on_verticalXY_toggled(bool checked) @@ -458,6 +476,12 @@ void GLScopeNGGUI::on_verticalXY_toggled(bool checked) ui->polar->setChecked(false); m_glScope->setDisplayMode(GLScopeNG::DisplayXYV); } + else + { + if (!ui->onlyX->isChecked() && !ui->onlyY->isChecked() && !ui->horizontalXY->isChecked() && !ui->polar->isChecked()) { + ui->polar->setChecked(true); + } + } } void GLScopeNGGUI::on_polar_toggled(bool checked) @@ -470,6 +494,17 @@ void GLScopeNGGUI::on_polar_toggled(bool checked) ui->verticalXY->setChecked(false); m_glScope->setDisplayMode(GLScopeNG::DisplayPol); } + else + { + if (!ui->onlyX->isChecked() && !ui->onlyY->isChecked() && !ui->horizontalXY->isChecked() && !ui->verticalXY->isChecked()) { + ui->polar->setChecked(true); + } + } +} + +void GLScopeNGGUI::on_polarPoints_toggled(bool checked) +{ + m_glScope->setDisplayXYPoints(checked); } void GLScopeNGGUI::on_traceIntensity_valueChanged(int value) diff --git a/sdrgui/gui/glscopenggui.h b/sdrgui/gui/glscopenggui.h index 43f6ad660..fb98c0c29 100644 --- a/sdrgui/gui/glscopenggui.h +++ b/sdrgui/gui/glscopenggui.h @@ -191,6 +191,7 @@ private slots: void on_horizontalXY_toggled(bool checked); void on_verticalXY_toggled(bool checked); void on_polar_toggled(bool checked); + void on_polarPoints_toggled(bool checked); void on_traceIntensity_valueChanged(int value); void on_gridIntensity_valueChanged(int value); void on_time_valueChanged(int value); diff --git a/sdrgui/gui/glscopenggui.ui b/sdrgui/gui/glscopenggui.ui index e7a8afe70..0f9c0b679 100644 --- a/sdrgui/gui/glscopenggui.ui +++ b/sdrgui/gui/glscopenggui.ui @@ -206,6 +206,62 @@ + + + 24 + 24 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 190 + 190 + 190 + + + + + + + + Display XY traces and polar trace + + + XY + + + true + + + + + 24 @@ -213,7 +269,7 @@ - Display XY traces and polar trace + Toggle points or segments display for polar trace ... diff --git a/sdrgui/gui/glshadersimple.cpp b/sdrgui/gui/glshadersimple.cpp index 913dc03e4..627c0bcde 100644 --- a/sdrgui/gui/glshadersimple.cpp +++ b/sdrgui/gui/glshadersimple.cpp @@ -59,6 +59,11 @@ void GLShaderSimple::initializeGL() m_program->release(); } +void GLShaderSimple::drawPoints(const QMatrix4x4& transformMatrix, const QVector4D& color, GLfloat *vertices, int nbVertices) +{ + draw(GL_POINTS, transformMatrix, color, vertices, nbVertices); +} + void GLShaderSimple::drawPolyline(const QMatrix4x4& transformMatrix, const QVector4D& color, GLfloat *vertices, int nbVertices) { draw(GL_LINE_STRIP, transformMatrix, color, vertices, nbVertices); diff --git a/sdrgui/gui/glshadersimple.h b/sdrgui/gui/glshadersimple.h index 583e95c15..84c5a43fd 100644 --- a/sdrgui/gui/glshadersimple.h +++ b/sdrgui/gui/glshadersimple.h @@ -34,6 +34,7 @@ public: ~GLShaderSimple(); void initializeGL(); + void drawPoints(const QMatrix4x4& transformMatrix, const QVector4D& color, GLfloat *vertices, int nbVertices); void drawPolyline(const QMatrix4x4& transformMatrix, const QVector4D& color, GLfloat *vertices, int nbVertices); void drawSegments(const QMatrix4x4& transformMatrix, const QVector4D& color, GLfloat *vertices, int nbVertices); void drawContour(const QMatrix4x4& transformMatrix, const QVector4D& color, GLfloat *vertices, int nbVertices);