00001 /*************************************************************************** 00002 * Copyright (c) 2010 Werner Mayer <wmayer[at]users.sourceforge.net> * 00003 * * 00004 * This file is part of the FreeCAD CAx development system. * 00005 * * 00006 * This library is free software; you can redistribute it and/or * 00007 * modify it under the terms of the GNU Library General Public * 00008 * License as published by the Free Software Foundation; either * 00009 * version 2 of the License, or (at your option) any later version. * 00010 * * 00011 * This library is distributed in the hope that it will be useful, * 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00014 * GNU Library General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU Library General Public * 00017 * License along with this library; see the file COPYING.LIB. If not, * 00018 * write to the Free Software Foundation, Inc., 59 Temple Place, * 00019 * Suite 330, Boston, MA 02111-1307, USA * 00020 * * 00021 ***************************************************************************/ 00022 00023 #include "PreCompiled.h" 00024 #ifndef _PreComp_ 00025 # include <QButtonGroup> 00026 #endif 00027 00028 #include "DlgSmoothing.h" 00029 #include "ui_DlgSmoothing.h" 00030 00031 using namespace MeshGui; 00032 00033 /* TRANSLATOR MeshGui::DlgSmoothing */ 00034 00035 DlgSmoothing::DlgSmoothing(QWidget* parent, Qt::WFlags fl) 00036 : QDialog(parent, fl), ui(new Ui_DlgSmoothing()) 00037 { 00038 ui->setupUi(this); 00039 bg = new QButtonGroup(this); 00040 bg->addButton(ui->radioButtonTaubin, 0); 00041 bg->addButton(ui->radioButtonLaplace, 1); 00042 connect(bg, SIGNAL(buttonClicked(int)), 00043 this, SLOT(method_clicked(int))); 00044 00045 ui->labelLambda->setText(QString::fromUtf8("\xce\xbb")); 00046 ui->labelMu->setText(QString::fromUtf8("\xce\xbc")); 00047 this->resize(this->sizeHint()); 00048 } 00049 00050 /* 00051 * Destroys the object and frees any allocated resources 00052 */ 00053 DlgSmoothing::~DlgSmoothing() 00054 { 00055 // no need to delete child widgets, Qt does it all for us 00056 delete ui; 00057 } 00058 00059 void DlgSmoothing::method_clicked(int id) 00060 { 00061 if (bg->button(id) == ui->radioButtonTaubin) { 00062 ui->labelMu->setEnabled(true); 00063 ui->spinMicro->setEnabled(true); 00064 } 00065 else { 00066 ui->labelMu->setEnabled(false); 00067 ui->spinMicro->setEnabled(false); 00068 } 00069 } 00070 00071 int DlgSmoothing::iterations() const 00072 { 00073 return ui->iterations->value(); 00074 } 00075 00076 double DlgSmoothing::lambdaStep() const 00077 { 00078 return ui->spinLambda->value(); 00079 } 00080 00081 double DlgSmoothing::microStep() const 00082 { 00083 return ui->spinMicro->value(); 00084 } 00085 00086 DlgSmoothing::Smooth DlgSmoothing::method() const 00087 { 00088 if (ui->radioButtonTaubin->isChecked()) 00089 return DlgSmoothing::Taubin; 00090 else if (ui->radioButtonLaplace->isChecked()) 00091 return DlgSmoothing::Laplace; 00092 return DlgSmoothing::None; 00093 } 00094 00095 #include "moc_DlgSmoothing.cpp"