From 4d9df69e1775c0b4f1581941317ad8b0b7169de0 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Tue, 9 Jun 2015 15:41:27 +0000 Subject: [PATCH] Gradually activating EchoGraph's binsPerPixel. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5562 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- echograph.cpp | 8 ++++++-- echograph.ui | 4 ++-- echoplot.cpp | 30 +++++++++++++++++------------- widegraph.cpp | 1 - 4 files changed, 25 insertions(+), 18 deletions(-) diff --git a/echograph.cpp b/echograph.cpp index fce457d07..1a33ecc5a 100644 --- a/echograph.cpp +++ b/echograph.cpp @@ -27,8 +27,12 @@ EchoGraph::EchoGraph(QSettings * settings, QWidget *parent) : ui->echoPlot->setPlotGain(m_settings->value("PlotGain", 0).toInt()); ui->zeroSlider->setValue(ui->echoPlot->getPlotZero()); ui->gainSlider->setValue(ui->echoPlot->getPlotGain()); - ui->smoothSpinBox->setValue(m_settings->value("Smooth",0).toInt()); - ui->binsPerPixelSpinBox->setValue(m_settings->value("EchoBPP",0).toInt()); + int n=m_settings->value("Smooth",0).toInt(); + ui->echoPlot->m_smooth=n; + ui->smoothSpinBox->setValue(n); + n=m_settings->value("EchoBPP",0).toInt(); + ui->echoPlot->m_binsPerPixel=n; + ui->binsPerPixelSpinBox->setValue(n); ui->echoPlot->m_blue=m_settings->value("BlueCurve",false).toBool(); ui->cbBlue->setChecked(ui->echoPlot->m_blue); m_settings->endGroup(); diff --git a/echograph.ui b/echograph.ui index 8522cca83..1a820f2b4 100644 --- a/echograph.ui +++ b/echograph.ui @@ -154,10 +154,10 @@ - -100 + -50 - 100 + 150 Qt::Horizontal diff --git a/echoplot.cpp b/echoplot.cpp index 3a9a472be..22540b506 100644 --- a/echoplot.cpp +++ b/echoplot.cpp @@ -53,19 +53,14 @@ void EPlotter::resizeEvent(QResizeEvent* ) //resizeEvent() m_h = m_Size.height(); m_h1=30; m_h2=m_h-m_h1; - - qDebug() << m_h << m_h1 << m_h2; - m_2DPixmap = QPixmap(m_Size.width(), m_h2); m_2DPixmap.fill(Qt::black); m_OverlayPixmap = QPixmap(m_Size.width(), m_h2); m_OverlayPixmap.fill(Qt::black); - m_2DPixmap.fill(Qt::black); m_ScalePixmap = QPixmap(m_w,30); m_ScalePixmap.fill(Qt::white); - - m_fSpan=m_w*m_fftBinWidth; + m_fSpan=m_w*m_fftBinWidth*m_binsPerPixel; m_StartFreq=50 * int((-0.5*m_fSpan)/50.0 - 0.5); } DrawOverlay(); @@ -98,7 +93,7 @@ void EPlotter::draw() //draw() QPen penBlue(QColor(0,255,255),1); QPen penRed(Qt::red,1); j=0; - int i0=1000 + int(m_StartFreq/m_fftBinWidth); + int i0=1000 + int(m_StartFreq/(m_fftBinWidth*m_binsPerPixel)); for(i=0; i<2000; i++) { blue[i]=echocom_.blue[i]; red[i]=echocom_.red[i]; @@ -115,7 +110,7 @@ void EPlotter::draw() //draw() painter2D.setPen(penBlue); j=0; for(i=0; i250) m_freqPerDiv=50; - float pixPerHdiv = m_freqPerDiv/m_fftBinWidth; + if(m_fSpan>500) m_freqPerDiv=100; + if(m_fSpan>1000) m_freqPerDiv=200; + if(m_fSpan>2000) m_freqPerDiv=500; + +// m_StartFreq=50 * int((-0.5*m_fSpan)/50.0 - 0.5); + m_StartFreq=m_freqPerDiv * int((-0.5*m_fSpan)/m_freqPerDiv - 0.5); + + qDebug() << m_fSpan << m_freqPerDiv << m_StartFreq; + + float pixPerHdiv = m_freqPerDiv/(m_fftBinWidth*m_binsPerPixel); float pixPerVdiv = float(m_h2)/float(VERT_DIVS); - m_hdivs = m_w*m_fftBinWidth/m_freqPerDiv + 0.9999; + m_hdivs = m_w*m_fftBinWidth*m_binsPerPixel/m_freqPerDiv + 0.9999; painter.setPen(QPen(Qt::white, 1,Qt::DotLine)); for( int i=1; iwidePlot->setMode(mode); ui->widePlot->DrawOverlay(); ui->widePlot->update(); - qDebug() << "WideGraph::setMode" << m_mode; } void WideGraph::setSubMode(int n) //setSubMode