PostProcessingDialog.cpp
Go to the documentation of this file.
00001 /*
00002 Copyright (c) 2010-2014, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
00003 All rights reserved.
00004 
00005 Redistribution and use in source and binary forms, with or without
00006 modification, are permitted provided that the following conditions are met:
00007     * Redistributions of source code must retain the above copyright
00008       notice, this list of conditions and the following disclaimer.
00009     * Redistributions in binary form must reproduce the above copyright
00010       notice, this list of conditions and the following disclaimer in the
00011       documentation and/or other materials provided with the distribution.
00012     * Neither the name of the Universite de Sherbrooke nor the
00013       names of its contributors may be used to endorse or promote products
00014       derived from this software without specific prior written permission.
00015 
00016 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00017 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00018 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00019 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
00020 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00021 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00022 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00023 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00024 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00025 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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 //setters
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 }


rtabmap
Author(s): Mathieu Labbe
autogenerated on Fri Aug 28 2015 12:51:32