2014-04-03 15:29:13 -04:00
|
|
|
// -*- Mode: C++ -*-
|
2012-05-22 13:09:48 -04: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
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2018-12-06 00:41:16 -05:00
|
|
|
#ifndef PLOTTER_H_
|
|
|
|
#define PLOTTER_H_
|
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
#include <QFrame>
|
2018-12-06 00:41:16 -05:00
|
|
|
#include <QSize>
|
2012-05-22 13:09:48 -04:00
|
|
|
#include <QImage>
|
2014-03-30 20:03:44 -04:00
|
|
|
#include <QVector>
|
2018-12-06 00:41:16 -05:00
|
|
|
#include <QColor>
|
2020-07-24 13:35:04 -04:00
|
|
|
#include <QToolTip>
|
2012-05-22 13:09:48 -04:00
|
|
|
|
|
|
|
#define VERT_DIVS 7 //specify grid screen divisions
|
|
|
|
#define HORZ_DIVS 20
|
|
|
|
|
2016-03-24 12:46:52 -04:00
|
|
|
extern bool g_single_decode;
|
|
|
|
|
2017-10-27 08:38:25 -04:00
|
|
|
class QAction;
|
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
class CPlotter : public QFrame
|
|
|
|
{
|
2017-10-27 08:38:25 -04:00
|
|
|
Q_OBJECT
|
2014-03-30 20:03:44 -04:00
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
public:
|
|
|
|
explicit CPlotter(QWidget *parent = 0);
|
|
|
|
~CPlotter();
|
|
|
|
|
2019-07-01 22:10:43 -04:00
|
|
|
QSize minimumSizeHint() const Q_DECL_OVERRIDE;
|
|
|
|
QSize sizeHint() const Q_DECL_OVERRIDE;
|
2015-05-27 09:08:28 -04:00
|
|
|
|
2016-07-06 10:18:23 -04:00
|
|
|
void draw(float swide[], bool bScroll, bool bRed); //Update the waterfall
|
2018-01-17 11:41:07 -05:00
|
|
|
void replot();
|
2012-05-22 13:09:48 -04:00
|
|
|
void SetRunningState(bool running);
|
|
|
|
void setPlotZero(int plotZero);
|
2015-04-22 13:48:03 -04:00
|
|
|
int plotZero();
|
2012-05-22 13:09:48 -04:00
|
|
|
void setPlotGain(int plotGain);
|
2015-04-22 13:48:03 -04:00
|
|
|
int plotGain();
|
|
|
|
int plot2dGain();
|
|
|
|
void setPlot2dGain(int n);
|
|
|
|
int plot2dZero();
|
|
|
|
void setPlot2dZero(int plot2dZero);
|
2013-07-25 12:48:10 -04:00
|
|
|
void setStartFreq(int f);
|
|
|
|
int startFreq();
|
2012-05-22 13:09:48 -04:00
|
|
|
int plotWidth();
|
|
|
|
void UpdateOverlay();
|
|
|
|
void setDataFromDisk(bool b);
|
2013-07-08 09:17:22 -04:00
|
|
|
void setRxRange(int fMin);
|
2012-09-24 19:36:38 -04:00
|
|
|
void setBinsPerPixel(int n);
|
|
|
|
int binsPerPixel();
|
2015-05-27 09:08:28 -04:00
|
|
|
void setWaterfallAvg(int n);
|
2014-09-24 13:25:19 -04:00
|
|
|
void setRxFreq(int n);
|
2012-05-22 13:09:48 -04:00
|
|
|
void DrawOverlay();
|
2013-07-08 09:17:22 -04:00
|
|
|
int rxFreq();
|
2012-09-24 19:36:38 -04:00
|
|
|
void setFsample(int n);
|
2019-05-22 12:44:28 -04:00
|
|
|
void setNsps(double trperiod, int nsps);
|
2012-11-23 11:05:50 -05:00
|
|
|
void setTxFreq(int n);
|
2013-07-08 09:17:22 -04:00
|
|
|
void setMode(QString mode);
|
2015-04-22 13:48:03 -04:00
|
|
|
void setSubMode(int n);
|
2015-11-22 18:38:42 -05:00
|
|
|
void SetPercent2DScreen(int percent);
|
2015-04-22 13:48:03 -04:00
|
|
|
int Fmax();
|
2013-07-12 09:45:28 -04:00
|
|
|
void setDialFreq(double d);
|
2014-03-30 20:03:44 -04: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;}
|
2015-11-17 20:28:12 -05:00
|
|
|
void setColours(QVector<QColor> const& cl);
|
2016-04-12 15:54:15 -04:00
|
|
|
void setFlatten(bool b1, bool b2);
|
2015-04-22 13:48:03 -04:00
|
|
|
void setTol(int n);
|
2015-05-27 09:08:28 -04:00
|
|
|
void setRxBand(QString band);
|
2015-11-17 20:28:12 -05:00
|
|
|
void setReference(bool b) {m_bReference = b;}
|
|
|
|
bool Reference() const {return m_bReference;}
|
2020-12-18 13:31:14 -05:00
|
|
|
void setQ65_Sync(bool b) {m_bQ65_Sync = b;}
|
|
|
|
bool Q65_Sync() const {return m_bQ65_Sync;}
|
2021-02-01 15:28:22 -05:00
|
|
|
void drawRed(int ia, int ib, float swide[]);
|
2016-10-24 10:56:14 -04:00
|
|
|
void setVHF(bool bVHF);
|
2017-02-10 11:38:19 -05:00
|
|
|
void setRedFile(QString fRed);
|
2020-09-16 17:02:40 -04:00
|
|
|
void setFST4_FreqRange(int fLow,int fHigh);
|
2020-09-16 20:16:32 -04:00
|
|
|
void setSingleDecode(bool b);
|
2021-03-16 16:55:28 -04:00
|
|
|
void setDiskUTC(int nutc);
|
2020-09-16 17:02:40 -04:00
|
|
|
|
2017-10-27 08:38:25 -04:00
|
|
|
bool scaleOK () const {return m_bScaleOK;}
|
2012-05-22 13:09:48 -04:00
|
|
|
signals:
|
|
|
|
void freezeDecode1(int n);
|
2013-07-08 09:17:22 -04:00
|
|
|
void setFreq1(int rxFreq, int txFreq);
|
2012-05-22 13:09:48 -04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
//re-implemented widget event handlers
|
2017-10-27 08:38:25 -04:00
|
|
|
void paintEvent(QPaintEvent *event) override;
|
|
|
|
void resizeEvent(QResizeEvent* event) override;
|
2020-07-24 13:35:04 -04:00
|
|
|
void mouseMoveEvent(QMouseEvent * event) override;
|
2017-10-27 08:38:25 -04:00
|
|
|
void mouseReleaseEvent (QMouseEvent * event) override;
|
|
|
|
void mouseDoubleClickEvent (QMouseEvent * event) override;
|
2012-05-22 13:09:48 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2012-09-24 19:36:38 -04:00
|
|
|
void MakeFrequencyStrs();
|
|
|
|
int XfromFreq(float f);
|
|
|
|
float FreqfromX(int x);
|
2012-05-22 13:09:48 -04:00
|
|
|
|
2017-10-27 08:38:25 -04:00
|
|
|
QAction * m_set_freq_action;
|
|
|
|
|
|
|
|
bool m_bScaleOK;
|
2014-03-30 20:03:44 -04:00
|
|
|
bool m_bCurrent;
|
|
|
|
bool m_bCumulative;
|
|
|
|
bool m_bLinearAvg;
|
2015-11-17 20:28:12 -05:00
|
|
|
bool m_bReference;
|
|
|
|
bool m_bReference0;
|
2020-12-18 13:31:14 -05:00
|
|
|
bool m_bQ65_Sync;
|
2016-10-24 10:56:14 -04:00
|
|
|
bool m_bVHF;
|
2020-09-16 20:16:32 -04:00
|
|
|
bool m_bSingleDecode;
|
2020-12-18 15:14:17 -05:00
|
|
|
bool m_bFirst=true;
|
2020-12-21 15:07:53 -05:00
|
|
|
bool m_bResized;
|
2014-03-30 20:03:44 -04:00
|
|
|
|
|
|
|
float m_fSpan;
|
|
|
|
|
|
|
|
qint32 m_plotZero;
|
|
|
|
qint32 m_plotGain;
|
2015-04-22 13:48:03 -04:00
|
|
|
qint32 m_plot2dGain;
|
|
|
|
qint32 m_plot2dZero;
|
2014-03-30 20:03:44 -04:00
|
|
|
qint32 m_binsPerPixel;
|
2015-05-27 09:08:28 -04:00
|
|
|
qint32 m_waterfallAvg;
|
2014-03-30 20:03:44 -04:00
|
|
|
qint32 m_w;
|
2015-02-10 19:50:35 -05:00
|
|
|
qint32 m_Flatten;
|
2015-04-22 13:48:03 -04:00
|
|
|
qint32 m_nSubMode;
|
2016-07-06 10:18:23 -04:00
|
|
|
qint32 m_ia;
|
|
|
|
qint32 m_ib;
|
2020-09-16 17:02:40 -04:00
|
|
|
qint32 m_nfa;
|
|
|
|
qint32 m_nfb;
|
2021-03-16 16:55:28 -04:00
|
|
|
qint32 m_nUTC;
|
2014-03-30 20:03:44 -04:00
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
QPixmap m_WaterfallPixmap;
|
|
|
|
QPixmap m_2DPixmap;
|
|
|
|
QPixmap m_ScalePixmap;
|
2012-09-29 21:03:18 -04:00
|
|
|
QPixmap m_OverlayPixmap;
|
2015-11-17 20:28:12 -05:00
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
QSize m_Size;
|
|
|
|
QString m_Str;
|
|
|
|
QString m_HDivText[483];
|
2013-07-08 09:17:22 -04:00
|
|
|
QString m_mode;
|
2020-12-19 11:33:23 -05:00
|
|
|
QString m_mode0;
|
2015-05-27 09:08:28 -04:00
|
|
|
QString m_rxBand;
|
2017-02-10 11:38:19 -05:00
|
|
|
QString m_redFile;
|
2013-07-08 09:17:22 -04:00
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
bool m_Running;
|
|
|
|
bool m_paintEventBusy;
|
2013-07-08 09:17:22 -04:00
|
|
|
bool m_dataFromDisk;
|
2018-01-17 11:41:07 -05:00
|
|
|
bool m_bReplot;
|
2013-07-08 09:17:22 -04:00
|
|
|
|
2012-09-29 13:52:35 -04:00
|
|
|
double m_fftBinWidth;
|
2013-07-12 09:45:28 -04:00
|
|
|
double m_dialFreq;
|
2014-10-03 11:08:40 -04:00
|
|
|
double m_xOffset;
|
2019-05-22 12:44:28 -04:00
|
|
|
double m_TRperiod;
|
2013-07-08 09:17:22 -04:00
|
|
|
|
2015-11-17 20:28:12 -05:00
|
|
|
float m_sum[2048];
|
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
qint32 m_dBStepSize;
|
|
|
|
qint32 m_FreqUnits;
|
|
|
|
qint32 m_hdivs;
|
|
|
|
qint32 m_line;
|
|
|
|
qint32 m_fSample;
|
|
|
|
qint32 m_xClick;
|
2012-09-29 13:09:05 -04:00
|
|
|
qint32 m_freqPerDiv;
|
|
|
|
qint32 m_nsps;
|
2012-09-29 21:03:18 -04:00
|
|
|
qint32 m_Percent2DScreen;
|
2015-11-22 18:38:42 -05:00
|
|
|
qint32 m_Percent2DScreen0;
|
2012-09-29 21:03:18 -04:00
|
|
|
qint32 m_h;
|
|
|
|
qint32 m_h1;
|
|
|
|
qint32 m_h2;
|
2013-07-08 09:17:22 -04:00
|
|
|
qint32 m_rxFreq;
|
2021-01-07 15:51:52 -05:00
|
|
|
qint32 m_rxFreq0=0;
|
2012-11-23 11:05:50 -05:00
|
|
|
qint32 m_txFreq;
|
2013-04-03 12:44:31 -04:00
|
|
|
qint32 m_fMin;
|
|
|
|
qint32 m_fMax;
|
2013-07-25 12:48:10 -04:00
|
|
|
qint32 m_startFreq;
|
2015-04-22 13:48:03 -04:00
|
|
|
qint32 m_tol;
|
2018-01-12 15:40:15 -05:00
|
|
|
qint32 m_j;
|
2012-05-22 13:09:48 -04:00
|
|
|
|
2013-07-08 09:17:22 -04:00
|
|
|
char m_sutc[6];
|
2012-05-22 13:09:48 -04:00
|
|
|
};
|
|
|
|
|
2015-11-17 20:28:12 -05:00
|
|
|
extern QVector<QColor> g_ColorTbl;
|
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
#endif // PLOTTER_H
|