ExportBundlerDialog.cpp
Go to the documentation of this file.
00001 /*
00002 Copyright (c) 2010-2016, 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 "rtabmap/gui/ExportBundlerDialog.h"
00029 #include "ui_exportBundlerDialog.h"
00030 
00031 #include <QFileDialog>
00032 #include <QPushButton>
00033 
00034 namespace rtabmap {
00035 
00036 ExportBundlerDialog::ExportBundlerDialog(QWidget * parent) :
00037         QDialog(parent)
00038 {
00039         _ui = new Ui_ExportBundlerDialog();
00040         _ui->setupUi(this);
00041 
00042         connect(_ui->toolButton_path, SIGNAL(clicked()), this, SLOT(getPath()));
00043 
00044         restoreDefaults();
00045         connect(_ui->buttonBox->button(QDialogButtonBox::RestoreDefaults), SIGNAL(clicked()), this, SLOT(restoreDefaults()));
00046 
00047         connect(_ui->doubleSpinBox_laplacianVariance, SIGNAL(valueChanged(double)), this, SIGNAL(configChanged()));
00048         connect(_ui->doubleSpinBox_linearSpeed, SIGNAL(valueChanged(double)), this, SIGNAL(configChanged()));
00049         connect(_ui->doubleSpinBox_angularSpeed, SIGNAL(valueChanged(double)), this, SIGNAL(configChanged()));
00050 
00051         _ui->lineEdit_path->setText(QDir::currentPath());
00052 }
00053 
00054 ExportBundlerDialog::~ExportBundlerDialog()
00055 {
00056         delete _ui;
00057 }
00058 
00059 void ExportBundlerDialog::saveSettings(QSettings & settings, const QString & group) const
00060 {
00061         if(!group.isEmpty())
00062         {
00063                 settings.beginGroup(group);
00064         }
00065         settings.setValue("maxLinearSpeed", this->maxLinearSpeed());
00066         settings.setValue("maxAngularSpeed", this->maxAngularSpeed());
00067         settings.setValue("laplacianThr", this->laplacianThreshold());
00068         if(!group.isEmpty())
00069         {
00070                 settings.endGroup();
00071         }
00072 }
00073 
00074 void ExportBundlerDialog::loadSettings(QSettings & settings, const QString & group)
00075 {
00076         if(!group.isEmpty())
00077         {
00078                 settings.beginGroup(group);
00079         }
00080         _ui->doubleSpinBox_linearSpeed->setValue(settings.value("maxLinearSpeed", this->maxLinearSpeed()).toDouble());
00081         _ui->doubleSpinBox_angularSpeed->setValue(settings.value("maxAngularSpeed", this->maxAngularSpeed()).toDouble());
00082         _ui->doubleSpinBox_laplacianVariance->setValue(settings.value("laplacianThr", this->laplacianThreshold()).toDouble());
00083         if(!group.isEmpty())
00084         {
00085                 settings.endGroup();
00086         }
00087 }
00088 
00089 void ExportBundlerDialog::setWorkingDirectory(const QString & path)
00090 {
00091         _ui->lineEdit_path->setText((path.isEmpty()?QDir::currentPath():path) + "/bundler");
00092 }
00093 
00094 void ExportBundlerDialog::restoreDefaults()
00095 {
00096         _ui->doubleSpinBox_linearSpeed->setValue(0);
00097         _ui->doubleSpinBox_angularSpeed->setValue(0);
00098         _ui->doubleSpinBox_laplacianVariance->setValue(0);
00099 }
00100 
00101 void ExportBundlerDialog::getPath()
00102 {
00103         QString path = QFileDialog::getExistingDirectory(this, tr("Exporting cameras in Bundler format..."), _ui->lineEdit_path->text());
00104         if(!path.isEmpty())
00105         {
00106                 _ui->lineEdit_path->setText(path);
00107         }
00108 }
00109 
00110 QString ExportBundlerDialog::outputPath() const
00111 {
00112         return _ui->lineEdit_path->text();
00113 }
00114 
00115 double ExportBundlerDialog::maxLinearSpeed() const
00116 {
00117         return _ui->doubleSpinBox_linearSpeed->value();
00118 }
00119 double ExportBundlerDialog::maxAngularSpeed() const
00120 {
00121         return _ui->doubleSpinBox_angularSpeed->value();
00122 }
00123 double ExportBundlerDialog::laplacianThreshold() const
00124 {
00125         return _ui->doubleSpinBox_laplacianVariance->value();
00126 }
00127 
00128 }


rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jun 6 2019 21:59:19