Repository navigation
Expand file tree
/
Copy pathAeroDocument.cpp
More file actions
123 lines (95 loc) · 3.6 KB
/
Copy pathAeroDocument.cpp
File metadata and controls
123 lines (95 loc) · 3.6 KB
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
//Aero
#include "AeroDocument.h"
#include "AeroWindow.h"
#include "wingClass.h"
//OCCT
#include <AIS_Shape.hxx>
#include <BRepPrimAPI_MakeSphere.hxx>
#include <BRepPrimAPI_MakeBox.hxx>
//QT
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QGridLayout>
#include <QMessageBox>
#include <QDoubleSpinBox>
#include <QVector>
#include <QLineEdit>
#include <QApplication>
#include <QProcess>
#include <qvector.h>
#include <qwidget.h>
AeroDocument::AeroDocument(QWidget* parent) : QWidget(parent)
{
setupUi();
}
void AeroDocument::setupUi()
{
spinBoxChordLength = new QDoubleSpinBox(this);
spinBoxChordLength->setSuffix(" mm");
spinBoxChordLength->setValue(1.00);
spinBoxSpanLength = new QDoubleSpinBox(this);
spinBoxSpanLength->setSuffix(" mm");
spinBoxSpanLength->setValue(2.00);
labelChordLength = new QLabel(this);
labelSpanLength = new QLabel(this);
labelFormat = new QLabel(this);
labelFilename = new QLabel(this);
labelChordLength->setText("Chord Length");
labelSpanLength ->setText("Span Length");
labelFormat ->setText("Format");
labelFilename ->setText("Filename");
pushButtonBuild = new QPushButton("Build", this);
pushButtonExport = new QPushButton("Export", this);
comboBoxFormat = new QComboBox(this);
comboBoxFormat->addItem(".step");
comboBoxFormat->addItem(".iges");
comboBoxFormat->addItem(".brep");
comboBoxFormat->setItemText(0, ".step");
comboBoxFormat->setItemText(1, ".iges");
comboBoxFormat->setItemText(2, ".brep");
comboBoxFormat->setCurrentIndex(0);
textEditCoord = new QTextEdit(this);
textEditCoord->setPlaceholderText("Paste Coordinates here. \nFirst line will be skipped.");
lineEditFileName = new QLineEdit(this);
lineEditFileName->setPlaceholderText("Type filename here");
// Set up layout
QVBoxLayout* layout = new QVBoxLayout;
layout->addWidget(textEditCoord);
QHBoxLayout* hLayoutExportChord = new QHBoxLayout;
hLayoutExportChord->addWidget(labelChordLength);
hLayoutExportChord->addWidget(spinBoxChordLength);
layout->addLayout(hLayoutExportChord);
QHBoxLayout* hLayoutExportSpan = new QHBoxLayout;
hLayoutExportSpan->addWidget(labelSpanLength);
hLayoutExportSpan->addWidget(spinBoxSpanLength);
layout->addLayout(hLayoutExportSpan);
layout->addWidget(pushButtonBuild);
QHBoxLayout* hLayoutExportLabels = new QHBoxLayout;
hLayoutExportLabels->addWidget(labelFilename,3);
hLayoutExportLabels->addWidget(labelFormat);
layout->addLayout(hLayoutExportLabels);
QHBoxLayout* hLayoutExportTabs = new QHBoxLayout;
hLayoutExportTabs->addWidget(lineEditFileName);
hLayoutExportTabs->addWidget(comboBoxFormat);
layout->addLayout(hLayoutExportTabs);
layout->addWidget(pushButtonExport);
setLayout(layout);
// Connect buttons to slots
connect(pushButtonBuild, &QPushButton::clicked, this, &AeroDocument::onBuildButtonSlot);
connect(pushButtonExport, &QPushButton::clicked, this, &AeroDocument::onExportButtonSlot);
}
// creates a wingClass object and display it on the QOpenGlWidget
// chord length, span length, save file name will be taken from the UI
void AeroDocument::onBuildButtonSlot()
{
double chord = spinBoxChordLength->value();
double span = spinBoxSpanLength->value();
QString textCoords = textEditCoord->toPlainText();
emit requestBuild(chord, span, textCoords);
}
void AeroDocument::onExportButtonSlot()
{
int index = comboBoxFormat->currentIndex();
QString filename = lineEditFileName->text();
emit requestExport(index, filename);
}