File indexing completed on 2025-01-26 03:34:18
0001 /* 0002 File : XYDataReductionCurve.h 0003 Project : LabPlot 0004 Description : A xy-curve defined by a data reduction 0005 -------------------------------------------------------------------- 0006 SPDX-FileCopyrightText: 2016 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 XYDATAREDUCTIONCURVE_H 0012 #define XYDATAREDUCTIONCURVE_H 0013 0014 #include "backend/worksheet/plots/cartesian/XYAnalysisCurve.h" 0015 0016 extern "C" { 0017 #include "backend/nsl/nsl_geom_linesim.h" 0018 } 0019 0020 class XYDataReductionCurvePrivate; 0021 0022 class XYDataReductionCurve : public XYAnalysisCurve { 0023 Q_OBJECT 0024 0025 public: 0026 struct DataReductionData { 0027 DataReductionData(){}; 0028 0029 nsl_geom_linesim_type type{nsl_geom_linesim_type_douglas_peucker_variant}; // type of simplification 0030 bool autoTolerance{true}; // automatic tolerance 0031 double tolerance{0.0}; // tolerance 0032 bool autoTolerance2{true}; // automatic tolerance2 0033 double tolerance2{0.0}; // tolerance2 0034 bool autoRange{true}; // use all data? 0035 // TODO: use Range 0036 QVector<double> xRange{0., 0.}; // x range for integration 0037 }; 0038 struct DataReductionResult : public XYAnalysisCurve::Result { 0039 DataReductionResult(){}; 0040 0041 size_t npoints{0}; 0042 double posError{0}; 0043 double areaError{0}; 0044 }; 0045 0046 explicit XYDataReductionCurve(const QString& name); 0047 ~XYDataReductionCurve() override; 0048 0049 void recalculate() override; 0050 const XYAnalysisCurve::Result& result() const override; 0051 QIcon icon() const override; 0052 void save(QXmlStreamWriter*) const override; 0053 bool load(XmlStreamReader*, bool preview) override; 0054 0055 CLASS_D_ACCESSOR_DECL(DataReductionData, dataReductionData, DataReductionData) 0056 const DataReductionResult& dataReductionResult() const; 0057 0058 typedef XYDataReductionCurvePrivate Private; 0059 0060 protected: 0061 XYDataReductionCurve(const QString& name, XYDataReductionCurvePrivate* dd); 0062 0063 private: 0064 Q_DECLARE_PRIVATE(XYDataReductionCurve) 0065 0066 Q_SIGNALS: 0067 void dataReductionDataChanged(const XYDataReductionCurve::DataReductionData&); 0068 void completed(int); //!< int ranging from 0 to 100 notifies about the status of the analysis process 0069 }; 0070 0071 #endif