compiles again
[engrid.git] / src / guisetboundarycode.cpp
blob1c1a4b27f280b0f6fb2c97d4db33e2fb3ea52f40
1 //
2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 // + +
4 // + This file is part of enGrid. +
5 // + +
6 // + Copyright 2008,2009 Oliver Gloth +
7 // + +
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. +
12 // + +
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. +
17 // + +
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/>. +
20 // + +
21 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
23 #include "guisetboundarycode.h"
24 #include "setboundarycode.h"
25 #include "guimainwindow.h"
27 ///@@@ TODO: Add automatic BC generation using feature edges
28 void GuiSetBoundaryCode::before()
30 //prepare radiobuttons
31 m_ButtonGroup = new QButtonGroup(this);
32 m_RadioButtonProcessOnlyVisible = new QRadioButton("Process only visible cells",this);
33 m_RadioButtonProcessAll = new QRadioButton("Process all cells (even invisible ones)",this);
34 m_RadioButtonSelectAllVisible = new QRadioButton("Select all visible cells",this);
35 m_RadioButtonOnlyPickedCell = new QRadioButton("Only picked cell",this);
36 m_RadioButtonOnlyPickedCellAndNeighbours = new QRadioButton("Only picked cell and neighbours",this);
37 m_ButtonGroup->addButton(m_RadioButtonProcessOnlyVisible,0);
38 m_ButtonGroup->addButton(m_RadioButtonProcessAll,1);
39 m_ButtonGroup->addButton(m_RadioButtonSelectAllVisible,2);
40 m_ButtonGroup->addButton(m_RadioButtonOnlyPickedCell,3);
41 m_ButtonGroup->addButton(m_RadioButtonOnlyPickedCellAndNeighbours,4);
42 ui.verticalLayout_PickMethod->addWidget(m_RadioButtonProcessOnlyVisible);
43 ui.verticalLayout_PickMethod->addWidget(m_RadioButtonProcessAll);
44 ui.verticalLayout_PickMethod->addWidget(m_RadioButtonSelectAllVisible);
45 ui.verticalLayout_PickMethod->addWidget(m_RadioButtonOnlyPickedCell);
46 ui.verticalLayout_PickMethod->addWidget(m_RadioButtonOnlyPickedCellAndNeighbours);
48 //read settings
49 QSettings local_qset("enGits","enGrid_GuisetBoundaryCode");
50 ui.doubleSpinBoxFeatureAngle->setValue(local_qset.value("FeatureAngle", 45).toDouble());
51 ui.spinBoxBoundaryCode->setValue(local_qset.value("BoundaryCode", 1).toInt());
52 m_ButtonGroup->button(local_qset.value("PickMethod",0).toInt())->setChecked(true);
55 void GuiSetBoundaryCode::operate()
57 m_ButtonGroup->checkedId();
58 cout<<"buttongroup->checkedId()="<<m_ButtonGroup->checkedId()<<endl;
60 //save settings
61 QSettings local_qset("enGits","enGrid_GuisetBoundaryCode");
62 local_qset.setValue("FeatureAngle", ui.doubleSpinBoxFeatureAngle->value());
63 local_qset.setValue("BoundaryCode", ui.spinBoxBoundaryCode->value());
64 local_qset.setValue("PickMethod", m_ButtonGroup->checkedId());
66 SetBoundaryCode set_bc;
67 set_bc.setGrid(grid);
68 set_bc.setAllSurfaceCells();
69 if (mainWindow()->getPickedCell() >= 0) {
70 set_bc.setFeatureAngle(ui.doubleSpinBoxFeatureAngle->value());
71 set_bc.setBC(ui.spinBoxBoundaryCode->value());
73 set_bc.setProcessAll(m_ButtonGroup->button(1)->isChecked());
74 set_bc.setSelectAllVisible(m_ButtonGroup->button(2)->isChecked());
75 set_bc.setOnlyPickedCell(m_ButtonGroup->button(3)->isChecked());
76 set_bc.setOnlyPickedCellAndNeighbours(m_ButtonGroup->button(4)->isChecked());
78 cout << "GuiMainWindow::getPickedCell()=" << mainWindow()->getPickedCell() << endl;
79 set_bc.setStart(mainWindow()->getPickedCell());
80 set_bc();