DeleteSetOfPoints function working
[engrid.git] / guieditboundaryconditions.cpp
blob9fcc8b28f32a454c9076de993f09674b5279d909
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 "guieditboundaryconditions.h"
25 GuiEditBoundaryConditions::GuiEditBoundaryConditions()
27 bcmap = NULL;
30 void GuiEditBoundaryConditions::before()
32 if (!bcmap) EG_BUG;
33 while (ui.T->rowCount()) ui.T->removeRow(0);
34 foreach (int i, boundary_codes) {
35 BoundaryCondition bc = (*bcmap)[i];
36 ui.T->insertRow(ui.T->rowCount());
37 int r = ui.T->rowCount()-1;
38 ui.T->setItem(r,0,new QTableWidgetItem());
39 ui.T->item(r,0)->setFlags(ui.T->item(r,0)->flags() & (~Qt::ItemIsSelectable));
40 ui.T->item(r,0)->setFlags(ui.T->item(r,0)->flags() & (~Qt::ItemIsEditable));
41 ui.T->setItem(r,1,new QTableWidgetItem());
42 ui.T->setItem(r,2,new QTableWidgetItem());
43 QString idx;
44 idx.setNum(i);
45 ui.T->item(r,0)->setText(idx);
46 QString name = bc.getName();
47 if (name == "unknown") name = QString("BC") + idx;
48 ui.T->item(r,1)->setText(name);
49 ui.T->item(r,2)->setText(bc.getType());
54 void GuiEditBoundaryConditions::operate()
56 for (int i = 0; i < ui.T->rowCount(); ++i) {
57 BoundaryCondition bc(ui.T->item(i,1)->text(),ui.T->item(i,2)->text());
58 (*bcmap)[ui.T->item(i,0)->text().toInt()] = bc;