fixed edge display for volume cells
[engrid-github.git] / src / libengrid / guiimproveaspectratio.cpp
blobf6e7f8c0d95fd2a5133a898f2d8a76456ae23441
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 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
21 #include "guiimproveaspectratio.h"
22 #include "vtkEgEliminateShortEdges.h"
24 void GuiImproveAspectRatio::before()
26 m_Ui.lineEditAspectRatio->setText("100.0");
29 void GuiImproveAspectRatio::operate()
31 EG_VTKSP(vtkEgEliminateShortEdges, elem);
32 int N_elim = 0;
33 int N_sweeps = 0;
34 elem->SetMaxRatio(m_Ui.lineEditAspectRatio->text().toDouble());
35 elem->SetMaxLength(m_Ui.lineEditLength->text().toDouble());
36 EG_VTKSP(vtkUnstructuredGrid,ug);
37 do {
38 ug->DeepCopy(m_Grid);
39 elem->SetInputData(ug);
40 elem->Update();
41 m_Grid->DeepCopy(elem->GetOutput());
42 N_elim += elem->getNumEliminated();
43 ++N_sweeps;
44 } while (elem->getNumEliminated() > 0);
45 QString text, t1, t2;
46 t1.setNum(N_elim);
47 t2.setNum(N_sweeps);