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 "PostProcessingDialog.h"
00029 #include "ui_postProcessingDialog.h"
00030
00031 #include <QPushButton>
00032
00033 namespace rtabmap {
00034
00035 PostProcessingDialog::PostProcessingDialog(QWidget * parent) :
00036 QDialog(parent)
00037 {
00038 _ui = new Ui_PostProcessingDialog();
00039 _ui->setupUi(this);
00040
00041 connect(_ui->detectMoreLoopClosures, SIGNAL(clicked(bool)), this, SLOT(updateButtonBox()));
00042 connect(_ui->refineNeighborLinks, SIGNAL(stateChanged(int)), this, SLOT(updateButtonBox()));
00043 connect(_ui->refineLoopClosureLinks, SIGNAL(stateChanged(int)), this, SLOT(updateButtonBox()));
00044 connect(_ui->buttonBox->button(QDialogButtonBox::RestoreDefaults), SIGNAL(clicked()), this, SLOT(restoreDefaults()));
00045
00046 connect(_ui->detectMoreLoopClosures, SIGNAL(clicked(bool)), this, SIGNAL(configChanged()));
00047 connect(_ui->clusterRadius, SIGNAL(valueChanged(double)), this, SIGNAL(configChanged()));
00048 connect(_ui->clusterAngle, SIGNAL(valueChanged(double)), this, SIGNAL(configChanged()));
00049 connect(_ui->iterations, SIGNAL(valueChanged(int)), this, SIGNAL(configChanged()));
00050 connect(_ui->reextractFeatures, SIGNAL(stateChanged(int)), this, SIGNAL(configChanged()));
00051 connect(_ui->refineNeighborLinks, SIGNAL(stateChanged(int)), this, SIGNAL(configChanged()));
00052 connect(_ui->refineLoopClosureLinks, SIGNAL(stateChanged(int)), this, SIGNAL(configChanged()));
00053 }
00054
00055 PostProcessingDialog::~PostProcessingDialog()
00056 {
00057 delete _ui;
00058 }
00059
00060 void PostProcessingDialog::saveSettings(QSettings & settings, const QString & group) const
00061 {
00062 if(!group.isEmpty())
00063 {
00064 settings.beginGroup(group);
00065 }
00066 settings.setValue("detect_more_lc", this->isDetectMoreLoopClosures());
00067 settings.setValue("cluster_radius", this->clusterRadius());
00068 settings.setValue("cluster_angle", this->clusterAngle());
00069 settings.setValue("iterations", this->iterations());
00070 settings.setValue("reextract_features", this->isReextractFeatures());
00071 settings.setValue("refine_neigbors", this->isRefineNeighborLinks());
00072 settings.setValue("refine_lc", this->isRefineLoopClosureLinks());
00073 if(!group.isEmpty())
00074 {
00075 settings.endGroup();
00076 }
00077 }
00078
00079 void PostProcessingDialog::loadSettings(QSettings & settings, const QString & group)
00080 {
00081 if(!group.isEmpty())
00082 {
00083 settings.beginGroup(group);
00084 }
00085 this->setDetectMoreLoopClosures(settings.value("detect_more_lc", this->isDetectMoreLoopClosures()).toBool());
00086 this->setClusterRadius(settings.value("cluster_radius", this->clusterRadius()).toDouble());
00087 this->setClusterAngle(settings.value("cluster_angle", this->clusterAngle()).toDouble());
00088 this->setIterations(settings.value("iterations", this->iterations()).toInt());
00089 this->setReextractFeatures(settings.value("reextract_features", this->isReextractFeatures()).toBool());
00090 this->setRefineNeighborLinks(settings.value("refine_neigbors", this->isRefineNeighborLinks()).toBool());
00091 this->setRefineLoopClosureLinks(settings.value("refine_lc", this->isRefineLoopClosureLinks()).toBool());
00092 if(!group.isEmpty())
00093 {
00094 settings.endGroup();
00095 }
00096 }
00097
00098 void PostProcessingDialog::restoreDefaults()
00099 {
00100 setDetectMoreLoopClosures(true);
00101 setClusterRadius(0.3);
00102 setClusterAngle(30);
00103 setIterations(1);
00104 setReextractFeatures(false);
00105 setRefineNeighborLinks(false);
00106 setRefineLoopClosureLinks(false);
00107 }
00108
00109 void PostProcessingDialog::updateButtonBox()
00110 {
00111 _ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(
00112 isDetectMoreLoopClosures() || isRefineNeighborLinks() || isRefineLoopClosureLinks());
00113 }
00114
00115 bool PostProcessingDialog::isDetectMoreLoopClosures() const
00116 {
00117 return _ui->detectMoreLoopClosures->isChecked();
00118 }
00119
00120 double PostProcessingDialog::clusterRadius() const
00121 {
00122 return _ui->clusterRadius->value();
00123 }
00124
00125 double PostProcessingDialog::clusterAngle() const
00126 {
00127 return _ui->clusterAngle->value();
00128 }
00129
00130 int PostProcessingDialog::iterations() const
00131 {
00132 return _ui->iterations->value();
00133 }
00134
00135 bool PostProcessingDialog::isReextractFeatures() const
00136 {
00137 return _ui->reextractFeatures->isChecked();
00138 }
00139
00140 bool PostProcessingDialog::isRefineNeighborLinks() const
00141 {
00142 return _ui->refineNeighborLinks->isChecked();
00143 }
00144
00145 bool PostProcessingDialog::isRefineLoopClosureLinks() const
00146 {
00147 return _ui->refineLoopClosureLinks->isChecked();
00148 }
00149
00150
00151 void PostProcessingDialog::setDetectMoreLoopClosures(bool on)
00152 {
00153 _ui->detectMoreLoopClosures->setChecked(on);
00154 }
00155 void PostProcessingDialog::setClusterRadius(double radius)
00156 {
00157 _ui->clusterRadius->setValue(radius);
00158 }
00159 void PostProcessingDialog::setClusterAngle(double angle)
00160 {
00161 _ui->clusterAngle->setValue(angle);
00162 }
00163 void PostProcessingDialog::setIterations(int iterations)
00164 {
00165 _ui->iterations->setValue(iterations);
00166 }
00167 void PostProcessingDialog::setReextractFeatures(bool on)
00168 {
00169 _ui->reextractFeatures->setChecked(on);
00170 }
00171 void PostProcessingDialog::setRefineNeighborLinks(bool on)
00172 {
00173 _ui->refineNeighborLinks->setChecked(on);
00174 }
00175 void PostProcessingDialog::setRefineLoopClosureLinks(bool on)
00176 {
00177 _ui->refineLoopClosureLinks->setChecked(on);
00178 }
00179
00180 }