00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include "ExportCloudsDialog.h"
00029 #include "ui_exportCloudsDialog.h"
00030
00031 #include <QPushButton>
00032
00033 namespace rtabmap {
00034
00035 ExportCloudsDialog::ExportCloudsDialog(QWidget *parent) :
00036 QDialog(parent)
00037 {
00038 _ui = new Ui_ExportCloudsDialog();
00039 _ui->setupUi(this);
00040
00041 connect(_ui->buttonBox->button(QDialogButtonBox::RestoreDefaults), SIGNAL(clicked()), this, SLOT(restoreDefaults()));
00042
00043 connect(_ui->groupBox_assemble, SIGNAL(clicked(bool)), this, SIGNAL(configChanged()));
00044 connect(_ui->doubleSpinBox_voxelSize_assembled, SIGNAL(valueChanged(double)), this, SIGNAL(configChanged()));
00045 connect(_ui->groupBox_regenerate, SIGNAL(clicked(bool)), this, SIGNAL(configChanged()));
00046 connect(_ui->spinBox_decimation, SIGNAL(valueChanged(int)), this, SIGNAL(configChanged()));
00047 connect(_ui->doubleSpinBox_voxelSize, SIGNAL(valueChanged(double)), this, SIGNAL(configChanged()));
00048 connect(_ui->doubleSpinBox_maxDepth, SIGNAL(valueChanged(double)), this, SIGNAL(configChanged()));
00049 connect(_ui->checkBox_binary, SIGNAL(stateChanged(int)), this, SIGNAL(configChanged()));
00050 connect(_ui->groupBox_mls, SIGNAL(clicked(bool)), this, SIGNAL(configChanged()));
00051 connect(_ui->doubleSpinBox_mlsRadius, SIGNAL(valueChanged(double)), this, SIGNAL(configChanged()));
00052 connect(_ui->groupBox_gp3, SIGNAL(clicked(bool)), this, SIGNAL(configChanged()));
00053 connect(_ui->spinBox_normalKSearch, SIGNAL(valueChanged(int)), this, SIGNAL(configChanged()));
00054 connect(_ui->doubleSpinBox_gp3Radius, SIGNAL(valueChanged(double)), this, SIGNAL(configChanged()));
00055 }
00056
00057 ExportCloudsDialog::~ExportCloudsDialog()
00058 {
00059 delete _ui;
00060 }
00061
00062 void ExportCloudsDialog::saveSettings(QSettings & settings, const QString & group) const
00063 {
00064 if(!group.isEmpty())
00065 {
00066 settings.beginGroup(group);
00067 }
00068 settings.setValue("assemble", this->getAssemble());
00069 settings.setValue("assemble_voxel", this->getAssembleVoxel());
00070 settings.setValue("regenerate", this->getGenerate());
00071 settings.setValue("regenerate_decimation", this->getGenerateDecimation());
00072 settings.setValue("regenerate_voxel", this->getGenerateVoxel());
00073 settings.setValue("regenerate_max_depth", this->getGenerateMaxDepth());
00074 settings.setValue("binary", this->getBinaryFile());
00075 settings.setValue("mls", this->getMLS());
00076 settings.setValue("mls_radius", this->getMLSRadius());
00077 settings.setValue("mesh", this->getMesh());
00078 settings.setValue("mesh_k", this->getMeshNormalKSearch());
00079 settings.setValue("mesh_radius", this->getMeshGp3Radius());
00080 if(!group.isEmpty())
00081 {
00082 settings.endGroup();
00083 }
00084 }
00085
00086 void ExportCloudsDialog::loadSettings(QSettings & settings, const QString & group)
00087 {
00088 if(!group.isEmpty())
00089 {
00090 settings.beginGroup(group);
00091 }
00092 this->setAssemble(settings.value("assemble", this->getAssemble()).toBool());
00093 this->setAssembleVoxel(settings.value("assemble_voxel", this->getAssembleVoxel()).toDouble());
00094 this->setGenerate(settings.value("regenerate", this->getGenerate()).toBool());
00095 this->setGenerateDecimation(settings.value("regenerate_decimation", this->getGenerateDecimation()).toInt());
00096 this->setGenerateVoxel(settings.value("regenerate_voxel", this->getGenerateVoxel()).toDouble());
00097 this->setGenerateMaxDepth(settings.value("regenerate_max_depth", this->getGenerateMaxDepth()).toDouble());
00098 this->setBinaryFile(settings.value("binary", this->getBinaryFile()).toBool());
00099 this->setMLS(settings.value("mls", this->getMLS()).toBool());
00100 this->setMLSRadius(settings.value("mls_radius", this->getMLSRadius()).toDouble());
00101 this->setMesh(settings.value("mesh", this->getMesh()).toBool());
00102 this->setMeshNormalKSearch(settings.value("mesh_k", this->getMeshNormalKSearch()).toInt());
00103 this->setMeshGp3Radius(settings.value("mesh_radius", this->getMeshGp3Radius()).toDouble());
00104 if(!group.isEmpty())
00105 {
00106 settings.endGroup();
00107 }
00108 }
00109
00110 void ExportCloudsDialog::restoreDefaults()
00111 {
00112 setAssemble(true);
00113 setAssembleVoxel(0.005);
00114 if(_ui->groupBox_regenerate->isEnabled())
00115 {
00116 setGenerate(true);
00117 }
00118 setGenerateDecimation(1);
00119 setGenerateVoxel(0.005);
00120 setGenerateMaxDepth(4);
00121 setBinaryFile(true);
00122 setMLS(false);
00123 setMLSRadius(0.04);
00124 setMesh(false);
00125 setMeshNormalKSearch(20);
00126 setMeshGp3Radius(0.04);
00127 }
00128
00129 void ExportCloudsDialog::setSaveButton()
00130 {
00131 _ui->buttonBox->button(QDialogButtonBox::Ok)->setVisible(false);
00132 _ui->buttonBox->button(QDialogButtonBox::Save)->setVisible(true);
00133 _ui->checkBox_binary->setVisible(true);
00134 }
00135
00136 void ExportCloudsDialog::setOkButton()
00137 {
00138 _ui->buttonBox->button(QDialogButtonBox::Ok)->setVisible(true);
00139 _ui->buttonBox->button(QDialogButtonBox::Save)->setVisible(false);
00140 _ui->checkBox_binary->setVisible(false);
00141 }
00142
00143 void ExportCloudsDialog::enableRegeneration(bool enabled)
00144 {
00145 if(!enabled)
00146 {
00147 _ui->groupBox_regenerate->setChecked(false);
00148 }
00149 _ui->groupBox_regenerate->setEnabled(enabled);
00150 }
00151
00152
00153 bool ExportCloudsDialog::getAssemble() const
00154 {
00155 return _ui->groupBox_assemble->isChecked();
00156 }
00157
00158 double ExportCloudsDialog::getAssembleVoxel() const
00159 {
00160 return _ui->doubleSpinBox_voxelSize_assembled->value();
00161 }
00162
00163 bool ExportCloudsDialog::getGenerate() const
00164 {
00165 return _ui->groupBox_regenerate->isChecked();
00166 }
00167
00168 int ExportCloudsDialog::getGenerateDecimation() const
00169 {
00170 return _ui->spinBox_decimation->value();
00171 }
00172
00173 double ExportCloudsDialog::getGenerateVoxel() const
00174 {
00175 return _ui->doubleSpinBox_voxelSize->value();
00176 }
00177
00178 double ExportCloudsDialog::getGenerateMaxDepth() const
00179 {
00180 return _ui->doubleSpinBox_maxDepth->value();
00181 }
00182
00183 bool ExportCloudsDialog::getBinaryFile() const
00184 {
00185 return _ui->checkBox_binary->isChecked();
00186 }
00187
00188 bool ExportCloudsDialog::getMLS() const
00189 {
00190 return _ui->groupBox_mls->isChecked();
00191 }
00192
00193 double ExportCloudsDialog::getMLSRadius() const
00194 {
00195 return _ui->doubleSpinBox_mlsRadius->value();
00196 }
00197
00198 bool ExportCloudsDialog::getMesh() const
00199 {
00200 return _ui->groupBox_gp3->isChecked();
00201 }
00202
00203 int ExportCloudsDialog::getMeshNormalKSearch() const
00204 {
00205 return _ui->spinBox_normalKSearch->value();
00206 }
00207
00208 double ExportCloudsDialog::getMeshGp3Radius() const
00209 {
00210 return _ui->doubleSpinBox_gp3Radius->value();
00211 }
00212
00213
00214 void ExportCloudsDialog::setAssemble(bool on)
00215 {
00216 _ui->groupBox_assemble->setChecked(on);
00217 }
00218 void ExportCloudsDialog::setAssembleVoxel(double voxel)
00219 {
00220 _ui->doubleSpinBox_voxelSize_assembled->setValue(voxel);
00221 }
00222 void ExportCloudsDialog::setGenerate(bool on)
00223 {
00224 _ui->groupBox_regenerate->setChecked(on);
00225 }
00226 void ExportCloudsDialog::setGenerateDecimation(int decimation)
00227 {
00228 _ui->spinBox_decimation->setValue(decimation);
00229 }
00230 void ExportCloudsDialog::setGenerateVoxel(double voxel)
00231 {
00232 _ui->doubleSpinBox_voxelSize->setValue(voxel);
00233 }
00234 void ExportCloudsDialog::setGenerateMaxDepth(double maxDepth)
00235 {
00236 _ui->doubleSpinBox_maxDepth->setValue(maxDepth);
00237 }
00238 void ExportCloudsDialog::setBinaryFile(bool on)
00239 {
00240 _ui->checkBox_binary->setChecked(on);
00241 }
00242 void ExportCloudsDialog::setMLS(bool on)
00243 {
00244 _ui->groupBox_mls->setChecked(on);
00245 }
00246 void ExportCloudsDialog::setMLSRadius(double radius)
00247 {
00248 _ui->doubleSpinBox_mlsRadius->setValue(radius);
00249 }
00250 void ExportCloudsDialog::setMesh(bool on)
00251 {
00252 _ui->groupBox_gp3->setChecked(on);
00253 }
00254 void ExportCloudsDialog::setMeshNormalKSearch(int k)
00255 {
00256 _ui->spinBox_normalKSearch->setValue(k);
00257 }
00258 void ExportCloudsDialog::setMeshGp3Radius(double radius)
00259 {
00260 _ui->doubleSpinBox_gp3Radius->setValue(radius);
00261 }
00262
00263
00264 }