File indexing completed on 2024-05-12 15:28:10

0001 /***************************************************************************
0002     File             : XYInterpolationCurveDock.h
0003     Project          : LabPlot
0004     --------------------------------------------------------------------
0005     Copyright        : (C) 2016 Stefan Gerlach (stefan.gerlach@uni.kn)
0006     Description      : widget for editing properties of interpolation curves
0007 
0008  ***************************************************************************/
0009 
0010 /***************************************************************************
0011  *                                                                         *
0012  *  This program is free software; you can redistribute it and/or modify   *
0013  *  it under the terms of the GNU General Public License as published by   *
0014  *  the Free Software Foundation; either version 2 of the License, or      *
0015  *  (at your option) any later version.                                    *
0016  *                                                                         *
0017  *  This program is distributed in the hope that it will be useful,        *
0018  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
0019  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
0020  *  GNU General Public License for more details.                           *
0021  *                                                                         *
0022  *   You should have received a copy of the GNU General Public License     *
0023  *   along with this program; if not, write to the Free Software           *
0024  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
0025  *   Boston, MA  02110-1301  USA                                           *
0026  *                                                                         *
0027  ***************************************************************************/
0028 
0029 #ifndef XYINTERPOLATIONCURVEDOCK_H
0030 #define XYINTERPOLATIONCURVEDOCK_H
0031 
0032 #include "kdefrontend/dockwidgets/XYCurveDock.h"
0033 #include "backend/worksheet/plots/cartesian/XYAnalysisCurve.h"
0034 #include "backend/worksheet/plots/cartesian/XYInterpolationCurve.h"
0035 #include "ui_xyinterpolationcurvedockgeneraltab.h"
0036 
0037 class TreeViewComboBox;
0038 
0039 class XYInterpolationCurveDock: public XYCurveDock {
0040     Q_OBJECT
0041 
0042 public:
0043     explicit XYInterpolationCurveDock(QWidget *parent);
0044     void setCurves(QList<XYCurve*>);
0045     void setupGeneral() override;
0046 
0047 private:
0048     void initGeneralTab() override;
0049     void showInterpolationResult();
0050     void updateSettings(const AbstractColumn*);
0051 
0052     Ui::XYInterpolationCurveDockGeneralTab uiGeneralTab;
0053     TreeViewComboBox* cbDataSourceCurve{nullptr};
0054     TreeViewComboBox* cbXDataColumn{nullptr};
0055     TreeViewComboBox* cbYDataColumn{nullptr};
0056 
0057     XYInterpolationCurve* m_interpolationCurve{nullptr};
0058     XYInterpolationCurve::InterpolationData m_interpolationData;
0059     unsigned int dataPoints{0}; // number of data points in selected column
0060     bool m_dateTimeRange{false};
0061 
0062 protected:
0063     void setModel() override;
0064 
0065 private slots:
0066     //SLOTs for changes triggered in XYInterpolationCurveDock
0067     //general tab
0068     void dataSourceTypeChanged(int);
0069     void dataSourceCurveChanged(const QModelIndex&);
0070     void xDataColumnChanged(const QModelIndex&);
0071     void yDataColumnChanged(const QModelIndex&);
0072     void autoRangeChanged();
0073     void xRangeMinChanged(double);
0074     void xRangeMaxChanged(double);
0075     void xRangeMinDateTimeChanged(const QDateTime&);
0076     void xRangeMaxDateTimeChanged(const QDateTime&);
0077     void typeChanged(int);
0078     void variantChanged(int);
0079     void tensionChanged(double);
0080     void continuityChanged(double);
0081     void biasChanged(double);
0082     void evaluateChanged(int);
0083     void numberOfPointsChanged();
0084     void pointsModeChanged(int);
0085 
0086     void recalculateClicked();
0087     void enableRecalculate() const;
0088 
0089     //SLOTs for changes triggered in XYCurve
0090     //General-Tab
0091     void curveDescriptionChanged(const AbstractAspect*);
0092     void curveDataSourceTypeChanged(XYAnalysisCurve::DataSourceType);
0093     void curveDataSourceCurveChanged(const XYCurve*);
0094     void curveXDataColumnChanged(const AbstractColumn*);
0095     void curveYDataColumnChanged(const AbstractColumn*);
0096     void curveInterpolationDataChanged(const XYInterpolationCurve::InterpolationData&);
0097     void dataChanged();
0098 };
0099 
0100 #endif