File indexing completed on 2025-01-26 03:34:21

0001 /*
0002     File                 : XYHilbertTransformCurve.h
0003     Project              : LabPlot
0004     Description          : A xy-curve defined by a Hilbert transform
0005     --------------------------------------------------------------------
0006     SPDX-FileCopyrightText: 2021 Stefan Gerlach <stefan.gerlach@uni.kn>
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #ifndef XYHILBERTTRANSFORMCURVE_H
0011 #define XYHILBERTTRANSFORMCURVE_H
0012 
0013 #include "backend/worksheet/plots/cartesian/XYAnalysisCurve.h"
0014 extern "C" {
0015 #include "backend/nsl/nsl_hilbert.h"
0016 }
0017 
0018 class XYHilbertTransformCurvePrivate;
0019 
0020 class XYHilbertTransformCurve : public XYAnalysisCurve {
0021     Q_OBJECT
0022 
0023 public:
0024     struct TransformData {
0025         TransformData(){};
0026 
0027         nsl_hilbert_result_type type{nsl_hilbert_result_imag};
0028         bool autoRange{true}; // use all data?
0029         // TODO: use Range
0030         QVector<double> xRange{0, 0}; // x range for transform
0031     };
0032 
0033     explicit XYHilbertTransformCurve(const QString& name);
0034     ~XYHilbertTransformCurve() override;
0035 
0036     void recalculate() override;
0037     virtual const XYAnalysisCurve::Result& result() const override;
0038     QIcon icon() const override;
0039     void save(QXmlStreamWriter*) const override;
0040     bool load(XmlStreamReader*, bool preview) override;
0041 
0042     CLASS_D_ACCESSOR_DECL(TransformData, transformData, TransformData)
0043 
0044     typedef XYAnalysisCurve::Result TransformResult;
0045 
0046     typedef XYHilbertTransformCurvePrivate Private;
0047 
0048 protected:
0049     XYHilbertTransformCurve(const QString& name, XYHilbertTransformCurvePrivate* dd);
0050 
0051 private:
0052     Q_DECLARE_PRIVATE(XYHilbertTransformCurve)
0053 
0054 Q_SIGNALS:
0055     void transformDataChanged(const XYHilbertTransformCurve::TransformData&);
0056 };
0057 
0058 #endif