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

0001 /*
0002     File                 : XYDifferentiationCurve.h
0003     Project              : LabPlot
0004     Description          : A xy-curve defined by an differentiation
0005     --------------------------------------------------------------------
0006     SPDX-FileCopyrightText: 2016-2021 Stefan Gerlach <stefan.gerlach@uni.kn>
0007     SPDX-FileCopyrightText: 2017 Alexander Semke <alexander.semke@web.de>
0008     SPDX-License-Identifier: GPL-2.0-or-later
0009 */
0010 
0011 #ifndef XYDIFFERENTIATIONCURVE_H
0012 #define XYDIFFERENTIATIONCURVE_H
0013 
0014 #include "backend/worksheet/plots/cartesian/XYAnalysisCurve.h"
0015 
0016 extern "C" {
0017 #include "backend/nsl/nsl_diff.h"
0018 }
0019 
0020 class XYDifferentiationCurvePrivate;
0021 
0022 class XYDifferentiationCurve : public XYAnalysisCurve {
0023     Q_OBJECT
0024 
0025 public:
0026     struct DifferentiationData {
0027         DifferentiationData(){};
0028 
0029         nsl_diff_deriv_order_type derivOrder{nsl_diff_deriv_order_first}; // order of differentiation
0030         int accOrder{2}; // order of accuracy
0031         bool autoRange{true}; // use all data?
0032         // TODO: use Range
0033         QVector<double> xRange{0., 0.}; // x range for integration
0034     };
0035 
0036     explicit XYDifferentiationCurve(const QString& name);
0037     ~XYDifferentiationCurve() override;
0038 
0039     void recalculate() override;
0040     virtual const Result& result() const override;
0041     QIcon icon() const override;
0042     void save(QXmlStreamWriter*) const override;
0043     bool load(XmlStreamReader*, bool preview) override;
0044 
0045     CLASS_D_ACCESSOR_DECL(DifferentiationData, differentiationData, DifferentiationData)
0046 
0047     typedef XYAnalysisCurve::Result DifferentiationResult;
0048     const DifferentiationResult& differentiationResult() const;
0049 
0050     typedef XYDifferentiationCurvePrivate Private;
0051 
0052 protected:
0053     XYDifferentiationCurve(const QString& name, XYDifferentiationCurvePrivate* dd);
0054 
0055 private:
0056     Q_DECLARE_PRIVATE(XYDifferentiationCurve)
0057 
0058 Q_SIGNALS:
0059     void differentiationDataChanged(const XYDifferentiationCurve::DifferentiationData&);
0060 };
0061 
0062 #endif