-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTransition.hpp
160 lines (100 loc) · 3.9 KB
/
Transition.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#ifndef TRANSITIONT_HPP
#define TRANSITIONT_HPP
#include <QtGlobal>
#include <QString>
#include <QList>
#include <QObject>
namespace QtCharts { class QAbstractSeries; }
class Transition:
public QObject
{
Q_OBJECT
public:
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
Q_PROPERTY(qreal temperatureBegin READ temperatureBegin WRITE setTemperatureBegin NOTIFY temperatureBeginChanged)
Q_PROPERTY(qreal temperatureEnd READ temperatureEnd WRITE setTemperatureEnd NOTIFY temperatureEndChanged)
Q_PROPERTY(qreal enthalpy READ enthalpy WRITE setEnthalpy NOTIFY enthalpyChanged)
Q_PROPERTY(QString functionExpr READ functionExpr WRITE setFunctionExpr NOTIFY functionExprChanged)
Q_PROPERTY(int samples READ samples WRITE setSamples NOTIFY samplesChanged)
Q_PROPERTY(bool bAlign READ bAlign WRITE setBAlign NOTIFY bAlignChanged)
Q_PROPERTY(bool subtractBeginTemperature READ subtractBeginTemperature WRITE setSubtractBeginTemperature NOTIFY subtractBeginTemperatureChanged)
Q_PROPERTY(bool subtractEndTemperature READ subtractEndTemperature WRITE setSubtractEndTemperature NOTIFY subtractEndTemperatureChanged)
Q_PROPERTY(qreal subtractCustomTemperature READ subtractCustomTemperature WRITE setSubtractCustomTemperature NOTIFY subtractCustomTemperatureChanged)
Q_PROPERTY(qreal a READ a WRITE setA NOTIFY aChanged)
Q_PROPERTY(qreal b READ b WRITE setB NOTIFY bChanged)
Q_PROPERTY(QList<qreal> * t READ t NOTIFY cpTChanged)
Q_PROPERTY(QList<qreal> * cp READ cp NOTIFY cpTChanged)
explicit Transition(QObject * parent = 0);
~Transition() override;
QString name() const;
void setName(const QString & name);
qreal temperatureBegin() const;
void setTemperatureBegin(qreal temperature);
qreal temperatureEnd() const;
void setTemperatureEnd(qreal temperature);
qreal enthalpy() const;
void setEnthalpy(qreal enthalpy);
QString functionExpr() const;
void setFunctionExpr(const QString & functionExpr);
int samples() const;
void setSamples(int samples);
bool bAlign() const;
bool subtractBeginTemperature() const;
void setSubtractBeginTemperature(bool flag);
bool subtractEndTemperature() const;
void setSubtractEndTemperature(bool flag);
qreal subtractCustomTemperature() const;
void setSubtractCustomTemperature(qreal temperature);
void setBAlign(bool bAlign);
qreal a() const;
void setA(qreal a);
qreal b() const;
void setB(qreal b);
QList<qreal> * x();
QList<qreal> * y();
QList<qreal> * t();
QList<qreal> * cp();
Q_INVOKABLE Transition * clone() const; // QObject does not allow direct copying.
Q_INVOKABLE void copy(Transition * other); // QObject does not allow direct copying. Non-const pointer for QML.
// Q_INVOKABLE void copy(const Transition & other); // QObject does not allow direct copying.
Q_INVOKABLE bool isExprValid(const QString & expr) const;
Q_INVOKABLE void updateSeries(QtCharts::QAbstractSeries * series);
Q_INVOKABLE void update();
public slots:
void deleteLater();
signals:
void nameChanged();
void temperatureBeginChanged();
void temperatureEndChanged();
void enthalpyChanged();
void functionExprChanged();
void samplesChanged();
void bAlignChanged();
void subtractBeginTemperatureChanged();
void subtractEndTemperatureChanged();
void subtractCustomTemperatureChanged();
void aChanged();
void bChanged();
void cpTChanged();
private:
void connectUpdateSignals();
void disconnectUpdateSignals();
qreal calculateA(const QList<qreal> & x, const QList<qreal> & y) const;
qreal getSubtractedTemperature(qreal t) const;
private:
QString m_name;
qreal m_temperatureBegin;
qreal m_temperatureEnd;
qreal m_enthalpy;
QString m_functionExpr;
int m_samples;
bool m_bAlign;
bool m_subtractBeingTemperature;
bool m_subtractEndTemperature;
qreal m_subtractCustomTemperature;
qreal m_a;
qreal m_b;
QList<qreal> m_t;
QList<qreal> m_cp;
};
#endif