| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | #include "plotter.h"
 | 
					
						
							|  |  |  | #include <math.h>
 | 
					
						
							|  |  |  | #include <QDebug>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define MAX_SCREENSIZE 2048
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | CPlotter::CPlotter(QWidget *parent) :                  //CPlotter Constructor
 | 
					
						
							|  |  |  |   QFrame(parent) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | 
					
						
							|  |  |  |   setFocusPolicy(Qt::StrongFocus); | 
					
						
							|  |  |  |   setAttribute(Qt::WA_PaintOnScreen,false); | 
					
						
							|  |  |  |   setAutoFillBackground(false); | 
					
						
							|  |  |  |   setAttribute(Qt::WA_OpaquePaintEvent, false); | 
					
						
							|  |  |  |   setAttribute(Qt::WA_NoSystemBackground, true); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-26 17:39:43 +00:00
										 |  |  |   m_StartFreq = 1000; | 
					
						
							|  |  |  |   m_nSpan=1000;                    //Units: Hz
 | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  |   m_fSpan=(float)m_nSpan; | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   m_hdivs = HORZ_DIVS; | 
					
						
							|  |  |  |   m_FreqUnits = 1; | 
					
						
							|  |  |  |   m_Running = false; | 
					
						
							|  |  |  |   m_paintEventBusy=false; | 
					
						
							|  |  |  |   m_WaterfallPixmap = QPixmap(0,0); | 
					
						
							|  |  |  |   m_2DPixmap = QPixmap(0,0); | 
					
						
							|  |  |  |   m_ScalePixmap = QPixmap(0,0); | 
					
						
							| 
									
										
										
										
											2012-09-30 01:03:18 +00:00
										 |  |  |   m_OverlayPixmap = QPixmap(0,0); | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   m_Size = QSize(0,0); | 
					
						
							| 
									
										
										
										
											2012-10-19 19:26:07 +00:00
										 |  |  |   m_fQSO = 1020; | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   m_line = 0; | 
					
						
							| 
									
										
										
										
											2012-09-26 17:39:43 +00:00
										 |  |  |   m_fSample = 12000; | 
					
						
							| 
									
										
										
										
											2012-09-28 23:59:50 +00:00
										 |  |  |   m_nsps=6912; | 
					
						
							| 
									
										
										
										
											2012-09-30 01:03:18 +00:00
										 |  |  |   m_dBStepSize=10; | 
					
						
							|  |  |  |   m_Percent2DScreen = 30;	//percent of screen used for 2D display
 | 
					
						
							| 
									
										
										
										
											2012-11-23 16:05:50 +00:00
										 |  |  |   m_txFreq=0; | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | CPlotter::~CPlotter() { }                                      // Destructor
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QSize CPlotter::minimumSizeHint() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   return QSize(50, 50); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | QSize CPlotter::sizeHint() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   return QSize(180, 180); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void CPlotter::resizeEvent(QResizeEvent* )                    //resizeEvent()
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   if(!size().isValid()) return; | 
					
						
							| 
									
										
										
										
											2012-09-30 01:03:18 +00:00
										 |  |  |   if( m_Size != size() ) {  //if changed, resize pixmaps to new screensize
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |     m_Size = size(); | 
					
						
							| 
									
										
										
										
											2012-09-30 01:03:18 +00:00
										 |  |  |     m_w = m_Size.width(); | 
					
						
							|  |  |  |     m_h = m_Size.height(); | 
					
						
							| 
									
										
										
										
											2012-10-11 16:06:31 +00:00
										 |  |  |     m_h1 = (100-m_Percent2DScreen)*(m_Size.height())/100; | 
					
						
							|  |  |  |     m_h2 = (m_Percent2DScreen)*(m_Size.height())/100; | 
					
						
							| 
									
										
										
										
											2012-09-30 01:03:18 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     m_2DPixmap = QPixmap(m_Size.width(), m_h2); | 
					
						
							|  |  |  |     m_2DPixmap.fill(Qt::black); | 
					
						
							|  |  |  |     m_WaterfallPixmap = QPixmap(m_Size.width(), m_h1); | 
					
						
							|  |  |  |     m_OverlayPixmap = QPixmap(m_Size.width(), m_h2); | 
					
						
							|  |  |  |     m_OverlayPixmap.fill(Qt::black); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |     m_WaterfallPixmap.fill(Qt::black); | 
					
						
							|  |  |  |     m_2DPixmap.fill(Qt::black); | 
					
						
							| 
									
										
										
										
											2012-09-30 01:03:18 +00:00
										 |  |  |     m_ScalePixmap = QPixmap(m_w,30); | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |     m_ScalePixmap.fill(Qt::white); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   DrawOverlay(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void CPlotter::paintEvent(QPaintEvent *)                    // paintEvent()
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   if(m_paintEventBusy) return; | 
					
						
							|  |  |  |   m_paintEventBusy=true; | 
					
						
							|  |  |  |   QPainter painter(this); | 
					
						
							|  |  |  |   painter.drawPixmap(0,0,m_ScalePixmap); | 
					
						
							|  |  |  |   painter.drawPixmap(0,30,m_WaterfallPixmap); | 
					
						
							| 
									
										
										
										
											2012-09-30 01:03:18 +00:00
										 |  |  |   painter.drawPixmap(0,m_h1,m_2DPixmap); | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   m_paintEventBusy=false; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-10-15 17:43:49 +00:00
										 |  |  | void CPlotter::draw(float swide[], float red[], int i0)             //draw()
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2012-10-15 17:43:49 +00:00
										 |  |  |   int j,y2; | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   float y; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  |   m_i0=i0; | 
					
						
							| 
									
										
										
										
											2012-07-13 16:45:26 +00:00
										 |  |  |   double gain = pow(10.0,0.05*(m_plotGain+7)); | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-30 01:03:18 +00:00
										 |  |  | //move current data down one line (must do this before attaching a QPainter object)
 | 
					
						
							|  |  |  |   m_WaterfallPixmap.scroll(0,1,0,0,m_w,m_h1); | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   QPainter painter1(&m_WaterfallPixmap); | 
					
						
							| 
									
										
										
										
											2012-09-30 01:03:18 +00:00
										 |  |  |   m_2DPixmap = m_OverlayPixmap.copy(0,0,m_w,m_h2); | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   QPainter painter2D(&m_2DPixmap); | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   painter2D.setPen(Qt::green); | 
					
						
							| 
									
										
										
										
											2012-10-15 17:43:49 +00:00
										 |  |  |   if(m_bJT9Sync) painter2D.setPen(Qt::red); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   QPoint LineBuf[MAX_SCREENSIZE]; | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  |   j=0; | 
					
						
							|  |  |  |   bool strong0=false; | 
					
						
							|  |  |  |   bool strong=false; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-10-05 19:14:45 +00:00
										 |  |  |   int iz=XfromFreq(2000.0); | 
					
						
							| 
									
										
										
										
											2012-09-30 01:03:18 +00:00
										 |  |  |   for(int i=0; i<m_w; i++) { | 
					
						
							| 
									
										
										
										
											2012-10-05 19:14:45 +00:00
										 |  |  |     if(i>iz) swide[i]=0; | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  |     strong=false; | 
					
						
							| 
									
										
										
										
											2012-09-28 23:59:50 +00:00
										 |  |  |     if(swide[i]<0) { | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  |       strong=true; | 
					
						
							| 
									
										
										
										
											2012-09-28 23:59:50 +00:00
										 |  |  |       swide[i]=-swide[i]; | 
					
						
							| 
									
										
										
										
											2012-07-13 13:37:50 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2012-09-28 23:59:50 +00:00
										 |  |  |     y = 10.0*log10(swide[i]); | 
					
						
							| 
									
										
										
										
											2012-10-11 18:33:50 +00:00
										 |  |  |     int y1 = 5.0*gain*y + 10*m_plotZero; | 
					
						
							| 
									
										
										
										
											2012-07-13 13:37:50 +00:00
										 |  |  |     if (y1<0) y1=0; | 
					
						
							|  |  |  |     if (y1>254) y1=254; | 
					
						
							| 
									
										
										
										
											2012-09-28 23:59:50 +00:00
										 |  |  |     if (swide[i]>1.e29) y1=255; | 
					
						
							| 
									
										
										
										
											2012-07-13 13:37:50 +00:00
										 |  |  |     painter1.setPen(m_ColorTbl[y1]); | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  |     painter1.drawPoint(i,0); | 
					
						
							| 
									
										
										
										
											2012-11-14 17:02:54 +00:00
										 |  |  |     y2=0; | 
					
						
							| 
									
										
										
										
											2012-11-30 13:56:55 +00:00
										 |  |  |     if(m_bCurrent) y2 = 0.4*gain*y - 15; | 
					
						
							| 
									
										
										
										
											2013-03-06 00:52:38 +00:00
										 |  |  |     if(m_bCumulative) { | 
					
						
							|  |  |  |       float sum=0.0; | 
					
						
							|  |  |  |       int j=m_binsPerPixel*i; | 
					
						
							|  |  |  |       for(int k=0; k<m_binsPerPixel; k++) { | 
					
						
							|  |  |  |         sum+=jt9com_.savg[j++]; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       y2=gain*10.0*log10(sum/m_binsPerPixel) - 20; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2012-11-30 13:56:55 +00:00
										 |  |  |     if(m_bJT9Sync) y2=3.0*gain*red[i] - 15; | 
					
						
							| 
									
										
										
										
											2012-09-30 01:03:18 +00:00
										 |  |  |     if(strong != strong0 or i==m_w-1) { | 
					
						
							| 
									
										
										
										
											2012-09-29 13:02:19 +00:00
										 |  |  |       painter2D.drawPolyline(LineBuf,j); | 
					
						
							|  |  |  |       j=0; | 
					
						
							|  |  |  |       strong0=strong; | 
					
						
							|  |  |  |       if(strong0) painter2D.setPen(Qt::red); | 
					
						
							|  |  |  |       if(!strong0) painter2D.setPen(Qt::green); | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2012-09-29 13:02:19 +00:00
										 |  |  |     LineBuf[j].setX(i); | 
					
						
							| 
									
										
										
										
											2012-10-11 20:41:05 +00:00
										 |  |  |     LineBuf[j].setY(m_h-(y2+0.8*m_h)); | 
					
						
							| 
									
										
										
										
											2012-09-29 13:02:19 +00:00
										 |  |  |     j++; | 
					
						
							| 
									
										
										
										
											2012-07-13 13:37:50 +00:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-28 23:59:50 +00:00
										 |  |  |   if(swide[0]>1.0e29) m_line=0; | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  |   m_line++; | 
					
						
							|  |  |  |   if(m_line == 13) { | 
					
						
							|  |  |  |     UTCstr(); | 
					
						
							| 
									
										
										
										
											2012-10-05 19:14:45 +00:00
										 |  |  |     painter1.setPen(Qt::white); | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  |     painter1.drawText(5,10,m_sutc); | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   } | 
					
						
							|  |  |  |   update();                              //trigger a new paintEvent
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  | void CPlotter::UTCstr() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2012-11-14 17:02:54 +00:00
										 |  |  |   int ihr,imin; | 
					
						
							| 
									
										
										
										
											2012-10-03 15:42:13 +00:00
										 |  |  |   if(jt9com_.ndiskdat != 0) { | 
					
						
							| 
									
										
										
										
											2012-10-03 19:25:49 +00:00
										 |  |  |     ihr=jt9com_.nutc/100; | 
					
						
							|  |  |  |     imin=jt9com_.nutc % 100; | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  |   } else { | 
					
						
							|  |  |  |     qint64 ms = QDateTime::currentMSecsSinceEpoch() % 86400000; | 
					
						
							|  |  |  |     imin=ms/60000; | 
					
						
							|  |  |  |     ihr=imin/60; | 
					
						
							|  |  |  |     imin=imin % 60; | 
					
						
							| 
									
										
										
										
											2012-11-14 15:30:21 +00:00
										 |  |  |     imin=imin - (imin % (m_TRperiod/60)); | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2012-09-29 17:23:02 +00:00
										 |  |  |   sprintf(m_sutc,"%2.2d:%2.2d",ihr,imin); | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | void CPlotter::DrawOverlay()                                 //DrawOverlay()
 | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2012-09-30 01:03:18 +00:00
										 |  |  |   if(m_OverlayPixmap.isNull()) return; | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   if(m_WaterfallPixmap.isNull()) return; | 
					
						
							|  |  |  |   int w = m_WaterfallPixmap.width(); | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  |   int x,y; | 
					
						
							| 
									
										
										
										
											2012-11-14 17:02:54 +00:00
										 |  |  | //  int nHzDiv[11]={0,50,100,200,200,200,500,500,500,500,500};
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   float pixperdiv; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-30 01:03:18 +00:00
										 |  |  |   QRect rect; | 
					
						
							|  |  |  |   QPainter painter(&m_OverlayPixmap); | 
					
						
							|  |  |  |   painter.initFrom(this); | 
					
						
							|  |  |  |   QLinearGradient gradient(0, 0, 0 ,m_h2);  //fill background with gradient
 | 
					
						
							|  |  |  |   gradient.setColorAt(1, Qt::black); | 
					
						
							|  |  |  |   gradient.setColorAt(0, Qt::darkBlue); | 
					
						
							|  |  |  |   painter.setBrush(gradient); | 
					
						
							|  |  |  |   painter.drawRect(0, 0, m_w, m_h2); | 
					
						
							|  |  |  |   painter.setBrush(Qt::SolidPattern); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   double df = m_binsPerPixel*m_fftBinWidth; | 
					
						
							|  |  |  |   pixperdiv = m_freqPerDiv/df; | 
					
						
							|  |  |  |   y = m_h2 - m_h2/VERT_DIVS; | 
					
						
							| 
									
										
										
										
											2012-10-20 17:25:46 +00:00
										 |  |  |   for( int i=1; i<m_hdivs; i++)                   //draw vertical grids
 | 
					
						
							| 
									
										
										
										
											2012-09-30 01:03:18 +00:00
										 |  |  |   { | 
					
						
							|  |  |  |     x = (int)( (float)i*pixperdiv ); | 
					
						
							|  |  |  |     painter.setPen(QPen(Qt::white, 1,Qt::DotLine)); | 
					
						
							|  |  |  |     painter.drawLine(x, 0, x , y); | 
					
						
							|  |  |  |     painter.drawLine(x, m_h2-5, x , m_h2); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   pixperdiv = (float)m_h2 / (float)VERT_DIVS; | 
					
						
							|  |  |  |   painter.setPen(QPen(Qt::white, 1,Qt::DotLine)); | 
					
						
							| 
									
										
										
										
											2012-10-20 17:25:46 +00:00
										 |  |  |   for( int i=1; i<VERT_DIVS; i++)                 //draw horizontal grids
 | 
					
						
							| 
									
										
										
										
											2012-09-30 01:03:18 +00:00
										 |  |  |   { | 
					
						
							|  |  |  |           y = (int)( (float)i*pixperdiv ); | 
					
						
							|  |  |  |           painter.drawLine(0, y, w, y); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-10-26 16:01:57 +00:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2012-09-30 01:03:18 +00:00
										 |  |  |   //draw amplitude values
 | 
					
						
							|  |  |  |   painter.setPen(Qt::yellow); | 
					
						
							|  |  |  | //  Font.setWeight(QFont::Light);
 | 
					
						
							|  |  |  | //  painter.setFont(Font);
 | 
					
						
							|  |  |  | //  int dB = m_MaxdB;
 | 
					
						
							|  |  |  |   int dB = 50; | 
					
						
							|  |  |  |   for( int i=0; i<VERT_DIVS-1; i++) | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     y = (int)( (float)i*pixperdiv ); | 
					
						
							|  |  |  |     painter.drawStaticText(5, y-1, QString::number(dB)+" dB"); | 
					
						
							|  |  |  |     dB -= m_dBStepSize; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2012-10-20 17:25:46 +00:00
										 |  |  | */ | 
					
						
							| 
									
										
										
										
											2012-09-30 01:03:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   QRect rect0; | 
					
						
							|  |  |  |   QPainter painter0(&m_ScalePixmap); | 
					
						
							|  |  |  |   painter0.initFrom(this); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   //create Font to use for scales
 | 
					
						
							|  |  |  |   QFont Font("Arial"); | 
					
						
							|  |  |  |   Font.setPointSize(12); | 
					
						
							|  |  |  |   QFontMetrics metrics(Font); | 
					
						
							|  |  |  |   Font.setWeight(QFont::Normal); | 
					
						
							|  |  |  |   painter0.setFont(Font); | 
					
						
							|  |  |  |   painter0.setPen(Qt::black); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-26 17:39:43 +00:00
										 |  |  |   if(m_binsPerPixel < 1) m_binsPerPixel=1; | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  |   m_fSpan = w*df; | 
					
						
							| 
									
										
										
										
											2012-09-29 17:09:05 +00:00
										 |  |  |   int n=m_fSpan/10; | 
					
						
							|  |  |  |   m_freqPerDiv=10; | 
					
						
							|  |  |  |   if(n>25) m_freqPerDiv=50; | 
					
						
							|  |  |  |   if(n>70) m_freqPerDiv=100; | 
					
						
							| 
									
										
										
										
											2012-09-29 23:52:01 +00:00
										 |  |  |   if(n>140) m_freqPerDiv=200; | 
					
						
							|  |  |  |   if(n>310) m_freqPerDiv=500; | 
					
						
							| 
									
										
										
										
											2012-09-29 17:09:05 +00:00
										 |  |  |   m_hdivs = w*df/m_freqPerDiv + 0.9999; | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   m_ScalePixmap.fill(Qt::white); | 
					
						
							|  |  |  |   painter0.drawRect(0, 0, w, 30); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-29 20:48:04 +00:00
										 |  |  | //draw tick marks on upper scale
 | 
					
						
							| 
									
										
										
										
											2012-09-29 17:09:05 +00:00
										 |  |  |   pixperdiv = m_freqPerDiv/df; | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   for( int i=1; i<m_hdivs; i++) {     //major ticks
 | 
					
						
							|  |  |  |     x = (int)( (float)i*pixperdiv ); | 
					
						
							|  |  |  |     painter0.drawLine(x,18,x,30); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2012-09-29 23:52:01 +00:00
										 |  |  |   int minor=5; | 
					
						
							|  |  |  |   if(m_freqPerDiv==200) minor=4; | 
					
						
							|  |  |  |   for( int i=1; i<minor*m_hdivs; i++) {   //minor ticks
 | 
					
						
							|  |  |  |     x = i*pixperdiv/minor; | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |     painter0.drawLine(x,24,x,30); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   //draw frequency values
 | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  |   MakeFrequencyStrs(); | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   for( int i=0; i<=m_hdivs; i++) { | 
					
						
							|  |  |  |     if(0==i) { | 
					
						
							|  |  |  |       //left justify the leftmost text
 | 
					
						
							|  |  |  |       x = (int)( (float)i*pixperdiv); | 
					
						
							|  |  |  |       rect0.setRect(x,0, (int)pixperdiv, 20); | 
					
						
							|  |  |  |       painter0.drawText(rect0, Qt::AlignLeft|Qt::AlignVCenter, | 
					
						
							|  |  |  |                        m_HDivText[i]); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else if(m_hdivs == i) { | 
					
						
							|  |  |  |       //right justify the rightmost text
 | 
					
						
							|  |  |  |       x = (int)( (float)i*pixperdiv - pixperdiv); | 
					
						
							|  |  |  |       rect0.setRect(x,0, (int)pixperdiv, 20); | 
					
						
							|  |  |  |       painter0.drawText(rect0, Qt::AlignRight|Qt::AlignVCenter, | 
					
						
							|  |  |  |                        m_HDivText[i]); | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |       //center justify the rest of the text
 | 
					
						
							|  |  |  |       x = (int)( (float)i*pixperdiv - pixperdiv/2); | 
					
						
							|  |  |  |       rect0.setRect(x,0, (int)pixperdiv, 20); | 
					
						
							|  |  |  |       painter0.drawText(rect0, Qt::AlignHCenter|Qt::AlignVCenter, | 
					
						
							|  |  |  |                        m_HDivText[i]); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-10-19 19:26:07 +00:00
										 |  |  |   QPen pen0(Qt::green, 3);                 //Mark QSO Freq with green tick
 | 
					
						
							| 
									
										
										
										
											2012-09-29 13:02:19 +00:00
										 |  |  |   painter0.setPen(pen0); | 
					
						
							| 
									
										
										
										
											2012-11-23 16:05:50 +00:00
										 |  |  |   x=XfromFreq(m_fQSO); | 
					
						
							|  |  |  |   painter0.drawLine(x,17,x,30); | 
					
						
							| 
									
										
										
										
											2012-10-15 17:43:49 +00:00
										 |  |  |   int x1=x - m_tol/df; | 
					
						
							|  |  |  |   int x2=x + m_tol/df; | 
					
						
							|  |  |  |   pen0.setWidth(6); | 
					
						
							|  |  |  |   painter0.drawLine(x1,28,x2,28); | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-11-23 16:05:50 +00:00
										 |  |  |   QPen pen1(Qt::red, 3);                 //Mark TxFreq with red tick
 | 
					
						
							|  |  |  |   painter0.setPen(pen1); | 
					
						
							|  |  |  |   x = XfromFreq(m_txFreq); | 
					
						
							|  |  |  |   painter0.drawLine(x,0,x,13); | 
					
						
							|  |  |  |   painter0.drawLine(x,13,x-2,11); | 
					
						
							|  |  |  |   painter0.drawLine(x,13,x+2,11); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-10-20 17:25:46 +00:00
										 |  |  |   /*
 | 
					
						
							| 
									
										
										
										
											2012-09-26 18:45:10 +00:00
										 |  |  |   df = 12000.0/m_nsps; | 
					
						
							| 
									
										
										
										
											2012-09-29 17:09:05 +00:00
										 |  |  |   int nlabs=df*w/m_freqPerDiv + 1.0; | 
					
						
							| 
									
										
										
										
											2012-09-30 01:03:18 +00:00
										 |  |  | //  m_LowerScalePixmap.fill(Qt::white);
 | 
					
						
							|  |  |  | //  painter3.drawRect(0, 0, w, 30);
 | 
					
						
							| 
									
										
										
										
											2012-09-29 17:09:05 +00:00
										 |  |  |   pixperdiv = m_freqPerDiv/df; | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  |   for( int i=0; i<10*nlabs; i++) { | 
					
						
							|  |  |  |     x = i*pixperdiv/10; | 
					
						
							|  |  |  |     y=24; | 
					
						
							| 
									
										
										
										
											2012-09-26 18:45:10 +00:00
										 |  |  |     if ((i%10) == 0) y=18; | 
					
						
							| 
									
										
										
										
											2012-09-30 01:03:18 +00:00
										 |  |  | //    painter3.drawLine(x,y,x,30);
 | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2012-10-20 17:25:46 +00:00
										 |  |  |   */ | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  | void CPlotter::MakeFrequencyStrs()                       //MakeFrequencyStrs
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   float freq; | 
					
						
							|  |  |  |   for(int i=0; i<=m_hdivs; i++) { | 
					
						
							| 
									
										
										
										
											2012-09-29 17:09:05 +00:00
										 |  |  |     freq = m_StartFreq + i*m_freqPerDiv; | 
					
						
							| 
									
										
										
										
											2012-09-26 17:39:43 +00:00
										 |  |  |     m_HDivText[i].setNum((int)freq); | 
					
						
							| 
									
										
										
										
											2012-09-29 17:09:05 +00:00
										 |  |  |     //      StartFreq += m_freqPerDiv;
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  | int CPlotter::XfromFreq(float f)                               //XfromFreq()
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2012-10-29 17:58:33 +00:00
										 |  |  | //  float w = m_WaterfallPixmap.width();
 | 
					
						
							|  |  |  |   int x = (int) m_w * (f - m_StartFreq)/m_fSpan; | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   if(x<0 ) return 0; | 
					
						
							| 
									
										
										
										
											2012-10-29 17:58:33 +00:00
										 |  |  |   if(x>m_w) return m_w; | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   return x; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  | float CPlotter::FreqfromX(int x)                               //FreqfromX()
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2012-10-11 22:59:36 +00:00
										 |  |  |   return float(1000.0 + x*m_binsPerPixel*m_fftBinWidth); | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void CPlotter::SetRunningState(bool running)              //SetRunningState()
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   m_Running = running; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void CPlotter::setPlotZero(int plotZero)                  //setPlotZero()
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   m_plotZero=plotZero; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int CPlotter::getPlotZero()                               //getPlotZero()
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   return m_plotZero; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void CPlotter::setPlotGain(int plotGain)                  //setPlotGain()
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   m_plotGain=plotGain; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int CPlotter::getPlotGain()                               //getPlotGain()
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   return m_plotGain; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  | void CPlotter::SetStartFreq(quint64 f)                    //SetStartFreq()
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   m_StartFreq=f; | 
					
						
							|  |  |  | //    resizeEvent(NULL);
 | 
					
						
							|  |  |  |   DrawOverlay(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | qint64 CPlotter::startFreq()                              //startFreq()
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   return m_StartFreq; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | int CPlotter::plotWidth(){return m_WaterfallPixmap.width();} | 
					
						
							|  |  |  | void CPlotter::UpdateOverlay() {DrawOverlay();} | 
					
						
							|  |  |  | void CPlotter::setDataFromDisk(bool b) {m_dataFromDisk=b;} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void CPlotter::setTol(int n)                                 //setTol()
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   m_tol=n; | 
					
						
							|  |  |  |   DrawOverlay(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-11-01 19:54:40 +00:00
										 |  |  | int CPlotter::Tol()                                         //Tol()
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   return m_tol; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-29 17:09:05 +00:00
										 |  |  | void CPlotter::setBinsPerPixel(int n)                       // set nbpp
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   m_binsPerPixel = n; | 
					
						
							|  |  |  |   DrawOverlay();                         //Redraw scales and ticks
 | 
					
						
							|  |  |  |   update();                              //trigger a new paintEvent}
 | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-29 23:52:01 +00:00
										 |  |  | int CPlotter::binsPerPixel()                                // get nbpp
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   return m_binsPerPixel; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | void CPlotter::setFQSO(int x, bool bf)                       //setFQSO()
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   if(bf) { | 
					
						
							| 
									
										
										
										
											2012-10-29 17:58:33 +00:00
										 |  |  |     m_fQSO=x;         // x is freq in Hz
 | 
					
						
							| 
									
										
										
										
											2012-10-19 19:26:07 +00:00
										 |  |  |     m_xClick=XfromFreq(m_fQSO); | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  |   } else { | 
					
						
							|  |  |  |     if(x<0) x=0;      // x is pixel number
 | 
					
						
							|  |  |  |     if(x>m_Size.width()) x=m_Size.width(); | 
					
						
							|  |  |  |     m_fQSO = int(FreqfromX(x)+0.5); | 
					
						
							|  |  |  |     m_xClick=x; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   DrawOverlay(); | 
					
						
							|  |  |  |   update(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void CPlotter::setFcal(int n)                                  //setFcal()
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   m_fCal=n; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int CPlotter::fQSO() {return m_fQSO;}                          //get fQSO
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | void CPlotter::mousePressEvent(QMouseEvent *event)       //mousePressEvent
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   int x=event->x(); | 
					
						
							| 
									
										
										
										
											2012-09-29 17:31:43 +00:00
										 |  |  |   setFQSO(x,false);                               // Wideband waterfall
 | 
					
						
							| 
									
										
										
										
											2012-11-23 16:44:40 +00:00
										 |  |  |   bool ctrl = (event->modifiers() & Qt::ControlModifier); | 
					
						
							|  |  |  |   if(!ctrl) { | 
					
						
							|  |  |  |     setTxFreq(m_fQSO); | 
					
						
							|  |  |  |     emit freezeDecode1(1);                  //### ???
 | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void CPlotter::mouseDoubleClickEvent(QMouseEvent *event)  //mouse2click
 | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2012-10-11 16:06:31 +00:00
										 |  |  | //  int h = (m_Size.height()-60)/2;
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   int x=event->x(); | 
					
						
							| 
									
										
										
										
											2012-09-29 17:31:43 +00:00
										 |  |  |   setFQSO(x,false); | 
					
						
							|  |  |  |   emit freezeDecode1(2);                  //### ???
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  | void CPlotter::setNSpan(int n)                                  //setNSpan()
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   m_nSpan=n; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | void CPlotter::setPalette(QString palette)                      //setPalette()
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   if(palette=="Linrad") { | 
					
						
							|  |  |  |     float twopi=6.2831853; | 
					
						
							|  |  |  |     float r,g,b,phi,x; | 
					
						
							|  |  |  |     for(int i=0; i<256; i++) { | 
					
						
							|  |  |  |       r=0.0; | 
					
						
							|  |  |  |       if(i>105 and i<=198) { | 
					
						
							|  |  |  |         phi=(twopi/4.0) * (i-105.0)/(198.0-105.0); | 
					
						
							|  |  |  |         r=sin(phi); | 
					
						
							|  |  |  |       } else if(i>=198) { | 
					
						
							|  |  |  |           r=1.0; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       g=0.0; | 
					
						
							|  |  |  |       if(i>35 and i<198) { | 
					
						
							|  |  |  |         phi=(twopi/4.0) * (i-35.0)/(122.5-35.0); | 
					
						
							|  |  |  |         g=0.625*sin(phi); | 
					
						
							|  |  |  |       } else if(i>=198) { | 
					
						
							|  |  |  |         x=(i-186.0); | 
					
						
							|  |  |  |         g=-0.014 + 0.0144*x -0.00007*x*x +0.000002*x*x*x; | 
					
						
							|  |  |  |         if(g>1.0) g=1.0; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       b=0.0; | 
					
						
							|  |  |  |       if(i<=117) { | 
					
						
							|  |  |  |         phi=(twopi/2.0) * i/117.0; | 
					
						
							|  |  |  |         b=0.4531*sin(phi); | 
					
						
							|  |  |  |       } else if(i>186) { | 
					
						
							|  |  |  |         x=(i-186.0); | 
					
						
							|  |  |  |         b=-0.014 + 0.0144*x -0.00007*x*x +0.000002*x*x*x; | 
					
						
							|  |  |  |         if(b>1.0) b=1.0; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       m_ColorTbl[i].setRgb(int(255.0*r),int(255.0*g),int(255.0*b)); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     m_ColorTbl[255].setRgb(255,255,100); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if(palette=="CuteSDR") { | 
					
						
							|  |  |  |       for( int i=0; i<256; i++) { | 
					
						
							|  |  |  |       if( (i<43) ) | 
					
						
							|  |  |  |         m_ColorTbl[i].setRgb( 0,0, 255*(i)/43); | 
					
						
							|  |  |  |       if( (i>=43) && (i<87) ) | 
					
						
							|  |  |  |         m_ColorTbl[i].setRgb( 0, 255*(i-43)/43, 255 ); | 
					
						
							|  |  |  |       if( (i>=87) && (i<120) ) | 
					
						
							|  |  |  |         m_ColorTbl[i].setRgb( 0,255, 255-(255*(i-87)/32)); | 
					
						
							|  |  |  |       if( (i>=120) && (i<154) ) | 
					
						
							|  |  |  |         m_ColorTbl[i].setRgb( (255*(i-120)/33), 255, 0); | 
					
						
							|  |  |  |       if( (i>=154) && (i<217) ) | 
					
						
							|  |  |  |         m_ColorTbl[i].setRgb( 255, 255 - (255*(i-154)/62), 0); | 
					
						
							|  |  |  |       if( (i>=217)  ) | 
					
						
							|  |  |  |         m_ColorTbl[i].setRgb( 255, 0, 128*(i-217)/38); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     m_ColorTbl[255].setRgb(255,255,100); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if(palette=="Blue") { | 
					
						
							|  |  |  |     FILE* fp=fopen("blue.dat","r"); | 
					
						
							|  |  |  |     int n,r,g,b; | 
					
						
							|  |  |  |     float xr,xg,xb; | 
					
						
							|  |  |  |     for(int i=0; i<256; i++) { | 
					
						
							|  |  |  |       fscanf(fp,"%d%f%f%f",&n,&xr,&xg,&xb); | 
					
						
							|  |  |  |       r=255.0*xr + 0.5; | 
					
						
							|  |  |  |       g=255.0*xg + 0.5; | 
					
						
							|  |  |  |       b=255.0*xb + 0.5; | 
					
						
							|  |  |  |       m_ColorTbl[i].setRgb(r,g,b); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if(palette=="AFMHot") { | 
					
						
							|  |  |  |     FILE* fp=fopen("afmhot.dat","r"); | 
					
						
							|  |  |  |     int n,r,g,b; | 
					
						
							|  |  |  |     float xr,xg,xb; | 
					
						
							|  |  |  |     for(int i=0; i<256; i++) { | 
					
						
							|  |  |  |       fscanf(fp,"%d%f%f%f",&n,&xr,&xg,&xb); | 
					
						
							|  |  |  |       r=255.0*xr + 0.5; | 
					
						
							|  |  |  |       g=255.0*xg + 0.5; | 
					
						
							|  |  |  |       b=255.0*xb + 0.5; | 
					
						
							|  |  |  |       m_ColorTbl[i].setRgb(r,g,b); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  | double CPlotter::fGreen() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   return m_fGreen; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2012-09-29 17:09:05 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-11-14 15:30:21 +00:00
										 |  |  | void CPlotter::setNsps(int ntrperiod, int nsps)                                  //setNSpan()
 | 
					
						
							| 
									
										
										
										
											2012-09-29 17:09:05 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2012-11-14 15:30:21 +00:00
										 |  |  |   m_TRperiod=ntrperiod; | 
					
						
							|  |  |  |   m_nsps=nsps; | 
					
						
							| 
									
										
										
										
											2012-10-19 19:26:07 +00:00
										 |  |  |   m_fftBinWidth=1500.0/2048.0; | 
					
						
							| 
									
										
										
										
											2012-10-03 19:25:49 +00:00
										 |  |  |   if(m_nsps==15360)  m_fftBinWidth=1500.0/2048.0; | 
					
						
							|  |  |  |   if(m_nsps==40960)  m_fftBinWidth=1500.0/6144.0; | 
					
						
							|  |  |  |   if(m_nsps==82944)  m_fftBinWidth=1500.0/12288.0; | 
					
						
							|  |  |  |   if(m_nsps==252000) m_fftBinWidth=1500.0/32768.0; | 
					
						
							| 
									
										
										
										
											2012-09-29 17:09:05 +00:00
										 |  |  |   DrawOverlay();                         //Redraw scales and ticks
 | 
					
						
							|  |  |  |   update();                              //trigger a new paintEvent}
 | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2012-11-23 16:05:50 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | void CPlotter::setTxFreq(int n)                                 //setTol()
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   m_txFreq=n; | 
					
						
							|  |  |  |   DrawOverlay(); | 
					
						
							|  |  |  |   update(); | 
					
						
							|  |  |  | } |