mirror of
https://github.com/jankae/LibreVNA.git
synced 2026-04-04 14:07:30 +00:00
Qwt dependency removed, drag&drop for traces added
This commit is contained in:
parent
25196fbc30
commit
c22d576984
13 changed files with 415 additions and 737 deletions
|
|
@ -3,35 +3,13 @@
|
|||
|
||||
#include "traceplot.h"
|
||||
#include <set>
|
||||
//#include <qwt_plot.h>
|
||||
//#include <qwt_plot_curve.h>
|
||||
//#include <qwt_series_data.h>
|
||||
//#include <qwt_plot_marker.h>
|
||||
//#include <qwt_plot_grid.h>
|
||||
//#include <qwt_plot_picker.h>
|
||||
|
||||
//// Derived plotpicker, exposing transformation functions
|
||||
//class XYplotPicker : public QwtPlotPicker {
|
||||
// Q_OBJECT
|
||||
//public:
|
||||
// XYplotPicker(int xAxis, int yAxis, RubberBand rubberBand, DisplayMode trackerMode, QWidget *w)
|
||||
// : QwtPlotPicker(xAxis, yAxis, rubberBand, trackerMode, w) {};
|
||||
// QPoint plotToPixel(const QPointF &pos) {
|
||||
// return transform(pos);
|
||||
// }
|
||||
// QPointF pixelToPlot(const QPoint &pos) {
|
||||
// return invTransform(pos);
|
||||
// }
|
||||
//};
|
||||
|
||||
class TraceXYPlot : public TracePlot
|
||||
{
|
||||
friend class XYplotAxisDialog;
|
||||
// friend class QwtTraceSeries;
|
||||
Q_OBJECT
|
||||
public:
|
||||
TraceXYPlot(TraceModel &model, QWidget *parent = nullptr);
|
||||
~TraceXYPlot();
|
||||
|
||||
enum class YAxisType {
|
||||
Disabled = 0,
|
||||
|
|
@ -61,9 +39,8 @@ public:
|
|||
void setXAxis(XAxisType type, XAxisMode mode, double min, double max, double div);
|
||||
void enableTrace(Trace *t, bool enabled) override;
|
||||
void updateSpan(double min, double max) override;
|
||||
void replot() override;
|
||||
|
||||
// Applies potentially changed colors to all XY-plots
|
||||
// static void updateGraphColors();
|
||||
bool isTDRtype(YAxisType type);
|
||||
|
||||
public slots:
|
||||
|
|
@ -76,23 +53,16 @@ protected:
|
|||
|
||||
private slots:
|
||||
void updateAxisTicks();
|
||||
// void traceColorChanged(Trace *t);
|
||||
// void markerAdded(TraceMarker *m) override;
|
||||
// void markerRemoved(TraceMarker *m) override;
|
||||
// void markerDataChanged(TraceMarker *m);
|
||||
// void markerSymbolChanged(TraceMarker *m);
|
||||
|
||||
// void clicked(const QPointF pos);
|
||||
// void moved(const QPointF pos);
|
||||
private:
|
||||
static constexpr int AxisLabelSize = 10;
|
||||
// void setColorFromPreferences();
|
||||
QString AxisTypeToName(YAxisType type);
|
||||
void enableTraceAxis(Trace *t, int axis, bool enabled);
|
||||
bool supported(Trace *t, YAxisType type);
|
||||
void updateXAxis();
|
||||
double transformFrequencyY(std::complex<double> data, YAxisType type);
|
||||
// QwtSeriesData<QPointF> *createQwtSeriesData(Trace &t, int axis);
|
||||
double transformY(std::complex<double> data, YAxisType type);
|
||||
QPointF transformY(Trace *t, unsigned int sample, YAxisType type);
|
||||
unsigned int numTraceSamples(Trace *t);
|
||||
QPoint dataToPixel(Trace::Data d) override;
|
||||
void traceDropped(Trace *t, QPoint position) override;
|
||||
|
||||
std::set<Trace*> tracesAxis[2];
|
||||
|
||||
|
|
@ -120,22 +90,7 @@ private:
|
|||
YAxis YAxis[2];
|
||||
XAxis XAxis;
|
||||
|
||||
// using CurveData = struct {
|
||||
// QwtPlotCurve *curve;
|
||||
// QwtSeriesData<QPointF> *data;
|
||||
// };
|
||||
|
||||
// std::map<Trace*, CurveData> curves[2];
|
||||
// std::map<TraceMarker*, QwtPlotMarker*> markers;
|
||||
// QwtPlot *plot;
|
||||
// QwtPlotGrid *grid;
|
||||
TraceMarker *selectedMarker;
|
||||
// QwtPlotCurve *selectedCurve;
|
||||
|
||||
// XYplotPicker *drawPicker;
|
||||
|
||||
// keep track of all created plots for changing colors
|
||||
// static std::set<TraceXYPlot*> allPlots;
|
||||
int plotAreaLeft, plotAreaWidth, plotAreaBottom;
|
||||
};
|
||||
|
||||
#endif // TRACEXYPLOT_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue