mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-12-23 19:25:37 -05:00
More progress on wide graph display. Mostly OK now... ??
Sometimes need to restart after mode change, etc. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@2612 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
6469c6d96e
commit
16556ec7ac
75
plotter.cpp
75
plotter.cpp
@ -111,6 +111,7 @@ void CPlotter::draw(float swide[], int i0, float splot[]) //draw()
|
||||
m_hist2[i]=0;
|
||||
}
|
||||
|
||||
// qDebug() << "A" << m_binsPerPixel << m_nSpan << m_fSpan;
|
||||
painter2D.setPen(Qt::green);
|
||||
QRect tmp(0,0,w,h);
|
||||
painter2D.fillRect(tmp,Qt::black);
|
||||
@ -194,6 +195,7 @@ void CPlotter::DrawOverlay() //DrawOverlay()
|
||||
if(m_WaterfallPixmap.isNull()) return;
|
||||
int w = m_WaterfallPixmap.width();
|
||||
int x,y;
|
||||
int nHzDiv[11]={0,50,100,200,200,200,500,500,500,500,500};
|
||||
float pixperdiv;
|
||||
|
||||
QRect rect0;
|
||||
@ -209,18 +211,25 @@ void CPlotter::DrawOverlay() //DrawOverlay()
|
||||
painter0.setPen(Qt::black);
|
||||
|
||||
double fftBinWidth=12000.0/m_nsps;
|
||||
m_binsPerPixel = (m_nSpan/fftBinWidth)/w + 0.5;
|
||||
if(m_binsPerPixel < 1) m_binsPerPixel=1;
|
||||
double FreqPerDiv=50.0;
|
||||
double df = m_binsPerPixel*fftBinWidth;
|
||||
// qDebug() << "A" << fftBinWidth << m_binsPerPixel << df;
|
||||
m_hdivs = w*df/FreqPerDiv + 0.9999;
|
||||
m_fSpan = w*df;
|
||||
// m_freqPerDiv=50*m_binsPerPixel;
|
||||
// m_freqPerDiv=nHzDiv[m_binsPerPixel];
|
||||
int n=m_fSpan/10;
|
||||
m_freqPerDiv=10;
|
||||
if(n>25) m_freqPerDiv=50;
|
||||
if(n>70) m_freqPerDiv=100;
|
||||
if(n>250) m_freqPerDiv=500;
|
||||
m_hdivs = w*df/m_freqPerDiv + 0.9999;
|
||||
qDebug() << "B" << m_binsPerPixel << df << m_freqPerDiv << pixperdiv
|
||||
<< m_hdivs << m_fSpan;
|
||||
m_ScalePixmap.fill(Qt::white);
|
||||
painter0.drawRect(0, 0, w, 30);
|
||||
|
||||
//draw tick marks on wideband (upper) scale
|
||||
pixperdiv = FreqPerDiv/df;
|
||||
// pixperdiv = m_binsPerPixel*m_freqPerDiv/df;
|
||||
pixperdiv = m_freqPerDiv/df;
|
||||
for( int i=1; i<m_hdivs; i++) { //major ticks
|
||||
x = (int)( (float)i*pixperdiv );
|
||||
painter0.drawLine(x,18,x,30);
|
||||
@ -274,14 +283,13 @@ void CPlotter::DrawOverlay() //DrawOverlay()
|
||||
painter3.setFont(Font);
|
||||
painter3.setPen(Qt::black);
|
||||
|
||||
FreqPerDiv=100;
|
||||
df = 12000.0/m_nsps;
|
||||
m_hdivs = 4400*df/FreqPerDiv + 0.9999;
|
||||
int nlabs=df*w/FreqPerDiv + 1.0;
|
||||
m_hdivs = 4400*df/m_freqPerDiv + 0.9999;
|
||||
int nlabs=df*w/m_freqPerDiv + 1.0;
|
||||
m_ZoomScalePixmap.fill(Qt::white);
|
||||
painter3.drawRect(0, 0, w, 30);
|
||||
|
||||
pixperdiv = FreqPerDiv/df;
|
||||
pixperdiv = m_freqPerDiv/df;
|
||||
for( int i=0; i<10*nlabs; i++) {
|
||||
x = i*pixperdiv/10;
|
||||
y=24;
|
||||
@ -297,36 +305,17 @@ void CPlotter::DrawOverlay() //DrawOverlay()
|
||||
painter3.drawText(rect1, Qt::AlignHCenter|Qt::AlignVCenter,
|
||||
m_HDivText[i]);
|
||||
}
|
||||
|
||||
df=m_fSample/32768.0;
|
||||
x = (m_DF + m_mode65*66*11025.0/4096.0 - m_ZoomStartFreq)/df;
|
||||
QPen pen2(Qt::red, 3); //Mark top JT65B tone with red tick
|
||||
painter3.setPen(pen2);
|
||||
painter3.drawLine(x,15,x,30);
|
||||
x = (m_DF - m_ZoomStartFreq)/df;
|
||||
QPen pen1(Qt::green, 3); //Mark DF with a green tick
|
||||
painter3.setPen(pen1);
|
||||
painter3.drawLine(x,15,x,30);
|
||||
for(int i=2; i<5; i++) { //Mark the shorthand freqs
|
||||
x = (m_DF + m_mode65*10*i*11025.0/4096.0 - m_ZoomStartFreq)/df;
|
||||
painter3.drawLine(x,20,x,30);
|
||||
}
|
||||
int x1=(m_DF - m_tol - m_ZoomStartFreq)/df;
|
||||
int x2=(m_DF + m_tol - m_ZoomStartFreq)/df;
|
||||
pen1.setWidth(6);
|
||||
painter3.drawLine(x1,28,x2,28);
|
||||
}
|
||||
|
||||
void CPlotter::MakeFrequencyStrs() //MakeFrequencyStrs
|
||||
{
|
||||
float freq;
|
||||
int i,j;
|
||||
int FreqPerDiv=50;
|
||||
|
||||
for(int i=0; i<=m_hdivs; i++) {
|
||||
freq = m_StartFreq + i*FreqPerDiv;
|
||||
freq = m_StartFreq + i*m_freqPerDiv;
|
||||
m_HDivText[i].setNum((int)freq);
|
||||
// StartFreq += FreqPerDiv;
|
||||
// StartFreq += m_freqPerDiv;
|
||||
}
|
||||
}
|
||||
|
||||
@ -402,7 +391,12 @@ void CPlotter::setTol(int n) //setTol()
|
||||
DrawOverlay();
|
||||
}
|
||||
|
||||
void CPlotter::setBinsPerPixel(int n) {m_binsPerPixel = n;} //set nbpp
|
||||
void CPlotter::setBinsPerPixel(int n) // set nbpp
|
||||
{
|
||||
m_binsPerPixel = n;
|
||||
DrawOverlay(); //Redraw scales and ticks
|
||||
update(); //trigger a new paintEvent}
|
||||
}
|
||||
|
||||
int CPlotter::binsPerPixel(){return m_binsPerPixel;} //get nbpp
|
||||
|
||||
@ -582,18 +576,6 @@ void CPlotter::setPalette(QString palette) //setPalette()
|
||||
|
||||
}
|
||||
|
||||
void CPlotter::setFsample(int n)
|
||||
{
|
||||
m_fSample=n;
|
||||
}
|
||||
|
||||
void CPlotter::setMode65(int n)
|
||||
{
|
||||
m_mode65=n;
|
||||
DrawOverlay(); //Redraw scales and ticks
|
||||
update(); //trigger a new paintEvent
|
||||
}
|
||||
|
||||
void CPlotter::set2Dspec(bool b)
|
||||
{
|
||||
// m_2Dspec=b;
|
||||
@ -606,3 +588,10 @@ double CPlotter::fGreen()
|
||||
{
|
||||
return m_fGreen;
|
||||
}
|
||||
|
||||
void CPlotter::setNsps(int n) //setNSpan()
|
||||
{
|
||||
m_nsps=n;
|
||||
DrawOverlay(); //Redraw scales and ticks
|
||||
update(); //trigger a new paintEvent}
|
||||
}
|
||||
|
@ -35,7 +35,6 @@ public:
|
||||
qint32 m_DF;
|
||||
qint32 m_tol;
|
||||
qint32 m_fCal;
|
||||
qint32 m_nsps;
|
||||
|
||||
void draw(float sw[], int i0, float splot[]); //Update the waterfalls
|
||||
void SetRunningState(bool running);
|
||||
@ -63,8 +62,8 @@ public:
|
||||
int autoZero();
|
||||
void setPalette(QString palette);
|
||||
void setFsample(int n);
|
||||
void setMode65(int n);
|
||||
void set2Dspec(bool b);
|
||||
void setNsps(int n);
|
||||
double fGreen();
|
||||
|
||||
signals:
|
||||
@ -113,9 +112,10 @@ private:
|
||||
qint32 m_z2;
|
||||
qint32 m_nkhz;
|
||||
qint32 m_fSample;
|
||||
qint32 m_mode65;
|
||||
qint32 m_i0;
|
||||
qint32 m_xClick;
|
||||
qint32 m_freqPerDiv;
|
||||
qint32 m_nsps;
|
||||
|
||||
private slots:
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
|
@ -87,7 +87,7 @@ void WideGraph::dataSink2(float s[], int nkhz, int ihsym, int ndiskdata,
|
||||
}
|
||||
|
||||
//Average spectra over specified number, m_waterfallAvg
|
||||
// qDebug() << "A" << ihsym << NSMAX << df << nbpp;
|
||||
// qDebug() << "C" << ihsym << NSMAX << df << nbpp;
|
||||
if (n==0) {
|
||||
for (int i=0; i<NSMAX; i++)
|
||||
splot[i]=s[i];
|
||||
@ -108,7 +108,7 @@ void WideGraph::dataSink2(float s[], int nkhz, int ihsym, int ndiskdata,
|
||||
// 1000.0/df + 0.5;
|
||||
|
||||
int i0=0; //###
|
||||
nbpp=1; //###
|
||||
// nbpp=1; //###
|
||||
|
||||
int i=i0;
|
||||
for (int j=0; j<2048; j++) {
|
||||
@ -149,13 +149,7 @@ void WideGraph::dataSink2(float s[], int nkhz, int ihsym, int ndiskdata,
|
||||
|
||||
void WideGraph::on_freqSpanSpinBox_valueChanged(int n)
|
||||
{
|
||||
ui->widePlot->setNSpan(n);
|
||||
int w = ui->widePlot->plotWidth();
|
||||
int nbpp = n * 32768.0/(w*96.0) + 0.5;
|
||||
if(nbpp < 1) nbpp=1;
|
||||
if(w > 0) {
|
||||
ui->widePlot->setBinsPerPixel(nbpp);
|
||||
}
|
||||
ui->widePlot->setBinsPerPixel(n);
|
||||
}
|
||||
|
||||
void WideGraph::on_waterfallAvgSpinBox_valueChanged(int n)
|
||||
@ -254,17 +248,6 @@ void WideGraph::setPalette(QString palette)
|
||||
{
|
||||
ui->widePlot->setPalette(palette);
|
||||
}
|
||||
void WideGraph::setFsample(int n)
|
||||
{
|
||||
m_fSample=n;
|
||||
ui->widePlot->setFsample(n);
|
||||
}
|
||||
|
||||
void WideGraph::setMode65(int n)
|
||||
{
|
||||
m_mode65=n;
|
||||
ui->widePlot->setMode65(n);
|
||||
}
|
||||
|
||||
void WideGraph::on_fCenterLineEdit_editingFinished()
|
||||
{
|
||||
@ -284,5 +267,5 @@ void WideGraph::setPeriod(int ntrperiod, int nsps)
|
||||
{
|
||||
m_TRperiod=ntrperiod;
|
||||
m_nsps=nsps;
|
||||
ui->widePlot->m_nsps=nsps;
|
||||
ui->widePlot->setNsps(nsps);
|
||||
}
|
||||
|
@ -30,7 +30,6 @@ public:
|
||||
void setFcal(int n);
|
||||
void setPalette(QString palette);
|
||||
void setFsample(int n);
|
||||
void setMode65(int n);
|
||||
void setPeriod(int ntrperiod, int nsps);
|
||||
double fGreen();
|
||||
|
||||
@ -60,7 +59,6 @@ private:
|
||||
qint32 m_waterfallAvg;
|
||||
qint32 m_fCal;
|
||||
qint32 m_fSample;
|
||||
qint32 m_mode65;
|
||||
qint32 m_TRperiod;
|
||||
qint32 m_nsps;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user