-
Notifications
You must be signed in to change notification settings - Fork 20
/
main.cpp
56 lines (50 loc) · 1.76 KB
/
main.cpp
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
#include "OMSensDialog.h"
#include "omedit_plugin/model.h"
#include <QApplication>
#include <QTemporaryDir>
// Model example to be used when OMSens is used as standalone
// (main function below example)
Model modelExample()
{
// Define model data
const QList<QString> inputVariables;
const QList<QString> parameters( QList<QString>()
<< "realParam1"
<< "realParam2"
<< "realParam3");
const QList<QString> outputVariables( QList<QString>()
<< "outvar1"
<< "outvar2"
<< "outvar3");
const QList<QString> auxVariables;
// Model name
QString modelName = "ModelWithVariousParams";
// Model path in Qt resources
QString fileResourcePath = ":/OMSens/ModelWithVariousParams.mo";
// Model file name to be used when written to disk
QString tempModelName = "ModelWithVariousParams.mo";
// Temp dir where to write Model
QTemporaryDir tempDir;
// Disable auto remove so the user can check the model
tempDir.setAutoRemove(false);
QString filePath= QDir::cleanPath(tempDir.path() + QDir::separator() + tempModelName);
if (tempDir.isValid()) {
QFile::copy(fileResourcePath, filePath);
}
// Initialize model
Model model(inputVariables, outputVariables, auxVariables, parameters, filePath, modelName);
return model;
}
int main(int argc, char *argv[])
{
// Initialize Qt Application
QApplication a(argc, argv);
// Model information for testing:
Model model = modelExample();
// Initialize OMSens Dialog
OMSensDialog dialog(model);
// Show OMSens Dialog
dialog.show();
// Run and end Qt Application
return a.exec();
}