LibreVNA/Software/PC_Application/Traces/tracewaterfall.h

84 lines
2.0 KiB
C
Raw Normal View History

2022-03-15 23:59:52 +08:00
#ifndef TRACEWATERFALL_H
#define TRACEWATERFALL_H
#include "traceplot.h"
2022-03-16 21:45:59 +08:00
#include "traceaxis.h"
#include <deque>
2022-03-15 23:59:52 +08:00
class TraceWaterfall : public TracePlot
{
2022-03-16 21:45:59 +08:00
friend class WaterfallAxisDialog;
2022-03-15 23:59:52 +08:00
Q_OBJECT
public:
TraceWaterfall(TraceModel &model, QWidget *parent = 0);;
virtual void enableTrace(Trace *t, bool enabled) override;
void replot() override;
virtual Type getType() override { return Type::Waterfall;};
void fromJSON(nlohmann::json j) override;
nlohmann::json toJSON() override;
public slots:
void axisSetupDialog();
void resetWaterfall();
protected:
virtual bool configureForTrace(Trace *t) override;
virtual void updateContextMenu() override;
virtual void draw(QPainter& p) override;
2022-03-16 21:45:59 +08:00
bool domainMatch(Trace *t);
2022-03-15 23:59:52 +08:00
virtual bool supported(Trace *t) override;
virtual QPoint markerToPixel(Marker *m) override { Q_UNUSED(m) return QPoint(0,0);};
virtual double nearestTracePoint(Trace *t, QPoint pixel, double *distance = nullptr) override;
virtual QString mouseText(QPoint pos) override;
protected slots:
2022-03-16 21:45:59 +08:00
virtual bool markerVisible(double x) override;
void traceDataChanged(unsigned int begin, unsigned int end);
2022-03-15 23:59:52 +08:00
private slots:
2022-03-16 21:45:59 +08:00
void updateYAxis();
2022-03-15 23:59:52 +08:00
private:
static constexpr int AxisLabelSize = 10;
2022-03-16 21:45:59 +08:00
// color scale, input value from 0.0 to 1.0
QColor getColor(double scale);
enum class Direction {
TopToBottom,
BottomToTop,
2022-03-15 23:59:52 +08:00
};
2022-03-17 06:56:44 +08:00
// match alignment of XYplot with either one or both Y axes enabled
enum class Alignment {
PrimaryOnly = 0,
SecondaryOnly = 1,
BothAxes = 2,
Last,
};
static QString AlignmentToString(Alignment a);
static Alignment AlignmentFromString(QString s);
2022-03-16 21:45:59 +08:00
Direction dir;
2022-03-17 06:56:44 +08:00
Alignment align;
2022-03-16 21:45:59 +08:00
Trace *trace;
2022-03-16 22:02:15 +08:00
XAxis xAxis;
YAxis yAxis;
2022-03-15 23:59:52 +08:00
2022-03-16 21:45:59 +08:00
std::deque<std::vector<Trace::Data>> data;
2022-03-15 23:59:52 +08:00
unsigned int pixelsPerLine;
int plotAreaLeft, plotAreaWidth, plotAreaBottom, plotAreaTop;
2022-03-16 21:45:59 +08:00
bool keepDataBeyondPlotSize;
unsigned int maxDataSweeps;
2022-03-15 23:59:52 +08:00
};
#endif // TRACEWATERFALL_H