2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 // + This file is part of enGrid. +
6 // + Copyright 2008-2012 enGits GmbH +
8 // + enGrid is free software: you can redistribute it and/or modify +
9 // + it under the terms of the GNU General Public License as published by +
10 // + the Free Software Foundation, either version 3 of the License, or +
11 // + (at your option) any later version. +
13 // + enGrid is distributed in the hope that it will be useful, +
14 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
15 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
16 // + GNU General Public License for more details. +
18 // + You should have received a copy of the GNU General Public License +
19 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
21 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
24 #include "guiedgelengthsourcebox.h"
26 GuiEdgeLengthSourceBox::GuiEdgeLengthSourceBox()
33 QString
GuiEdgeLengthSourceBox::write()
35 QString txt
= "box: " + name() + "; ";
37 num
.setNum(m_X1
[0]); txt
+= num
+ "; ";
38 num
.setNum(m_X1
[1]); txt
+= num
+ "; ";
39 num
.setNum(m_X1
[2]); txt
+= num
+ "; ";
40 num
.setNum(m_X2
[0]); txt
+= num
+ "; ";
41 num
.setNum(m_X2
[1]); txt
+= num
+ "; ";
42 num
.setNum(m_X2
[2]); txt
+= num
+ "; ";
43 num
.setNum(m_Length
); txt
+= num
+ "; ";
47 bool GuiEdgeLengthSourceBox::read(QString txt
)
49 QStringList parts
= txt
.split(":");
50 if (parts
.size() != 2) {
53 if (parts
[0].trimmed() == "box") {
54 QStringList words
= parts
[1].split(";");
55 if (words
.size() < 8) {
58 m_Name
= words
[0].trimmed();
59 m_X1
= vec3_t(words
[1].toDouble(), words
[2].toDouble(), words
[3].toDouble());
60 m_X2
= vec3_t(words
[4].toDouble(), words
[5].toDouble(), words
[6].toDouble());
61 m_Length
= words
[7].toDouble();
68 void GuiEdgeLengthSourceBox::setDlgFields()
70 ui().lineEditName
->setText(name());
72 num
.setNum(m_X1
[0]); ui().lineEditX1
->setText(num
);
73 num
.setNum(m_X1
[1]); ui().lineEditY1
->setText(num
);
74 num
.setNum(m_X1
[2]); ui().lineEditZ1
->setText(num
);
75 num
.setNum(m_X2
[0]); ui().lineEditX2
->setText(num
);
76 num
.setNum(m_X2
[1]); ui().lineEditY2
->setText(num
);
77 num
.setNum(m_X2
[2]); ui().lineEditZ2
->setText(num
);
78 num
.setNum(m_Length
); ui().lineEditEL
->setText(num
);
81 void GuiEdgeLengthSourceBox::readDlgFields()
83 setName(ui().lineEditName
->text());
84 m_X1
[0] = ui().lineEditX1
->text().toDouble();
85 m_X1
[1] = ui().lineEditY1
->text().toDouble();
86 m_X1
[2] = ui().lineEditZ1
->text().toDouble();
87 m_X2
[0] = ui().lineEditX2
->text().toDouble();
88 m_X2
[1] = ui().lineEditY2
->text().toDouble();
89 m_X2
[2] = ui().lineEditZ2
->text().toDouble();
90 m_Length
= ui().lineEditEL
->text().toDouble();
93 double GuiEdgeLengthSourceBox::edgeLength(vec3_t x
)
96 for (int i
= 0; i
< 3; ++i
) {
97 if (x
[i
] < m_X1
[i
] || x
[i
] > m_X2
[i
]) {