mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-22 04:11:16 -05:00
New versions of plotsave, replot, etc.
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@8415 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
99fdec2b23
commit
9cf1edd239
@ -1,43 +1,29 @@
|
|||||||
subroutine plotsave(splot,ka,nbpp,irow,jz,swide)
|
subroutine plotsave(swide,nw,nh,irow)
|
||||||
|
|
||||||
parameter (NSMAX=6827,NYMAX=64)
|
parameter (NSMAX=6827,NYMAX=64)
|
||||||
real splot(NSMAX)
|
real, dimension(:,:), allocatable :: sw
|
||||||
real spsave(NSMAX,NYMAX)
|
real swide(0:nw-1)
|
||||||
real swide(jz)
|
data nw0/-1/,nh0/-1/
|
||||||
real s(NSMAX),tmp(NSMAX)
|
save nw0,nh0,sw
|
||||||
data ncall/0/
|
|
||||||
save ncall,spsave
|
if(nw.ne.nw0 .or. nh.ne.nh0) then
|
||||||
|
if(nw0.ne.-1) deallocate(sw)
|
||||||
|
allocate(sw(0:nw-1,0:nh-1))
|
||||||
|
sw=0.
|
||||||
|
nw0=nw
|
||||||
|
nh0=nh
|
||||||
|
endif
|
||||||
|
|
||||||
df=12000.0/16384
|
df=12000.0/16384
|
||||||
if(irow.lt.0) then
|
if(irow.lt.0) then
|
||||||
! Save a new row of data
|
! Push a new row of data into sw
|
||||||
ncall=ncall+1
|
do j=nh-1,1,-1
|
||||||
k=mod(ncall-1,NYMAX) + 1
|
sw(0:nw-1,j)=sw(0:nw-1,j-1)
|
||||||
spsave(1:NSMAX,k)=splot
|
|
||||||
rewind 61
|
|
||||||
do i=1,NSMAX
|
|
||||||
write(61,3061) i,splot(i),ncall
|
|
||||||
3061 format(i8,f12.3,i8)
|
|
||||||
enddo
|
enddo
|
||||||
|
sw(0:nw-1,0)=swide
|
||||||
else
|
else
|
||||||
! Process and return the saved "irow" as swide(), for a waterfall replot.
|
! Return the saved "irow" as swide(), for a waterfall replot.
|
||||||
k=mod(NYMAX+ncall-1-irow,NYMAX) + 1
|
swide=sw(0:nw-1,irow)
|
||||||
if(nbpp.eq.1) then
|
|
||||||
swide=spsave(1:jz,k)
|
|
||||||
else
|
|
||||||
s=spsave(1:NSMAX,k)
|
|
||||||
call smo(s,NSMAX,tmp,nbpp)
|
|
||||||
k=ka
|
|
||||||
do j=1,jz
|
|
||||||
smax=0.
|
|
||||||
do i=1,nbpp
|
|
||||||
k=k+1
|
|
||||||
if(k.lt.1 .or. k.gt.NSMAX) exit
|
|
||||||
smax=max(smax,s(k))
|
|
||||||
enddo
|
|
||||||
swide(j)=smax
|
|
||||||
enddo
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return
|
return
|
||||||
|
30
plotter.cpp
30
plotter.cpp
@ -43,6 +43,7 @@ CPlotter::CPlotter(QWidget *parent) : //CPlotter Constructor
|
|||||||
setAutoFillBackground(false);
|
setAutoFillBackground(false);
|
||||||
setAttribute(Qt::WA_OpaquePaintEvent, false);
|
setAttribute(Qt::WA_OpaquePaintEvent, false);
|
||||||
setAttribute(Qt::WA_NoSystemBackground, true);
|
setAttribute(Qt::WA_NoSystemBackground, true);
|
||||||
|
m_bReplot=false;
|
||||||
|
|
||||||
// contextual pop up menu
|
// contextual pop up menu
|
||||||
setContextMenuPolicy (Qt::CustomContextMenu);
|
setContextMenuPolicy (Qt::CustomContextMenu);
|
||||||
@ -83,6 +84,7 @@ void CPlotter::resizeEvent(QResizeEvent* ) //resizeEvent()
|
|||||||
if(m_bReference) m_h2=m_h-30;
|
if(m_bReference) m_h2=m_h-30;
|
||||||
if(m_h2<1) m_h2=1;
|
if(m_h2<1) m_h2=1;
|
||||||
m_h1=m_h-m_h2;
|
m_h1=m_h-m_h2;
|
||||||
|
// m_line=0;
|
||||||
m_2DPixmap = QPixmap(m_Size.width(), m_h2);
|
m_2DPixmap = QPixmap(m_Size.width(), m_h2);
|
||||||
m_2DPixmap.fill(Qt::black);
|
m_2DPixmap.fill(Qt::black);
|
||||||
m_WaterfallPixmap = QPixmap(m_Size.width(), m_h1);
|
m_WaterfallPixmap = QPixmap(m_Size.width(), m_h1);
|
||||||
@ -116,13 +118,12 @@ void CPlotter::draw(float swide[], bool bScroll, bool bRed)
|
|||||||
double fac = sqrt(m_binsPerPixel*m_waterfallAvg/15.0);
|
double fac = sqrt(m_binsPerPixel*m_waterfallAvg/15.0);
|
||||||
double gain = fac*pow(10.0,0.02*m_plotGain);
|
double gain = fac*pow(10.0,0.02*m_plotGain);
|
||||||
double gain2d = pow(10.0,0.02*(m_plot2dGain));
|
double gain2d = pow(10.0,0.02*(m_plot2dGain));
|
||||||
bool bReplot=swide[MAX_SCREENSIZE-1] == -99.0;
|
|
||||||
|
|
||||||
if(m_bReference != m_bReference0) resizeEvent(NULL);
|
if(m_bReference != m_bReference0) resizeEvent(NULL);
|
||||||
m_bReference0=m_bReference;
|
m_bReference0=m_bReference;
|
||||||
|
|
||||||
//move current data down one line (must do this before attaching a QPainter object)
|
//move current data down one line (must do this before attaching a QPainter object)
|
||||||
if(bScroll and !bReplot) m_WaterfallPixmap.scroll(0,1,0,0,m_w,m_h1);
|
if(bScroll and !m_bReplot) m_WaterfallPixmap.scroll(0,1,0,0,m_w,m_h1);
|
||||||
QPainter painter1(&m_WaterfallPixmap);
|
QPainter painter1(&m_WaterfallPixmap);
|
||||||
m_2DPixmap = m_OverlayPixmap.copy(0,0,m_w,m_h2);
|
m_2DPixmap = m_OverlayPixmap.copy(0,0,m_w,m_h2);
|
||||||
QPainter painter2D(&m_2DPixmap);
|
QPainter painter2D(&m_2DPixmap);
|
||||||
@ -149,13 +150,17 @@ void CPlotter::draw(float swide[], bool bScroll, bool bRed)
|
|||||||
|
|
||||||
if(bScroll and swide[0]<1.e29) {
|
if(bScroll and swide[0]<1.e29) {
|
||||||
flat4_(swide,&iz,&m_Flatten);
|
flat4_(swide,&iz,&m_Flatten);
|
||||||
if(!bReplot) flat4_(&dec_data.savg[j0],&jz,&m_Flatten);
|
if(!m_bReplot) flat4_(&dec_data.savg[j0],&jz,&m_Flatten);
|
||||||
}
|
}
|
||||||
|
|
||||||
ymin=1.e30;
|
ymin=1.e30;
|
||||||
if(swide[0]>1.e29 and swide[0]< 1.5e30) painter1.setPen(Qt::green);
|
if(swide[0]>1.e29 and swide[0]< 1.5e30) painter1.setPen(Qt::green);
|
||||||
if(swide[0]>1.4e30) painter1.setPen(Qt::yellow);
|
if(swide[0]>1.4e30) painter1.setPen(Qt::yellow);
|
||||||
if(!bReplot) m_j=0;
|
if(!m_bReplot) {
|
||||||
|
m_j=0;
|
||||||
|
int irow=-1;
|
||||||
|
plotsave_(swide,&m_w,&m_h1,&irow);
|
||||||
|
}
|
||||||
for(int i=0; i<iz; i++) {
|
for(int i=0; i<iz; i++) {
|
||||||
y=swide[i];
|
y=swide[i];
|
||||||
if(y<ymin) ymin=y;
|
if(y<ymin) ymin=y;
|
||||||
@ -165,9 +170,10 @@ void CPlotter::draw(float swide[], bool bScroll, bool bRed)
|
|||||||
if (swide[i]<1.e29) painter1.setPen(g_ColorTbl[y1]);
|
if (swide[i]<1.e29) painter1.setPen(g_ColorTbl[y1]);
|
||||||
painter1.drawPoint(i,m_j);
|
painter1.drawPoint(i,m_j);
|
||||||
}
|
}
|
||||||
if(bReplot) return;
|
if(m_bReplot) return;
|
||||||
|
|
||||||
m_line++;
|
m_line++;
|
||||||
|
|
||||||
float y2min=1.e30;
|
float y2min=1.e30;
|
||||||
float y2max=-1.e30;
|
float y2max=-1.e30;
|
||||||
for(int i=0; i<iz; i++) {
|
for(int i=0; i<iz; i++) {
|
||||||
@ -286,11 +292,17 @@ void CPlotter::drawRed(int ia, int ib, float swide[])
|
|||||||
draw(swide,false,true);
|
draw(swide,false,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlotter::replot(float swide[], bool bScroll, bool bRed, int irow)
|
void CPlotter::replot()
|
||||||
{
|
{
|
||||||
m_j=irow;
|
float swide[m_w];
|
||||||
draw(swide,bScroll,bRed);
|
for(int irow=0; irow<m_h1; irow++) {
|
||||||
update(); //trigger a new paintEvent
|
m_j=irow;
|
||||||
|
plotsave_(swide,&m_w,&m_h1,&irow);
|
||||||
|
m_bReplot=true;
|
||||||
|
draw(swide,false,false);
|
||||||
|
m_bReplot=false;
|
||||||
|
update(); //trigger a new paintEvent
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlotter::DrawOverlay() //DrawOverlay()
|
void CPlotter::DrawOverlay() //DrawOverlay()
|
||||||
|
@ -37,7 +37,7 @@ public:
|
|||||||
QSize sizeHint() const;
|
QSize sizeHint() const;
|
||||||
|
|
||||||
void draw(float swide[], bool bScroll, bool bRed); //Update the waterfall
|
void draw(float swide[], bool bScroll, bool bRed); //Update the waterfall
|
||||||
void replot(float swide[], bool bScroll, bool bRed, int irow);
|
void replot();
|
||||||
void SetRunningState(bool running);
|
void SetRunningState(bool running);
|
||||||
void setPlotZero(int plotZero);
|
void setPlotZero(int plotZero);
|
||||||
int plotZero();
|
int plotZero();
|
||||||
@ -144,6 +144,7 @@ private:
|
|||||||
bool m_Running;
|
bool m_Running;
|
||||||
bool m_paintEventBusy;
|
bool m_paintEventBusy;
|
||||||
bool m_dataFromDisk;
|
bool m_dataFromDisk;
|
||||||
|
bool m_bReplot;
|
||||||
|
|
||||||
double m_fftBinWidth;
|
double m_fftBinWidth;
|
||||||
double m_dialFreq;
|
double m_dialFreq;
|
||||||
@ -180,6 +181,7 @@ extern QVector<QColor> g_ColorTbl;
|
|||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
void flat4_(float swide[], int* iz, int* nflatten);
|
void flat4_(float swide[], int* iz, int* nflatten);
|
||||||
|
void plotsave_(float swide[], int* m_w , int* m_h1, int* irow);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // PLOTTER_H
|
#endif // PLOTTER_H
|
||||||
|
@ -198,9 +198,6 @@ void WideGraph::dataSink2(float s[], float df3, int ihsym, int ndiskdata) //dat
|
|||||||
}
|
}
|
||||||
m_ntr0=ntr;
|
m_ntr0=ntr;
|
||||||
ui->widePlot->draw(swide,true,false);
|
ui->widePlot->draw(swide,true,false);
|
||||||
int irow=-1;
|
|
||||||
int ka=0;
|
|
||||||
plotsave_(splot,&ka,&nbpp,&irow,&jz,swide);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,15 +462,7 @@ void WideGraph::on_gainSlider_valueChanged(int value) //Gain
|
|||||||
|
|
||||||
void WideGraph::replot()
|
void WideGraph::replot()
|
||||||
{
|
{
|
||||||
if(!ui->widePlot->scaleOK()) return;
|
if(ui->widePlot->scaleOK()) ui->widePlot->replot();
|
||||||
int nbpp = ui->widePlot->binsPerPixel();
|
|
||||||
float splot=0.0;
|
|
||||||
int ka=int(ui->widePlot->startFreq()/0.732422 + 0.5) - 1;
|
|
||||||
for(int irow=0; irow<64; irow++) {
|
|
||||||
plotsave_(&splot,&ka,&nbpp,&irow,&m_jz,swide);
|
|
||||||
swide[MAX_SCREENSIZE-1]=-99.0;
|
|
||||||
ui->widePlot->replot(swide,true,false,irow);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WideGraph::on_zeroSlider_valueChanged(int value) //Zero
|
void WideGraph::on_zeroSlider_valueChanged(int value) //Zero
|
||||||
|
@ -116,9 +116,4 @@ private:
|
|||||||
QString m_waterfallPalette;
|
QString m_waterfallPalette;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
void plotsave_(float splot[], int* ka, int* nbpp, int* irow, int* jz, float swide[]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif // WIDEGRAPH_H
|
#endif // WIDEGRAPH_H
|
||||||
|
Loading…
Reference in New Issue
Block a user