src/CalibrateiSpindel.h

Mon, 16 Oct 2023 11:39:20 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Mon, 16 Oct 2023 11:39:20 +0200
changeset 511
c6fa5be47634
parent 510
080524ab2fe8
permissions
-rw-r--r--

Added error checks on calibration data

503
61c114afb0ee Basic setup for iSpindel calibration.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 #ifndef _CALIBRATEISPINDEL_H
61c114afb0ee Basic setup for iSpindel calibration.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 #define _CALIBRATEISPINDEL_H
61c114afb0ee Basic setup for iSpindel calibration.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3
506
ea07f6c97a69 Added Simple polynomial fitting functions written by Henry M. Forson. Added a graph that displays the old and new iSpindel calibration curve. Implemented delete row from the data.
Michiel Broek <mbroek@mbse.eu>
parents: 505
diff changeset
4 #include "MainWindow.h"
ea07f6c97a69 Added Simple polynomial fitting functions written by Henry M. Forson. Added a graph that displays the old and new iSpindel calibration curve. Implemented delete row from the data.
Michiel Broek <mbroek@mbse.eu>
parents: 505
diff changeset
5
505
7ae4d022cf8f Load and show current calibration data.
Michiel Broek <mbroek@mbse.eu>
parents: 503
diff changeset
6
7ae4d022cf8f Load and show current calibration data.
Michiel Broek <mbroek@mbse.eu>
parents: 503
diff changeset
7 struct Calibrate {
7ae4d022cf8f Load and show current calibration data.
Michiel Broek <mbroek@mbse.eu>
parents: 503
diff changeset
8 double sg;
7ae4d022cf8f Load and show current calibration data.
Michiel Broek <mbroek@mbse.eu>
parents: 503
diff changeset
9 double plato;
7ae4d022cf8f Load and show current calibration data.
Michiel Broek <mbroek@mbse.eu>
parents: 503
diff changeset
10 double angle;
7ae4d022cf8f Load and show current calibration data.
Michiel Broek <mbroek@mbse.eu>
parents: 503
diff changeset
11 };
503
61c114afb0ee Basic setup for iSpindel calibration.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12
61c114afb0ee Basic setup for iSpindel calibration.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13
61c114afb0ee Basic setup for iSpindel calibration.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 namespace Ui {
61c114afb0ee Basic setup for iSpindel calibration.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 class CalibrateiSpindel;
61c114afb0ee Basic setup for iSpindel calibration.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 }
61c114afb0ee Basic setup for iSpindel calibration.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17
61c114afb0ee Basic setup for iSpindel calibration.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 class CalibrateiSpindel : public QDialog
61c114afb0ee Basic setup for iSpindel calibration.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 {
61c114afb0ee Basic setup for iSpindel calibration.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 Q_OBJECT
61c114afb0ee Basic setup for iSpindel calibration.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21
505
7ae4d022cf8f Load and show current calibration data.
Michiel Broek <mbroek@mbse.eu>
parents: 503
diff changeset
22 signals:
7ae4d022cf8f Load and show current calibration data.
Michiel Broek <mbroek@mbse.eu>
parents: 503
diff changeset
23 void entry_changed();
7ae4d022cf8f Load and show current calibration data.
Michiel Broek <mbroek@mbse.eu>
parents: 503
diff changeset
24
503
61c114afb0ee Basic setup for iSpindel calibration.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25 public:
61c114afb0ee Basic setup for iSpindel calibration.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26 explicit CalibrateiSpindel(int id, QWidget *parent = 0);
61c114afb0ee Basic setup for iSpindel calibration.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27 ~CalibrateiSpindel();
61c114afb0ee Basic setup for iSpindel calibration.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28
61c114afb0ee Basic setup for iSpindel calibration.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
29 private slots:
61c114afb0ee Basic setup for iSpindel calibration.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
30 void on_quitButton_clicked();
61c114afb0ee Basic setup for iSpindel calibration.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31 void refreshTable(void);
505
7ae4d022cf8f Load and show current calibration data.
Michiel Broek <mbroek@mbse.eu>
parents: 503
diff changeset
32 void on_addButton_clicked();
7ae4d022cf8f Load and show current calibration data.
Michiel Broek <mbroek@mbse.eu>
parents: 503
diff changeset
33 void on_deleteRow_clicked();
7ae4d022cf8f Load and show current calibration data.
Michiel Broek <mbroek@mbse.eu>
parents: 503
diff changeset
34 void cell_Changed(int nRow, int nCol);
503
61c114afb0ee Basic setup for iSpindel calibration.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35
61c114afb0ee Basic setup for iSpindel calibration.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
36 private:
61c114afb0ee Basic setup for iSpindel calibration.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
37 Ui::CalibrateiSpindel *ui;
61c114afb0ee Basic setup for iSpindel calibration.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38 QString _node, _alias, _data_old, _data_new;
506
ea07f6c97a69 Added Simple polynomial fitting functions written by Henry M. Forson. Added a graph that displays the old and new iSpindel calibration curve. Implemented delete row from the data.
Michiel Broek <mbroek@mbse.eu>
parents: 505
diff changeset
39 QChartView *chartView;
ea07f6c97a69 Added Simple polynomial fitting functions written by Henry M. Forson. Added a graph that displays the old and new iSpindel calibration curve. Implemented delete row from the data.
Michiel Broek <mbroek@mbse.eu>
parents: 505
diff changeset
40 QChart *chart;
ea07f6c97a69 Added Simple polynomial fitting functions written by Henry M. Forson. Added a graph that displays the old and new iSpindel calibration curve. Implemented delete row from the data.
Michiel Broek <mbroek@mbse.eu>
parents: 505
diff changeset
41 QLineSeries *new_plot, *old_plot;
ea07f6c97a69 Added Simple polynomial fitting functions written by Henry M. Forson. Added a graph that displays the old and new iSpindel calibration curve. Implemented delete row from the data.
Michiel Broek <mbroek@mbse.eu>
parents: 505
diff changeset
42 int recno, oldtotal, newtotal;
505
7ae4d022cf8f Load and show current calibration data.
Michiel Broek <mbroek@mbse.eu>
parents: 503
diff changeset
43 QJsonDocument data;
7ae4d022cf8f Load and show current calibration data.
Michiel Broek <mbroek@mbse.eu>
parents: 503
diff changeset
44 bool ignoreChanges = false;
7ae4d022cf8f Load and show current calibration data.
Michiel Broek <mbroek@mbse.eu>
parents: 503
diff changeset
45 bool textIsChanged = false;
511
c6fa5be47634 Added error checks on calibration data
Michiel Broek <mbroek@mbse.eu>
parents: 510
diff changeset
46 bool dataHasErrors = false;
505
7ae4d022cf8f Load and show current calibration data.
Michiel Broek <mbroek@mbse.eu>
parents: 503
diff changeset
47 double Old[4], New[4];
510
080524ab2fe8 Changed xCal array to a QList. Added sort on angle. Added save data. Added quit/save dialog.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
48 QList<Calibrate> oCal;
080524ab2fe8 Changed xCal array to a QList. Added sort on angle. Added save data. Added quit/save dialog.
Michiel Broek <mbroek@mbse.eu>
parents: 506
diff changeset
49 QList<Calibrate> nCal;
505
7ae4d022cf8f Load and show current calibration data.
Michiel Broek <mbroek@mbse.eu>
parents: 503
diff changeset
50
7ae4d022cf8f Load and show current calibration data.
Michiel Broek <mbroek@mbse.eu>
parents: 503
diff changeset
51 void WindowTitle();
511
c6fa5be47634 Added error checks on calibration data
Michiel Broek <mbroek@mbse.eu>
parents: 510
diff changeset
52 void SaveData();
503
61c114afb0ee Basic setup for iSpindel calibration.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
53 };
61c114afb0ee Basic setup for iSpindel calibration.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
54
61c114afb0ee Basic setup for iSpindel calibration.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
55 #endif

mercurial