simplified UpdateNodeType
[engrid.git] / guiselectboundarycodes.cpp
blob051324865db79f70dacd20af163a2e59c7ee5369
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 "guiselectboundarycodes.h"
24 #include <vtkIntArray.h>
25 #include <vtkCellData.h>
27 GuiSelectBoundaryCodes::GuiSelectBoundaryCodes()
29 disableAutoSet();
32 void GuiSelectBoundaryCodes::setDisplayBoundaryCodes(const QSet<int> &bcs)
34 display_boundary_codes.clear();
35 int bc;
36 foreach(bc, bcs) {
37 display_boundary_codes.insert(bc);
41 void GuiSelectBoundaryCodes::before()
43 for (QSet<int>::iterator i = boundary_codes.begin(); i != boundary_codes.end(); ++i) {
44 bool checked = display_boundary_codes.contains(*i);
45 addListItem(ui.listWidget,*i,checked);
47 connect(ui.pushButtonSelect, SIGNAL(clicked()), this, SLOT(selectAll()));
48 connect(ui.pushButtonDeselect, SIGNAL(clicked()), this, SLOT(deselectAll()));
51 void GuiSelectBoundaryCodes::operate()
53 display_boundary_codes.clear();
54 for (QSet<int>::iterator i = boundary_codes.begin(); i != boundary_codes.end(); ++i) {
55 if (checkListItem(ui.listWidget,*i)) {
56 display_boundary_codes.insert(*i);
61 void GuiSelectBoundaryCodes::selectAll()
63 for (int i = 0; i < ui.listWidget->count(); ++i) {
64 ui.listWidget->item(i)->setCheckState(Qt::Checked);
68 void GuiSelectBoundaryCodes::deselectAll()
70 for (int i = 0; i < ui.listWidget->count(); ++i) {
71 ui.listWidget->item(i)->setCheckState(Qt::Unchecked);
75 void GuiSelectBoundaryCodes::getSelectedBoundaryCodes(QSet<int> &bcs)
77 bcs.clear();
78 foreach(int bc, display_boundary_codes) {
79 bcs.insert(bc);