Engauge Digitizer  2
FittingWindow.h
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 
10 #include "DocumentModelExportFormat.h"
11 #include "FittingCurveCoefficients.h"
12 #include "FittingPointsConvenient.h"
13 #include <QVector>
14 #include "WindowAbstractBase.h"
15 
16 class CmdMediator;
17 class Curve;
18 class FittingModel;
19 class MainWindow;
20 class MainWindowModel;
21 class Matrix;
22 class QComboBox;
23 class QItemSelection;
24 class QLabel;
25 class QLineEdit;
26 class QString;
27 class QTableView;
28 class Transformation;
29 
35 {
36  Q_OBJECT;
37 
38 public:
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,
48  const QString &curveSelected,
49  const Transformation &transformation);
50  virtual QTableView *view () const;
51 
52 private slots:
53 
55  void slotCmbOrder(int index);
56 
57 signals:
58 
60  void signalCurveFit(FittingCurveCoefficients, double, double, bool, bool);
61 
64 
65 private:
66  FittingWindow();
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 
95 #endif // FITTING_WINDOW_H
Model for DlgSettingsExportFormat and CmdSettingsExportFormat.
Dockable widget abstract base class.
virtual void update(const CmdMediator &cmdMediator, const MainWindowModel &modelMainWindow, const QString &curveSelected, const Transformation &transformation)
Populate the table with the specified Curve.
Model for FittingWindow.
Definition: FittingModel.h:14
Affine transformation between screen and graph coordinates, based on digitized axis points...
Model for DlgSettingsMainWindow.
void signalFittingWindowClosed()
Signal that this QDockWidget was just closed.
void signalCurveFit(FittingCurveCoefficients, double, double, bool, bool)
Signal containing coefficients from curve fit.
Matrix class that supports arbitrary NxN size.
Definition: Matrix.h:14
virtual QTableView * view() const
QTableView-based class used by child class.
Container for one set of digitized Points.
Definition: Curve.h:33
Command queue stack.
Definition: CmdMediator.h:23
Window that displays curve fitting as applied to the currently selected curve.
Definition: FittingWindow.h:34
virtual void closeEvent(QCloseEvent *event)
Catch close event so corresponding menu item in MainWindow can be updated accordingly.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Definition: MainWindow.h:89
virtual void clear()
Clear stale information.
virtual void doCopy()
Copy the current selection to the clipboard.