fixed edge display for volume cells
[engrid-github.git] / src / libengrid / guibrlcadimportdialogue.cpp
bloba514d07cd73217a86908dcfb8116b57dbea8b3df
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 "guibrlcadimportdialogue.h"
22 #include "ui_guibrlcadimportdialogue.h"
24 #include <QProcess>
25 #include <QFileInfo>
27 GuiBrlCadImportDialogue::GuiBrlCadImportDialogue(QWidget *parent) :
28 QDialog(parent),
29 ui(new Ui::GuiBrlCadImportDialogue)
31 ui->setupUi(this);
34 GuiBrlCadImportDialogue::~GuiBrlCadImportDialogue()
36 delete ui;
39 void GuiBrlCadImportDialogue::prepare(QString file_name)
41 QString program = "mged";
42 QStringList arguments;
43 QProcess proc(this);
44 arguments << "-c" << file_name<< "ls";
45 proc.start(program, arguments);
46 proc.waitForFinished();
47 QString output = proc.readAllStandardOutput() + proc.readAllStandardError();
48 QStringList objects = output.split(QRegExp("\\s+"));
49 ui->listWidget->clear();
50 foreach (QString obj, objects) {
51 ui->listWidget->addItem(obj);
53 m_StlFileName = file_name + ".stl";
54 if (QFileInfo(m_StlFileName).exists()) {
55 ui->checkBoxSTL->setEnabled(true);
56 ui->checkBoxSTL->setChecked(true);
60 bool GuiBrlCadImportDialogue::hasSelectedObject()
62 if (ui->listWidget->selectedItems().size() == 1) {
63 return true;
65 return false;
68 QString GuiBrlCadImportDialogue::selectedObject()
70 if (hasSelectedObject()) {
71 QString object_txt = ui->listWidget->selectedItems().first()->text();
72 QString object = object_txt.split("/").first();
73 return object;
74 } else {
75 EG_BUG;
79 double GuiBrlCadImportDialogue::scanMemory()
81 double mem = 1024.0;
82 mem *= mem*mem;
83 mem *= ui->doubleSpinBoxMemory->value();
84 return mem;
87 int GuiBrlCadImportDialogue::smoothingIterations()
89 return ui->spinBoxSmoothing->value();
92 int GuiBrlCadImportDialogue::preservationType()
94 if (ui->radioButtonNoPreservation->isChecked()) return 0;
95 if (ui->radioButtonSolidPreservation->isChecked()) return 1;
96 return 2;
99 double GuiBrlCadImportDialogue::smallestFeatureSize()
101 return ui->lineEditSmallestFeature->text().toDouble();
104 double GuiBrlCadImportDialogue::smallestResolution()
106 return ui->lineEditMinResolution->text().toDouble();
109 bool GuiBrlCadImportDialogue::useStlFile()
111 return ui->checkBoxSTL->isChecked();
114 QString GuiBrlCadImportDialogue::stlFileName()
116 return m_StlFileName;
119 double GuiBrlCadImportDialogue::reduction()
121 return 0.01*double(ui->horizontalSliderReduction->value());