2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 // + This file is part of enGrid. +
6 // + Copyright 2008-2012 enGits GmbH +
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. +
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. +
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/>. +
21 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
23 #include "guibrlcadimportdialogue.h"
24 #include "ui_guibrlcadimportdialogue.h"
29 GuiBrlCadImportDialogue::GuiBrlCadImportDialogue(QWidget
*parent
) :
31 ui(new Ui::GuiBrlCadImportDialogue
)
36 GuiBrlCadImportDialogue::~GuiBrlCadImportDialogue()
41 void GuiBrlCadImportDialogue::prepare(QString file_name
)
43 QString program
= "/usr/brlcad/bin/mged";
44 QStringList arguments
;
46 arguments
<< "-c" << file_name
<< "ls";
47 proc
.start(program
, arguments
);
48 proc
.waitForFinished();
49 QString output
= proc
.readAllStandardOutput() + proc
.readAllStandardError();
50 QStringList objects
= output
.split(QRegExp("\\s+"));
51 ui
->listWidget
->clear();
52 foreach (QString obj
, objects
) {
53 ui
->listWidget
->addItem(obj
);
55 m_StlFileName
= file_name
+ ".stl";
56 if (QFileInfo(m_StlFileName
).exists()) {
57 ui
->checkBoxSTL
->setEnabled(true);
58 ui
->checkBoxSTL
->setChecked(true);
62 bool GuiBrlCadImportDialogue::hasSelectedObject()
64 if (ui
->listWidget
->selectedItems().size() == 1) {
70 QString
GuiBrlCadImportDialogue::selectedObject()
72 if (hasSelectedObject()) {
73 QString object_txt
= ui
->listWidget
->selectedItems().first()->text();
74 QString object
= object_txt
.split("/").first();
81 double GuiBrlCadImportDialogue::scanMemory()
85 mem
*= ui
->doubleSpinBoxMemory
->value();
89 int GuiBrlCadImportDialogue::smoothingIterations()
91 return ui
->spinBoxSmoothing
->value();
94 int GuiBrlCadImportDialogue::preservationType()
96 if (ui
->radioButtonNoPreservation
->isChecked()) return 0;
97 if (ui
->radioButtonSolidPreservation
->isChecked()) return 1;
101 double GuiBrlCadImportDialogue::smallestFeatureSize()
103 return ui
->lineEditSmallestFeature
->text().toDouble();
106 double GuiBrlCadImportDialogue::smallestResolution()
108 return ui
->lineEditMinResolution
->text().toDouble();
111 bool GuiBrlCadImportDialogue::useStlFile()
113 return ui
->checkBoxSTL
->isChecked();
116 QString
GuiBrlCadImportDialogue::stlFileName()
118 return m_StlFileName
;
121 double GuiBrlCadImportDialogue::reduction()
123 return 0.01*double(ui
->horizontalSliderReduction
->value());