-
Notifications
You must be signed in to change notification settings - Fork 0
/
LevelOneDecWidget.h
260 lines (204 loc) · 7.25 KB
/
LevelOneDecWidget.h
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
#ifndef LEVELDECONE_H
#define LEVELDECONE_H
#include "LevelOneChart.h"
#include "LevelOneMuChart.h"
#include "Generators.h"
#include <qwt_counter.h>
#include <QWidget>
#include <QAbstractTableModel>
#include <QTableView>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QDoubleSpinBox>
#include <QToolBar>
#include <QLabel>
/* For Splitter */
// #include <QSplitter>
class TableLevelOneModel;
class TableStabilityLevelOneModel;
struct structHTMLReportLevelOne
{
QString header;
QString tableOne;
QString tableTwo;
QString footer;
QString tdOpen;
QString tdClose;
QString trOpen;
QString trClose;
};
class LevelOneDec : public QWidget
{
Q_OBJECT
size_t row;
size_t col;
bool qSwitch;
QString str_date;
QString str_mu;
QString str_alpha;
QString str_forecast;
QString lower_limit;
QString upper_limit;
QString lower_limit_short;
QString upper_limit_short;
QString result_str;
QString stable_str;
QString unstable_str;
QVector<QString> vectorDateToLevelOne;
QVector<QVector<double> > vectorSensorReadings2DToLevelOne;
double avrg_mu;
double avrg_alpha;
/********** FIRST TABLE **********/
QVector<double> muVector;
QVector<QString> alphaVector;
QVector<double> muVectorForecast;
QVector<QString> alphaVectorForecast;
/********** END FIRST TABLE **********/
/********** SECOND TABLE **********/
QVector<QVector<double> > vector2DSensorReadingsLow;
QVector<QVector<double> > vector2DSensorReadingsHigh;
QVector<double> muLowerLimitVector;
QVector<double> muUpperLimitVector;
/********** END SECOND TABLE **********/
QDoubleSpinBox *spbDoubleBoxAlpha;
// QDoubleSpinBox *spbDoubleBoxEps;
QwtCounter *spbDoubleBoxEps;
QLabel *labelCoeffAlpha;
QLabel *labelCoeffEps;
QLabel *labelMeterEps;
QLabel *labelWarning;
QHBoxLayout *horizToolBarLayout;
QHBoxLayout *horizLayoutTableLevelOne;
// QSplitter *levelOneSplitter;
QAction *exportLevelOneChart;
QAction *printLevelOneChart;
QAction *exportReportLevelOne;
QAction *switchWidgetsLevelOne;
QAction *showHelpInBrowserAction;
QToolBar *toolBar;
QWidget *toolBarBox;
QVBoxLayout *vertLayoutLevelOne;
TableLevelOneModel *tableLevelOneModel;
TableStabilityLevelOneModel *tableStabilityLevelOneModel;
QTableView *viewTableLevelOneModel;
LevelOneChart *levelOneChart;
LevelOneMuChart * levelOneMuChart;
/********** FIRST TABLE **********/
double getMu(int i);
double getAvrgMu();
QString getAlphaString(int i);
double getAvrgAlpha();
void getMuForecast(size_t i, double a);
double getAvrgMuForecast();
void getAlphaForecast(size_t i, double a);
double getAvrgAlphaForecast();
double ArcCos(double x);
/********** END FIRST TABLE **********/
/********** SECOND TABLE **********/
void createVector2DSensReadingsLow(double eps);
void createVector2DSensReadingsHigh(double eps);
double getMuLowerLimit(size_t i);
double getMuHighLimit(size_t i);
/********** END SECOND TABLE **********/
void retranslateUi();
void createTables();
void setVectorsToTables();
void createDoubleBoxes();
void createCharts();
void createToolBar();
void createWidgets();
void checkStability();
private slots:
void changedAlpha(double i);
void changedEps(double eps);
void setDoubleCountToLabel(double eps);
void chooseExportCharts();
void choosePrintCharts();
void hideLevelOneWidgets();
void exportReportToHTML();
void showHelp();
public:
LevelOneDec(const QVector<QString> &vectorDate,
const QVector<QVector<double> > &vectorSensorReadings2D,
QWidget *parent = 0);
~LevelOneDec();
};
class TableLevelOneModel : public QAbstractTableModel
{
int row_count;
QString str_date_table;
QString str_mu_table;
QString str_alpha_table;
QString str_forecast_table;
QColor lightYellow;
QVector<QString> tableVectorDateOfLevel;
QVector<double> muVectorOfLevel;
QVector<double> muForecastVectorOfLevel;
QVector<QString> alphaVectorOfLevel;
QVector<QString> alphaForecastVectorOfLevel;
QVector<QVector<double> > sensorReadingsOfReceived2DVector;
Generators *generator;
protected:
int rowCount(const QModelIndex &) const;
int columnCount(const QModelIndex &) const;
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section,
Qt::Orientation orientation,
int role) const;
public:
TableLevelOneModel(const QString &str_date,
const QString &str_mu,
const QString &str_alpha,
const QString &str_forecast,
QObject *parent = 0);
void setCurrencyVectors(const QVector<QString> &tableVectorDate,
const QVector<double> &muVector,
const QVector<double> &muForecastVector,
const QVector<QString> &alphaVector,
const QVector<QString> &alphaForecastVector);
~TableLevelOneModel();
};
class TableStabilityLevelOneModel : public QAbstractTableModel
{
size_t row_count;
QString str_date_table;
QString str_lower_limit;
QString str_upper_limit;
QString str_lower_limit_short;
QString str_upper_limit_short;
QString str_mu_table;
QString str_result;
QString str_stable;
QString str_unstable;
QColor lightYellow;
QVector<QString> tableVectorDateOfLevel;
QVector<double> muLowerLimitVectorOfLevel;
QVector<double> muVectorOfLevel;
QVector<double> muUpperLimitVectorOfLevel;
bool checkResult(int i) const;
protected:
int rowCount(const QModelIndex &) const;
int columnCount(const QModelIndex &) const;
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section,
Qt::Orientation orientation,
int role) const;
public:
TableStabilityLevelOneModel(const QString &str_date,
const QString &str_mu,
const QString &lower_limit,
const QString &upper_limit,
const QString &lower_limit_short,
const QString &upper_limit_short,
const QString &result_str,
const QString &stable_str,
const QString &unstable_str,
QObject *parent = 0);
void setCurrencyVectors(const QVector<QString> &tableVectorDate,
const QVector<double> &muLowerLimitVector,
const QVector<double> &muVector,
const QVector<double> &muUpperLimitVector);
bool checkSystemStable() const;
~TableStabilityLevelOneModel();
};
#endif // LEVELDECONE_H