| 
									
										
										
										
											2014-04-03 19:29:13 +00:00
										 |  |  | // -*- Mode: C++ -*-
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | ///////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | // Some code in this file and accompanying files is based on work by
 | 
					
						
							|  |  |  | // Moe Wheatley, AE4Y, released under the "Simplified BSD License".
 | 
					
						
							|  |  |  | // For more details see the accompanying file LICENSE_WHEATLEY.TXT
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef PLOTTER_H
 | 
					
						
							|  |  |  | #define PLOTTER_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-23 20:21:47 +00:00
										 |  |  | #ifdef QT5
 | 
					
						
							|  |  |  | #include <QtWidgets>
 | 
					
						
							|  |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | #include <QtGui>
 | 
					
						
							| 
									
										
										
										
											2013-05-23 20:21:47 +00:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | #include <QFrame>
 | 
					
						
							|  |  |  | #include <QImage>
 | 
					
						
							| 
									
										
										
										
											2014-03-31 00:03:44 +00:00
										 |  |  | #include <QVector>
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | #include <cstring>
 | 
					
						
							|  |  |  | #include "commons.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define VERT_DIVS 7	//specify grid screen divisions
 | 
					
						
							|  |  |  | #define HORZ_DIVS 20
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class CPlotter : public QFrame | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2014-03-31 00:03:44 +00:00
										 |  |  |   Q_OBJECT; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | public: | 
					
						
							|  |  |  |   explicit CPlotter(QWidget *parent = 0); | 
					
						
							|  |  |  |   ~CPlotter(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   QSize minimumSizeHint() const; | 
					
						
							|  |  |  |   QSize sizeHint() const; | 
					
						
							| 
									
										
										
										
											2013-07-25 16:48:10 +00:00
										 |  |  |   void draw(float sw[]);		//Update the waterfall
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   void SetRunningState(bool running); | 
					
						
							|  |  |  |   void setPlotZero(int plotZero); | 
					
						
							|  |  |  |   int  getPlotZero(); | 
					
						
							|  |  |  |   void setPlotGain(int plotGain); | 
					
						
							|  |  |  |   int  getPlotGain(); | 
					
						
							| 
									
										
										
										
											2013-07-25 16:48:10 +00:00
										 |  |  |   void setStartFreq(int f); | 
					
						
							|  |  |  |   int startFreq(); | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   int  plotWidth(); | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  |   void setNSpan(int n); | 
					
						
							| 
									
										
										
										
											2014-03-31 00:03:44 +00:00
										 |  |  |   int nSpan() const {return m_nSpan;} | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   void UpdateOverlay(); | 
					
						
							|  |  |  |   void setDataFromDisk(bool b); | 
					
						
							| 
									
										
										
										
											2013-07-08 13:17:22 +00:00
										 |  |  |   void setRxRange(int fMin); | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  |   void setBinsPerPixel(int n); | 
					
						
							|  |  |  |   int  binsPerPixel(); | 
					
						
							| 
									
										
										
										
											2013-07-08 13:17:22 +00:00
										 |  |  |   void setRxFreq(int n, bool bf); | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   void DrawOverlay(); | 
					
						
							| 
									
										
										
										
											2013-07-08 13:17:22 +00:00
										 |  |  |   int  rxFreq(); | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  |   void setFsample(int n); | 
					
						
							| 
									
										
										
										
											2012-11-14 15:30:21 +00:00
										 |  |  |   void setNsps(int ntrperiod, int nsps); | 
					
						
							| 
									
										
										
										
											2012-11-23 16:05:50 +00:00
										 |  |  |   void setTxFreq(int n); | 
					
						
							| 
									
										
										
										
											2013-07-08 13:17:22 +00:00
										 |  |  |   void setMode(QString mode); | 
					
						
							|  |  |  |   void setModeTx(QString modeTx); | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  |   double fGreen(); | 
					
						
							| 
									
										
										
										
											2012-09-30 01:03:18 +00:00
										 |  |  |   void SetPercent2DScreen(int percent){m_Percent2DScreen=percent;} | 
					
						
							| 
									
										
										
										
											2013-07-08 13:17:22 +00:00
										 |  |  |   int getFmax(); | 
					
						
							| 
									
										
										
										
											2013-07-12 13:45:28 +00:00
										 |  |  |   void setDialFreq(double d); | 
					
						
							| 
									
										
										
										
											2012-09-30 01:03:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-03-31 00:03:44 +00:00
										 |  |  |   void setCurrent(bool b) {m_bCurrent = b;} | 
					
						
							|  |  |  |   bool current() const {return m_bCurrent;} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   void setCumulative(bool b) {m_bCumulative = b;} | 
					
						
							|  |  |  |   bool cumulative() const {return m_bCumulative;} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   void setLinearAvg(bool b) {m_bLinearAvg = b;} | 
					
						
							|  |  |  |   bool linearAvg() const {return m_bLinearAvg;} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   void setBreadth(qint32 w) {m_w = w;} | 
					
						
							|  |  |  |   qint32 breadth() const {return m_w;} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   float fSpan() const {return m_fSpan;} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   void setLockTxFreq(bool b) {m_lockTxFreq = b;} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   void setColours(QVector<QColor> const& cl) {m_ColorTbl = cl;} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | signals: | 
					
						
							|  |  |  |   void freezeDecode1(int n); | 
					
						
							| 
									
										
										
										
											2013-07-08 13:17:22 +00:00
										 |  |  |   void setFreq1(int rxFreq, int txFreq); | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | protected: | 
					
						
							|  |  |  |   //re-implemented widget event handlers
 | 
					
						
							|  |  |  |   void paintEvent(QPaintEvent *event); | 
					
						
							|  |  |  |   void resizeEvent(QResizeEvent* event); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  |   void MakeFrequencyStrs(); | 
					
						
							|  |  |  |   void UTCstr(); | 
					
						
							|  |  |  |   int XfromFreq(float f); | 
					
						
							|  |  |  |   float FreqfromX(int x); | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-03-31 00:03:44 +00:00
										 |  |  |   QVector<QColor> m_ColorTbl; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   bool    m_bCurrent; | 
					
						
							|  |  |  |   bool    m_bCumulative; | 
					
						
							|  |  |  |   bool    m_bLinearAvg; | 
					
						
							|  |  |  |   bool    m_lockTxFreq; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   float   m_fSpan; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   qint32  m_plotZero; | 
					
						
							|  |  |  |   qint32  m_plotGain; | 
					
						
							|  |  |  |   qint32  m_nSpan; | 
					
						
							|  |  |  |   qint32  m_binsPerPixel; | 
					
						
							|  |  |  |   qint32  m_w; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   QPixmap m_WaterfallPixmap; | 
					
						
							|  |  |  |   QPixmap m_2DPixmap; | 
					
						
							|  |  |  |   QPixmap m_ScalePixmap; | 
					
						
							| 
									
										
										
										
											2012-09-30 01:03:18 +00:00
										 |  |  |   QPixmap m_OverlayPixmap; | 
					
						
							|  |  |  | //  QPixmap m_LowerScalePixmap;
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   QSize   m_Size; | 
					
						
							|  |  |  |   QString m_Str; | 
					
						
							|  |  |  |   QString m_HDivText[483]; | 
					
						
							| 
									
										
										
										
											2013-07-08 13:17:22 +00:00
										 |  |  |   QString m_mode; | 
					
						
							|  |  |  |   QString m_modeTx; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   bool    m_Running; | 
					
						
							|  |  |  |   bool    m_paintEventBusy; | 
					
						
							| 
									
										
										
										
											2013-07-08 13:17:22 +00:00
										 |  |  |   bool    m_dataFromDisk; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-24 23:36:38 +00:00
										 |  |  |   double  m_fGreen; | 
					
						
							| 
									
										
										
										
											2012-09-29 17:52:35 +00:00
										 |  |  |   double  m_fftBinWidth; | 
					
						
							| 
									
										
										
										
											2013-07-12 13:45:28 +00:00
										 |  |  |   double  m_dialFreq; | 
					
						
							| 
									
										
										
										
											2013-07-08 13:17:22 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  |   qint32  m_dBStepSize; | 
					
						
							|  |  |  |   qint32  m_FreqUnits; | 
					
						
							|  |  |  |   qint32  m_hdivs; | 
					
						
							|  |  |  |   qint32  m_line; | 
					
						
							|  |  |  |   qint32  m_fSample; | 
					
						
							|  |  |  |   qint32  m_xClick; | 
					
						
							| 
									
										
										
										
											2012-09-29 17:09:05 +00:00
										 |  |  |   qint32  m_freqPerDiv; | 
					
						
							|  |  |  |   qint32  m_nsps; | 
					
						
							| 
									
										
										
										
											2012-09-30 01:03:18 +00:00
										 |  |  |   qint32  m_Percent2DScreen; | 
					
						
							|  |  |  |   qint32  m_h; | 
					
						
							|  |  |  |   qint32  m_h1; | 
					
						
							|  |  |  |   qint32  m_h2; | 
					
						
							| 
									
										
										
										
											2012-11-14 15:30:21 +00:00
										 |  |  |   qint32  m_TRperiod; | 
					
						
							| 
									
										
										
										
											2013-07-08 13:17:22 +00:00
										 |  |  |   qint32  m_rxFreq; | 
					
						
							| 
									
										
										
										
											2012-11-23 16:05:50 +00:00
										 |  |  |   qint32  m_txFreq; | 
					
						
							| 
									
										
										
										
											2013-04-03 16:44:31 +00:00
										 |  |  |   qint32  m_fMin; | 
					
						
							|  |  |  |   qint32  m_fMax; | 
					
						
							| 
									
										
										
										
											2013-07-25 16:48:10 +00:00
										 |  |  |   qint32  m_startFreq; | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-07-08 13:17:22 +00:00
										 |  |  |   char    m_sutc[6]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-22 17:09:48 +00:00
										 |  |  | private slots: | 
					
						
							|  |  |  |   void mousePressEvent(QMouseEvent *event); | 
					
						
							|  |  |  |   void mouseDoubleClickEvent(QMouseEvent *event); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif // PLOTTER_H
 |