-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathWaterfallplot.h
123 lines (95 loc) · 3.94 KB
/
Waterfallplot.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#ifndef WATERFALLPLOT_H
#define WATERFALLPLOT_H
#include <QWidget>
#include "ColorMaps.h"
#include "WaterfallData.h"
class QwtPlot;
class QwtPlotCurve;
class QwtPlotMarker;
class QwtPlotPanner;
class QwtPlotPicker;
class QwtPlotSpectrogram;
class QwtPlotZoomer;
class Waterfallplot : public QWidget
{
public:
Waterfallplot(QWidget* parent, const ColorMaps::ControlPoints& ctrlPts = ColorMaps::Jet());
~Waterfallplot() override;
void setDataDimensions(double dXMin, double dXMax, // X bounds, fixed once for all
const size_t historyExtent, // Will define Y width (number of layers)
const size_t layerPoints); // FFT/Data points in a single layer)
void getDataDimensions(double& dXMin,
double& dXMax,
size_t& historyExtent,
size_t& layerPoints) const;
bool setMarker(const double x, const double y);
// view
void replot(bool forceRepaint = false);
void setWaterfallVisibility(const bool bVisible);
void setTitle(const QString& qstrNewTitle);
void setXLabel(const QString& qstrTitle, const int fontPointSize = 12);
void setYLabel(const QString& qstrTitle, const int fontPointSize = 12);
void setZLabel(const QString& qstrTitle, const int fontPointSize = 12);
void setXTooltipUnit(const QString& xUnit);
void setZTooltipUnit(const QString& zUnit);
bool setColorMap(const ColorMaps::ControlPoints& colorMap);
ColorMaps::ControlPoints getColorMap() const;
QwtPlot* getHorizontalCurvePlot() const { return m_plotHorCurve; }
QwtPlot* getVerticalCurvePlot() const { return m_plotVertCurve; }
QwtPlot* getSpectrogramPlot() const { return m_plotSpectrogram; }
// data
bool addData(const double* const dataPtr, const size_t dataLen, const time_t timestamp);
void setRange(double dLower, double dUpper);
void getRange(double& rangeMin, double& rangeMax) const;
void getDataRange(double& rangeMin, double& rangeMax) const;
void clear();
time_t getLayerDate(const double y) const;
double getOffset() const { return (m_data) ? m_data->getOffset() : 0; }
QString m_xUnit;
QString m_zUnit;
public slots:
void setPickerEnabled(const bool enabled);
protected slots:
void autoRescale(const QRectF& rect);
void selectedPoint(const QPointF& pt);
protected:
QwtPlot* const m_plotHorCurve = nullptr;
QwtPlot* const m_plotVertCurve = nullptr;
QwtPlot* const m_plotSpectrogram = nullptr;
QwtPlotCurve* m_horCurve = nullptr;
QwtPlotCurve* m_vertCurve = nullptr;
QwtPlotPicker* const m_picker = nullptr;
QwtPlotPanner* const m_panner = nullptr;
QwtPlotSpectrogram* const m_spectrogram = nullptr;
QwtPlotZoomer* const m_zoomer = nullptr;
QwtPlotMarker* const m_horCurveMarker = nullptr;
QwtPlotMarker* const m_vertCurveMarker = nullptr;
// later, the type can be parametrized when instanciating Waterfallplot
// m_pData will be owned (freed) by m_spectrogram
// Sadly, to avoid compile problems with a templated class, the implementation
// needs to be moved in this header file !
WaterfallData<double>* m_data = nullptr;
bool m_bColorBarInitialized = false;
double* m_horCurveXAxisData = nullptr;
double* m_horCurveYAxisData = nullptr;
double* m_vertCurveXAxisData = nullptr;
double* m_vertCurveYAxisData = nullptr;
mutable bool m_inScaleSync = false;
double m_markerX = 0;
double m_markerY = 0;
ColorMaps::ControlPoints m_ctrlPts;
bool m_zoomActive = false;
protected slots:
void scaleDivChanged();
protected:
void updateLayout();
void allocateCurvesData();
void freeCurvesData();
void setupCurves();
void updateCurvesData();
private:
//Q_DISABLE_COPY(Waterfallplot)
void alignAxis(int axisId);
void alignAxisForColorBar();
};
#endif // WATERFALLPLOT_