File indexing completed on 2025-01-26 03:34:16
0001 /* 0002 File : XYCorrelationCurve.h 0003 Project : LabPlot 0004 Description : A xy-curve defined by a correlation 0005 -------------------------------------------------------------------- 0006 SPDX-FileCopyrightText: 2018 Stefan Gerlach <stefan.gerlach@uni.kn> 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 0010 #ifndef XYCORRELATIONCURVE_H 0011 #define XYCORRELATIONCURVE_H 0012 0013 #include "backend/worksheet/plots/cartesian/XYAnalysisCurve.h" 0014 0015 extern "C" { 0016 #include "backend/nsl/nsl_corr.h" 0017 } 0018 0019 class XYCorrelationCurvePrivate; 0020 0021 class XYCorrelationCurve : public XYAnalysisCurve { 0022 Q_OBJECT 0023 0024 public: 0025 struct CorrelationData { 0026 CorrelationData(){}; 0027 0028 double samplingInterval{1.}; // sampling interval used when no x-axis is present 0029 nsl_corr_type_type type{nsl_corr_type_linear}; // linear or circular 0030 nsl_corr_norm_type normalize{nsl_corr_norm_none}; // normalization 0031 bool autoRange{true}; // use all data? 0032 // TODO: use Range 0033 QVector<double> xRange{0., 0.}; // x range for correlation 0034 }; 0035 0036 explicit XYCorrelationCurve(const QString& name); 0037 ~XYCorrelationCurve() override; 0038 0039 typedef XYAnalysisCurve::Result CorrelationResult; 0040 virtual const XYAnalysisCurve::Result& result() const override; 0041 0042 void recalculate() override; 0043 QIcon icon() const override; 0044 void save(QXmlStreamWriter*) const override; 0045 bool load(XmlStreamReader*, bool preview) override; 0046 0047 CLASS_D_ACCESSOR_DECL(CorrelationData, correlationData, CorrelationData) 0048 const CorrelationResult& correlationResult() const; 0049 0050 typedef XYCorrelationCurvePrivate Private; 0051 0052 protected: 0053 XYCorrelationCurve(const QString& name, XYCorrelationCurvePrivate* dd); 0054 0055 private: 0056 Q_DECLARE_PRIVATE(XYCorrelationCurve) 0057 0058 Q_SIGNALS: 0059 void correlationDataChanged(const XYCorrelationCurve::CorrelationData&); 0060 }; 0061 0062 #endif