fixed edge display for volume cells
[engrid-github.git] / src / libengrid / guifillplane.cpp
blob331e69a59e6fd61626d177fc04186fd4be6a2fbe
1 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 // + +
3 // + This file is part of enGrid. +
4 // + +
5 // + Copyright 2008-2014 enGits GmbH +
6 // + +
7 // + enGrid is free software: you can redistribute it and/or modify +
8 // + it under the terms of the GNU General Public License as published by +
9 // + the Free Software Foundation, either version 3 of the License, or +
10 // + (at your option) any later version. +
11 // + +
12 // + enGrid is distributed in the hope that it will be useful, +
13 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
14 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
15 // + GNU General Public License for more details. +
16 // + +
17 // + You should have received a copy of the GNU General Public License +
18 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
19 // + +
20 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
22 #include "guifillplane.h"
23 #include "fillplane.h"
24 #include "boundarycondition.h"
25 #include "guimainwindow.h"
27 void GuiFillPlane::fillPlane(vec3_t x, vec3_t n, bool inverse, QString name)
29 double tol = m_Ui.m_LineEditDistTol->text().toDouble();
30 n.normalise();
31 FillPlane fill;
32 fill.setOrigin(x);
33 fill.setNormal(n);
34 fill.setDistanceTolerance(m_Ui.m_LineEditDistTol->text().toDouble());
35 fill.setAngularTolerance(GeometryTools::deg2rad(m_Ui.m_LineEditAngTol->text().toDouble()));
36 if (inverse) {
37 fill.setInverseDirectionOn();
38 } else {
39 fill.setInverseDirectionOff();
41 fill();
42 BoundaryCondition bc(name, "patch");
43 GuiMainWindow::pointer()->addBC(fill.getBC(), bc);
44 GuiMainWindow::pointer()->updateBoundaryCodes(true);
47 void GuiFillPlane::operate()
49 if (m_Ui.m_CheckBoxCustom->isChecked()) {
50 vec3_t x, n;
51 x[0] = m_Ui.m_LineEditX->text().toDouble();
52 x[1] = m_Ui.m_LineEditY->text().toDouble();
53 x[2] = m_Ui.m_LineEditZ->text().toDouble();
54 n[0] = m_Ui.m_LineEditNx->text().toDouble();
55 n[1] = m_Ui.m_LineEditNy->text().toDouble();
56 n[2] = m_Ui.m_LineEditNz->text().toDouble();
57 fillPlane(x, n, false, "filled_plane");
59 if (m_Ui.m_CheckBoxXY->isChecked()) {
60 vec3_t x(0, 0, 0);
61 vec3_t n(0, 0, 1);
62 fillPlane(x, n, m_Ui.m_CheckBoxXYInv->isChecked(), "XY_plane");
64 if (m_Ui.m_CheckBoxYZ->isChecked()) {
65 vec3_t x(0, 0, 0);
66 vec3_t n(1, 0, 0);
67 fillPlane(x, n, m_Ui.m_CheckBoxYZInv->isChecked(), "YZ_plane");
69 if (m_Ui.m_CheckBoxZX->isChecked()) {
70 vec3_t x(0, 0, 0);
71 vec3_t n(0, 1, 0);
72 fillPlane(x, n, m_Ui.m_CheckBoxZXInv->isChecked(), "ZX_plane");