forked from analogdevicesinc/scopy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBasicPlot.h
70 lines (55 loc) · 1.17 KB
/
BasicPlot.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef BASICPLOT_H
#define BASICPLOT_H
/*Qwt includes*/
#include <qwt_plot.h>
#include <qwt_plot_renderer.h>
#include <qwt_legend.h>
#include <qwt_plot_canvas.h>
#include <qwt_scale_engine.h>
#include <qwt_plot_textlabel.h>
#include <qwt_text.h>
/*Qt includes*/
#include <QObject>
#include <QTimer>
#include <QElapsedTimer>
/*Own includes */
#include <movingaverage.h>
//#define IMMEDIATE_PAINT
namespace adiscope {
class BasicPlot : public QwtPlot
{
Q_OBJECT
public:
BasicPlot(QWidget* parent);
public Q_SLOTS:
void start();
void startStop(bool en = true);
void stop();
bool isStarted();
void setRefreshRate(double hz);
double getRefreshRate();
void replotNow();
void setVisibleFpsLabel(bool vis);
void hideFpsLabel();
void showFpsLabel();
void replot() override;
protected:
QTimer replotTimer;
private:
static int staticPlotId;
bool started;
bool debug;
bool useOpenGlCanvas;
double replotFrameRate;
int id = 0;
MovingAverage pfps, pms;
MovingAverage ifps, ims;
const int fpsHistoryCount = 30;
const int fpsLabelRefreshTime = 500;
QwtPlotTextLabel fpsLabel;
QwtText fpsTxt;
QElapsedTimer fpsTimer;
QElapsedTimer fpsLabelTimer;
};
}
#endif // BASICPLOT_H