GUI: Added export mesh with textures, refactored Export dialog (more MLS options)

This commit is contained in:
matlabbe
2015-08-24 11:59:26 -04:00
parent 7fe064ca82
commit 698ae0eeda
15 changed files with 1471 additions and 602 deletions

View File

@@ -40,19 +40,37 @@ ExportCloudsDialog::ExportCloudsDialog(QWidget *parent) :
connect(_ui->buttonBox->button(QDialogButtonBox::RestoreDefaults), SIGNAL(clicked()), this, SLOT(restoreDefaults()));
connect(_ui->groupBox_assemble, SIGNAL(clicked(bool)), this, SIGNAL(configChanged()));
connect(_ui->doubleSpinBox_voxelSize_assembled, SIGNAL(valueChanged(double)), this, SIGNAL(configChanged()));
restoreDefaults();
_ui->comboBox_upsamplingMethod->setItemData(1, 0, Qt::UserRole - 1); // disable DISTINCT_CLOUD
connect(_ui->checkBox_binary, SIGNAL(stateChanged(int)), this, SIGNAL(configChanged()));
connect(_ui->spinBox_normalKSearch, SIGNAL(valueChanged(int)), this, SIGNAL(configChanged()));
connect(_ui->groupBox_regenerate, SIGNAL(clicked(bool)), this, SIGNAL(configChanged()));
connect(_ui->spinBox_decimation, SIGNAL(valueChanged(int)), this, SIGNAL(configChanged()));
connect(_ui->doubleSpinBox_voxelSize, SIGNAL(valueChanged(double)), this, SIGNAL(configChanged()));
connect(_ui->doubleSpinBox_maxDepth, SIGNAL(valueChanged(double)), this, SIGNAL(configChanged()));
connect(_ui->checkBox_binary, SIGNAL(stateChanged(int)), this, SIGNAL(configChanged()));
connect(_ui->groupBox_assemble, SIGNAL(clicked(bool)), this, SIGNAL(configChanged()));
connect(_ui->doubleSpinBox_voxelSize_assembled, SIGNAL(valueChanged(double)), this, SIGNAL(configChanged()));
connect(_ui->groupBox_mls, SIGNAL(clicked(bool)), this, SIGNAL(configChanged()));
connect(_ui->doubleSpinBox_mlsRadius, SIGNAL(valueChanged(double)), this, SIGNAL(configChanged()));
connect(_ui->spinBox_polygonialOrder, SIGNAL(valueChanged(int)), this, SIGNAL(configChanged()));
connect(_ui->comboBox_upsamplingMethod, SIGNAL(currentIndexChanged(int)), this, SIGNAL(configChanged()));
connect(_ui->doubleSpinBox_sampleStep, SIGNAL(valueChanged(double)), this, SIGNAL(configChanged()));
connect(_ui->spinBox_randomPoints, SIGNAL(valueChanged(int)), this, SIGNAL(configChanged()));
connect(_ui->doubleSpinBox_dilationVoxelSize, SIGNAL(valueChanged(double)), this, SIGNAL(configChanged()));
connect(_ui->spinBox_dilationSteps, SIGNAL(valueChanged(int)), this, SIGNAL(configChanged()));
_ui->stackedWidget_upsampling->setCurrentIndex(_ui->comboBox_upsamplingMethod->currentIndex());
connect(_ui->comboBox_upsamplingMethod, SIGNAL(currentIndexChanged(int)), _ui->stackedWidget_upsampling, SLOT(setCurrentIndex(int)));
connect(_ui->comboBox_upsamplingMethod, SIGNAL(currentIndexChanged(int)), this, SLOT(updateMLSGrpVisibility()));
updateMLSGrpVisibility();
connect(_ui->groupBox_gp3, SIGNAL(clicked(bool)), this, SIGNAL(configChanged()));
connect(_ui->spinBox_normalKSearch, SIGNAL(valueChanged(int)), this, SIGNAL(configChanged()));
connect(_ui->doubleSpinBox_gp3Radius, SIGNAL(valueChanged(double)), this, SIGNAL(configChanged()));
connect(_ui->doubleSpinBox_gp3Mu, SIGNAL(valueChanged(double)), this, SIGNAL(configChanged()));
connect(_ui->checkBox_textureMapping, SIGNAL(stateChanged(int)), this, SIGNAL(configChanged()));
}
ExportCloudsDialog::~ExportCloudsDialog()
@@ -60,25 +78,48 @@ ExportCloudsDialog::~ExportCloudsDialog()
delete _ui;
}
void ExportCloudsDialog::updateMLSGrpVisibility()
{
_ui->groupBox->setVisible(_ui->comboBox_upsamplingMethod->currentIndex() == 0);
_ui->groupBox_2->setVisible(_ui->comboBox_upsamplingMethod->currentIndex() == 1);
_ui->groupBox_3->setVisible(_ui->comboBox_upsamplingMethod->currentIndex() == 2);
_ui->groupBox_4->setVisible(_ui->comboBox_upsamplingMethod->currentIndex() == 3);
_ui->groupBox_5->setVisible(_ui->comboBox_upsamplingMethod->currentIndex() == 4);
}
void ExportCloudsDialog::saveSettings(QSettings & settings, const QString & group) const
{
if(!group.isEmpty())
{
settings.beginGroup(group);
}
settings.setValue("assemble", this->getAssemble());
settings.setValue("assemble_voxel", this->getAssembleVoxel());
settings.setValue("binary", this->getBinaryFile());
settings.setValue("normals_k", this->getNormalKSearch());
settings.setValue("regenerate", this->getGenerate());
settings.setValue("regenerate_decimation", this->getGenerateDecimation());
settings.setValue("regenerate_voxel", this->getGenerateVoxel());
settings.setValue("regenerate_max_depth", this->getGenerateMaxDepth());
settings.setValue("binary", this->getBinaryFile());
settings.setValue("assemble", this->getAssemble());
settings.setValue("assemble_voxel", this->getAssembleVoxel());
settings.setValue("mls", this->getMLS());
settings.setValue("mls_radius", this->getMLSRadius());
settings.setValue("mls_polygonial_order", this->getMLSPolygonialOrder());
settings.setValue("mls_upsampling_method", this->getMLSUpsamplingMethod());
settings.setValue("mls_upsampling_radius", this->getMLSUpsamplingRadius());
settings.setValue("mls_upsampling_step", this->getMLSUpsamplingStep());
settings.setValue("mls_point_density", this->getMLSPointDensity());
settings.setValue("mls_dilation_voxel_size", this->getMLSDilationVoxelSize());
settings.setValue("mls_dilation_iterations", this->getMLSDilationIterations());
settings.setValue("mesh", this->getMesh());
settings.setValue("mesh_k", this->getMeshNormalKSearch());
settings.setValue("mesh_radius", this->getMeshGp3Radius());
settings.setValue("mesh_mu", this->getMeshGp3Mu());
settings.setValue("mesh_texture", this->getMeshTexture());
if(!group.isEmpty())
{
settings.endGroup();
@@ -91,19 +132,34 @@ void ExportCloudsDialog::loadSettings(QSettings & settings, const QString & grou
{
settings.beginGroup(group);
}
this->setAssemble(settings.value("assemble", this->getAssemble()).toBool());
this->setAssembleVoxel(settings.value("assemble_voxel", this->getAssembleVoxel()).toDouble());
this->setGenerate(settings.value("regenerate", this->getGenerate()).toBool());
this->setGenerateDecimation(settings.value("regenerate_decimation", this->getGenerateDecimation()).toInt());
this->setGenerateVoxel(settings.value("regenerate_voxel", this->getGenerateVoxel()).toDouble());
this->setGenerateMaxDepth(settings.value("regenerate_max_depth", this->getGenerateMaxDepth()).toDouble());
this->setBinaryFile(settings.value("binary", this->getBinaryFile()).toBool());
this->setMLS(settings.value("mls", this->getMLS()).toBool());
this->setMLSRadius(settings.value("mls_radius", this->getMLSRadius()).toDouble());
this->setMesh(settings.value("mesh", this->getMesh()).toBool());
this->setMeshNormalKSearch(settings.value("mesh_k", this->getMeshNormalKSearch()).toInt());
this->setMeshGp3Radius(settings.value("mesh_radius", this->getMeshGp3Radius()).toDouble());
this->setMeshGp3Mu(settings.value("mesh_mu", this->getMeshGp3Mu()).toDouble());
_ui->checkBox_binary->setChecked(settings.value("binary", this->getBinaryFile()).toBool());
_ui->spinBox_normalKSearch->setValue(settings.value("normals_k", this->getNormalKSearch()).toInt());
_ui->groupBox_regenerate->setChecked(settings.value("regenerate", this->getGenerate()).toBool());
_ui->spinBox_decimation->setValue(settings.value("regenerate_decimation", this->getGenerateDecimation()).toInt());
_ui->doubleSpinBox_voxelSize->setValue(settings.value("regenerate_voxel", this->getGenerateVoxel()).toDouble());
_ui->doubleSpinBox_maxDepth->setValue(settings.value("regenerate_max_depth", this->getGenerateMaxDepth()).toDouble());
_ui->groupBox_assemble->setChecked(settings.value("assemble", this->getAssemble()).toBool());
_ui->doubleSpinBox_voxelSize_assembled->setValue(settings.value("assemble_voxel", this->getAssembleVoxel()).toDouble());
_ui->groupBox_mls->setChecked(settings.value("mls", this->getMLS()).toBool());
_ui->doubleSpinBox_mlsRadius->setValue(settings.value("mls_radius", this->getMLSRadius()).toDouble());
_ui->spinBox_polygonialOrder->setValue(settings.value("mls_polygonial_order", this->getMLSPolygonialOrder()).toInt());
_ui->comboBox_upsamplingMethod->setCurrentIndex(settings.value("mls_upsampling_method", this->getMLSUpsamplingMethod()).toInt());
_ui->doubleSpinBox_sampleRadius->setValue(settings.value("mls_upsampling_radius", this->getMLSRadius()).toDouble());
_ui->doubleSpinBox_sampleStep->setValue(settings.value("mls_upsampling_step", this->getMLSUpsamplingStep()).toDouble());
_ui->spinBox_randomPoints->setValue(settings.value("mls_point_density", this->getMLSPointDensity()).toInt());
_ui->doubleSpinBox_dilationVoxelSize->setValue(settings.value("mls_dilation_voxel_size", this->getMLSDilationVoxelSize()).toDouble());
_ui->spinBox_dilationSteps->setValue(settings.value("mls_dilation_iterations", this->getMLSDilationIterations()).toInt());
_ui->groupBox_gp3->setChecked(settings.value("mesh", this->getMesh()).toBool());
_ui->doubleSpinBox_gp3Radius->setValue(settings.value("mesh_radius", this->getMeshGp3Radius()).toDouble());
_ui->doubleSpinBox_gp3Mu->setValue(settings.value("mesh_mu", this->getMeshGp3Mu()).toDouble());
_ui->checkBox_textureMapping->setChecked(settings.value("mesh_texture", this->getGenerate()).toBool());
if(!group.isEmpty())
{
settings.endGroup();
@@ -112,22 +168,34 @@ void ExportCloudsDialog::loadSettings(QSettings & settings, const QString & grou
void ExportCloudsDialog::restoreDefaults()
{
setAssemble(true);
setAssembleVoxel(0.005);
_ui->checkBox_binary->setChecked(true);
_ui->spinBox_normalKSearch->setValue(20);
if(_ui->groupBox_regenerate->isEnabled())
{
setGenerate(true);
_ui->groupBox_regenerate->setChecked(true);
}
setGenerateDecimation(1);
setGenerateVoxel(0.005);
setGenerateMaxDepth(4);
setBinaryFile(true);
setMLS(false);
setMLSRadius(0.04);
setMesh(false);
setMeshNormalKSearch(20);
setMeshGp3Radius(0.04);
setMeshGp3Radius(2.5);
_ui->spinBox_decimation->setValue(1);
_ui->doubleSpinBox_voxelSize->setValue(0.01);
_ui->doubleSpinBox_maxDepth->setValue(4);
_ui->groupBox_assemble->setChecked(true);
_ui->doubleSpinBox_voxelSize_assembled->setValue(0.01);
_ui->groupBox_mls->setChecked(false);
_ui->doubleSpinBox_mlsRadius->setValue(0.04);
_ui->spinBox_polygonialOrder->setValue(2);
_ui->comboBox_upsamplingMethod->setCurrentIndex(0);
_ui->doubleSpinBox_sampleRadius->setValue(0.01);
_ui->doubleSpinBox_sampleStep->setValue(0.0);
_ui->spinBox_randomPoints->setValue(0);
_ui->doubleSpinBox_dilationVoxelSize->setValue(0.01);
_ui->spinBox_dilationSteps->setValue(0);
_ui->groupBox_gp3->setChecked(false);
_ui->doubleSpinBox_gp3Radius->setValue(0.04);
_ui->doubleSpinBox_gp3Mu->setValue(2.5);
_ui->checkBox_textureMapping->setChecked(false);
}
void ExportCloudsDialog::setSaveButton()
@@ -135,6 +203,9 @@ void ExportCloudsDialog::setSaveButton()
_ui->buttonBox->button(QDialogButtonBox::Ok)->setVisible(false);
_ui->buttonBox->button(QDialogButtonBox::Save)->setVisible(true);
_ui->checkBox_binary->setVisible(true);
_ui->label_binaryFile->setVisible(true);
_ui->checkBox_textureMapping->setVisible(true);
_ui->label_textureMapping->setVisible(true);
}
void ExportCloudsDialog::setOkButton()
@@ -142,6 +213,9 @@ void ExportCloudsDialog::setOkButton()
_ui->buttonBox->button(QDialogButtonBox::Ok)->setVisible(true);
_ui->buttonBox->button(QDialogButtonBox::Save)->setVisible(false);
_ui->checkBox_binary->setVisible(false);
_ui->label_binaryFile->setVisible(false);
_ui->checkBox_textureMapping->setVisible(false);
_ui->label_textureMapping->setVisible(false);
}
void ExportCloudsDialog::enableRegeneration(bool enabled)
@@ -154,14 +228,13 @@ void ExportCloudsDialog::enableRegeneration(bool enabled)
}
//getters
bool ExportCloudsDialog::getAssemble() const
bool ExportCloudsDialog::getBinaryFile() const
{
return _ui->groupBox_assemble->isChecked();
return _ui->checkBox_binary->isChecked();
}
double ExportCloudsDialog::getAssembleVoxel() const
int ExportCloudsDialog::getNormalKSearch() const
{
return _ui->doubleSpinBox_voxelSize_assembled->value();
return _ui->spinBox_normalKSearch->value();
}
bool ExportCloudsDialog::getGenerate() const
@@ -184,31 +257,57 @@ double ExportCloudsDialog::getGenerateMaxDepth() const
return _ui->doubleSpinBox_maxDepth->value();
}
bool ExportCloudsDialog::getBinaryFile() const
bool ExportCloudsDialog::getAssemble() const
{
return _ui->checkBox_binary->isChecked();
return _ui->groupBox_assemble->isChecked();
}
double ExportCloudsDialog::getAssembleVoxel() const
{
return _ui->doubleSpinBox_voxelSize_assembled->value();
}
bool ExportCloudsDialog::getMLS() const
{
return _ui->groupBox_mls->isChecked();
}
double ExportCloudsDialog::getMLSRadius() const
{
return _ui->doubleSpinBox_mlsRadius->value();
}
int ExportCloudsDialog::getMLSPolygonialOrder() const
{
return _ui->spinBox_polygonialOrder->value();
}
int ExportCloudsDialog::getMLSUpsamplingMethod() const
{
return _ui->comboBox_upsamplingMethod->currentIndex();
}
double ExportCloudsDialog::getMLSUpsamplingRadius() const
{
return _ui->doubleSpinBox_sampleRadius->value();
}
double ExportCloudsDialog::getMLSUpsamplingStep() const
{
return _ui->doubleSpinBox_sampleStep->value();
}
int ExportCloudsDialog::getMLSPointDensity() const
{
return _ui->spinBox_randomPoints->value();
}
double ExportCloudsDialog::getMLSDilationVoxelSize() const
{
return _ui->doubleSpinBox_dilationVoxelSize->value();
}
int ExportCloudsDialog::getMLSDilationIterations() const
{
return _ui->spinBox_dilationSteps->value();
}
bool ExportCloudsDialog::getMesh() const
{
return _ui->groupBox_gp3->isChecked();
}
int ExportCloudsDialog::getMeshNormalKSearch() const
{
return _ui->spinBox_normalKSearch->value();
}
double ExportCloudsDialog::getMeshGp3Radius() const
{
return _ui->doubleSpinBox_gp3Radius->value();
@@ -217,59 +316,9 @@ double ExportCloudsDialog::getMeshGp3Mu() const
{
return _ui->doubleSpinBox_gp3Mu->value();
}
//setters
void ExportCloudsDialog::setAssemble(bool on)
bool ExportCloudsDialog::getMeshTexture() const
{
_ui->groupBox_assemble->setChecked(on);
}
void ExportCloudsDialog::setAssembleVoxel(double voxel)
{
_ui->doubleSpinBox_voxelSize_assembled->setValue(voxel);
}
void ExportCloudsDialog::setGenerate(bool on)
{
_ui->groupBox_regenerate->setChecked(on);
}
void ExportCloudsDialog::setGenerateDecimation(int decimation)
{
_ui->spinBox_decimation->setValue(decimation);
}
void ExportCloudsDialog::setGenerateVoxel(double voxel)
{
_ui->doubleSpinBox_voxelSize->setValue(voxel);
}
void ExportCloudsDialog::setGenerateMaxDepth(double maxDepth)
{
_ui->doubleSpinBox_maxDepth->setValue(maxDepth);
}
void ExportCloudsDialog::setBinaryFile(bool on)
{
_ui->checkBox_binary->setChecked(on);
}
void ExportCloudsDialog::setMLS(bool on)
{
_ui->groupBox_mls->setChecked(on);
}
void ExportCloudsDialog::setMLSRadius(double radius)
{
_ui->doubleSpinBox_mlsRadius->setValue(radius);
}
void ExportCloudsDialog::setMesh(bool on)
{
_ui->groupBox_gp3->setChecked(on);
}
void ExportCloudsDialog::setMeshNormalKSearch(int k)
{
_ui->spinBox_normalKSearch->setValue(k);
}
void ExportCloudsDialog::setMeshGp3Radius(double radius)
{
_ui->doubleSpinBox_gp3Radius->setValue(radius);
}
void ExportCloudsDialog::setMeshGp3Mu(double mu)
{
_ui->doubleSpinBox_gp3Mu->setValue(mu);
return _ui->checkBox_textureMapping->isChecked();
}
}