Add an optional baseline to plots in Echo Graph.

This commit is contained in:
Joe Taylor 2022-09-01 11:20:00 -04:00
parent c1b7890f2e
commit a569d25ddb
6 changed files with 55 additions and 4 deletions

View File

@ -2,6 +2,7 @@
#include "commons.h"
#include <QSettings>
#include <QApplication>
#include <QDebug>
#include "echoplot.h"
#include "ui_echograph.h"
#include "moc_echograph.cpp"
@ -36,6 +37,7 @@ EchoGraph::EchoGraph(QSettings * settings, QWidget *parent) :
ui->binsPerPixelSpinBox->setValue(n);
ui->echoPlot->m_blue=m_settings->value("BlueCurve",false).toBool();
m_nColor=m_settings->value("EchoColors",0).toInt();
ui->cbBaseline->setChecked(m_settings->value("Baseline",false).toBool());
m_settings->endGroup();
ui->echoPlot->setColors(m_nColor);
}
@ -62,6 +64,7 @@ void EchoGraph::saveSettings()
m_settings->setValue("EchoBPP",ui->echoPlot->m_binsPerPixel);
m_settings->setValue("BlueCurve",ui->echoPlot->m_blue);
m_settings->setValue("EchoColors",m_nColor);
m_settings->setValue("Baseline",ui->cbBaseline->isChecked());
m_settings->endGroup();
}
@ -101,3 +104,13 @@ void EchoGraph::on_pbColors_clicked()
m_nColor = (m_nColor+1) % 6;
ui->echoPlot->setColors(m_nColor);
}
void EchoGraph::on_cbBaseline_toggled(bool b)
{
ui->echoPlot->setBaseline(b);
}
bool EchoGraph::baseline()
{
return ui->cbBaseline->isChecked();
}

View File

@ -23,6 +23,7 @@ public:
void plotSpec();
void saveSettings();
bool baseline();
private slots:
void on_smoothSpinBox_valueChanged(int n);
@ -30,6 +31,7 @@ private slots:
void on_zeroSlider_valueChanged(int value);
void on_binsPerPixelSpinBox_valueChanged(int n);
void on_pbColors_clicked();
void on_cbBaseline_toggled(bool b);
private:
QSettings * m_settings;

View File

@ -189,6 +189,29 @@
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="cbBaseline">
<property name="text">
<string>Baseline</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSpinBox" name="smoothSpinBox">
<property name="minimumSize">

View File

@ -127,7 +127,7 @@ void EPlotter::draw() //draw()
painter2D.setPen(penBlue);
j=0;
for(i=0; i<m_w; i++) {
y = 0.9*m_h2 - gain*(m_h/10.0)*(blue[i0+i]) - 0.01*m_h2*m_plotZero;
y = 0.9*m_h2 - gain*(m_h/10.0)*blue[i0+i] - 0.01*m_h2*m_plotZero;
LineBuf[j].setX(i);
LineBuf[j].setY(y);
j++;
@ -145,12 +145,19 @@ void EPlotter::draw() //draw()
j=0;
for(int i=0; i<m_w; i++) {
y = 0.9*m_h2 - gain*(m_h/10.0)*(red[i0+i]) - 0.01*m_h2*m_plotZero;
y = 0.9*m_h2 - gain*(m_h/10.0)*red[i0+i] - 0.01*m_h2*m_plotZero;
LineBuf[j].setX(i);
LineBuf[j].setY(y);
j++;
}
painter2D.drawPolyline(LineBuf,j);
if(m_bBaseline) {
// Draw the baseline
y = 0.9*m_h2 - 0.01*m_h2*m_plotZero;
painter2D.drawLine(0,y,m_w,y);
}
update(); //trigger a new paintEvent
}
@ -323,3 +330,9 @@ void EPlotter::setColors(qint32 n) //setSmooth()
int EPlotter::plotWidth(){return m_2DPixmap.width();}
void EPlotter::UpdateOverlay() {DrawOverlay();}
void EPlotter::setBaseline(bool b)
{
m_bBaseline=b;
draw();
}

View File

@ -36,6 +36,7 @@ public:
qint32 m_binsPerPixel;
qint32 m_nColor;
bool m_blue;
bool m_bBaseline;
void draw(); //Update the Echo plot
void SetRunningState(bool running);
@ -49,6 +50,7 @@ public:
void setSmooth(int n);
int getSmooth();
void setColors(qint32 n);
void setBaseline(bool b);
// void SetPercent2DScreen(int percent){m_Percent2DScreen=percent;}

View File

@ -10003,8 +10003,6 @@ void MainWindow::on_jt65Button_clicked()
void MainWindow::on_actionCopy_to_WSJTX_txt_triggered()
{
qDebug() << ui->decodedTextBrowser->toPlainText();
static QFile f {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("WSJT-X.txt")};
if(!f.open(QIODevice::Text | QIODevice::WriteOnly)) {
MessageBox::warning_message (this, tr ("WSJT-X.txt file error"),