Engauge Digitizer 2
Loading...
Searching...
No Matches
FittingWindow.h
Go to the documentation of this file.
1/******************************************************************************************************
2 * (C) 2016 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3 * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4 * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5 ******************************************************************************************************/
6
7#ifndef FITTING_WINDOW_H
8#define FITTING_WINDOW_H
9
13#include <QVector>
14#include "WindowAbstractBase.h"
15
16class CmdMediator;
17class Curve;
18class FittingModel;
19class MainWindow;
20class MainWindowModel;
21class Matrix;
22class QComboBox;
23class QItemSelection;
24class QLabel;
25class QLineEdit;
26class QString;
27class QTableView;
28class Transformation;
29
35{
37
38public:
40 FittingWindow (MainWindow *mainWindow);
41 virtual ~FittingWindow ();
42
43 virtual void clear ();
44 virtual void closeEvent(QCloseEvent *event);
45 virtual void doCopy ();
46 virtual void update (const CmdMediator &cmdMediator,
47 const MainWindowModel &modelMainWindow,
49 const Transformation &transformation);
50 virtual QTableView *view () const;
51
52private slots:
53
55 void slotCmbOrder(int index);
56
58
60 void signalCurveFit(FittingCurveCoefficients, double, double, bool, bool);
61
64
65private:
67
68 void calculateCurveFitAndStatistics ();
69 void createWidgets(MainWindow *mainWindow);
70 void initializeOrder ();
71 int maxOrder () const;
72 void refreshTable ();
73 void resizeTable (int order);
74
75 QComboBox *m_cmbOrder;
76 QLabel *m_labelY;
77 QTableView *m_view;
78 FittingModel *m_model;
79 QLineEdit *m_lblMeanSquareError;
80 QLineEdit *m_lblRootMeanSquare;
81 QLineEdit *m_lblRSquared;
82
83 QString m_curveSelected; // Save selected curve name so it can be displayed. Let user know what data this fit applies to
84 bool m_isLogXTheta;
85 bool m_isLogYRadius;
86 FittingPointsConvenient m_pointsConvenient;
87
88 // Calculated curve fit coefficients, with 0th for constant term, 1st for linear term, ...
89 QVector<double> m_coefficients;
90
91 // Export format and coordinate scale are updated after every CmdAbstractBase gets redone/undone
92 DocumentModelExportFormat m_modelExport;
93
94 double m_significantDigits;
95};
96
97#endif // FITTING_WINDOW_H
const int INNER_RADIUS_MIN
QVector< double > FittingCurveCoefficients
Coefficients x0, x1, ... in y = a0 + a1 * x + a2 * x^2 + ...
QList< QPointF > FittingPointsConvenient
Array of (x,y) points in graph coordinates.
Command queue stack.
Definition CmdMediator.h:24
Container for one set of digitized Points.
Definition Curve.h:34
Model for DlgSettingsExportFormat and CmdSettingsExportFormat.
Model for FittingWindow.
Window that displays curve fitting as applied to the currently selected curve.
virtual void clear()
Clear stale information.
virtual void doCopy()
Copy the current selection to the clipboard.
virtual void update(const CmdMediator &cmdMediator, const MainWindowModel &modelMainWindow, const QString &curveSelected, const Transformation &transformation)
Populate the table with the specified Curve.
virtual void closeEvent(QCloseEvent *event)
Catch close event so corresponding menu item in MainWindow can be updated accordingly.
void signalCurveFit(FittingCurveCoefficients, double, double, bool, bool)
Signal containing coefficients from curve fit.
virtual QTableView * view() const
QTableView-based class used by child class.
virtual ~FittingWindow()
void signalFittingWindowClosed()
Signal that this QDockWidget was just closed.
Model for DlgSettingsMainWindow.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Definition MainWindow.h:92
Matrix class that supports arbitrary NxN size.
Definition Matrix.h:21
Affine transformation between screen and graph coordinates, based on digitized axis points.
Dockable widget abstract base class.