1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 01:39:05 -05:00

Channel Analyzer NG: toggle polar points/segments display

This commit is contained in:
f4exb 2018-05-15 00:30:01 +02:00
parent 06c9f7f20d
commit 5327856827
7 changed files with 108 additions and 3 deletions

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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);

View File

@ -206,6 +206,62 @@
</item>
<item>
<widget class="ButtonSwitch" name="polar">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="ButtonText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>190</red>
<green>190</green>
<blue>190</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="toolTip">
<string>Display XY traces and polar trace</string>
</property>
<property name="text">
<string>XY</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="ButtonSwitch" name="polarPoints">
<property name="minimumSize">
<size>
<width>24</width>
@ -213,7 +269,7 @@
</size>
</property>
<property name="toolTip">
<string>Display XY traces and polar trace</string>
<string>Toggle points or segments display for polar trace</string>
</property>
<property name="text">
<string>...</string>

View File

@ -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);

View File

@ -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);