ExportBundlerDialog.cpp
Go to the documentation of this file.
1 /*
2 Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7  * Redistributions of source code must retain the above copyright
8  notice, this list of conditions and the following disclaimer.
9  * Redistributions in binary form must reproduce the above copyright
10  notice, this list of conditions and the following disclaimer in the
11  documentation and/or other materials provided with the distribution.
12  * Neither the name of the Universite de Sherbrooke nor the
13  names of its contributors may be used to endorse or promote products
14  derived from this software without specific prior written permission.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 
29 #include "ui_exportBundlerDialog.h"
30 
31 #include <QFileDialog>
32 #include <QPushButton>
33 
34 namespace rtabmap {
35 
37  QDialog(parent)
38 {
39  _ui = new Ui_ExportBundlerDialog();
40  _ui->setupUi(this);
41 
42  connect(_ui->toolButton_path, SIGNAL(clicked()), this, SLOT(getPath()));
43 
45  connect(_ui->buttonBox->button(QDialogButtonBox::RestoreDefaults), SIGNAL(clicked()), this, SLOT(restoreDefaults()));
46 
47  connect(_ui->doubleSpinBox_laplacianVariance, SIGNAL(valueChanged(double)), this, SIGNAL(configChanged()));
48  connect(_ui->doubleSpinBox_linearSpeed, SIGNAL(valueChanged(double)), this, SIGNAL(configChanged()));
49  connect(_ui->doubleSpinBox_angularSpeed, SIGNAL(valueChanged(double)), this, SIGNAL(configChanged()));
50 
51  _ui->lineEdit_path->setText(QDir::currentPath());
52 }
53 
55 {
56  delete _ui;
57 }
58 
59 void ExportBundlerDialog::saveSettings(QSettings & settings, const QString & group) const
60 {
61  if(!group.isEmpty())
62  {
63  settings.beginGroup(group);
64  }
65  settings.setValue("maxLinearSpeed", this->maxLinearSpeed());
66  settings.setValue("maxAngularSpeed", this->maxAngularSpeed());
67  settings.setValue("laplacianThr", this->laplacianThreshold());
68  if(!group.isEmpty())
69  {
70  settings.endGroup();
71  }
72 }
73 
74 void ExportBundlerDialog::loadSettings(QSettings & settings, const QString & group)
75 {
76  if(!group.isEmpty())
77  {
78  settings.beginGroup(group);
79  }
80  _ui->doubleSpinBox_linearSpeed->setValue(settings.value("maxLinearSpeed", this->maxLinearSpeed()).toDouble());
81  _ui->doubleSpinBox_angularSpeed->setValue(settings.value("maxAngularSpeed", this->maxAngularSpeed()).toDouble());
82  _ui->doubleSpinBox_laplacianVariance->setValue(settings.value("laplacianThr", this->laplacianThreshold()).toDouble());
83  if(!group.isEmpty())
84  {
85  settings.endGroup();
86  }
87 }
88 
89 void ExportBundlerDialog::setWorkingDirectory(const QString & path)
90 {
91  _ui->lineEdit_path->setText((path.isEmpty()?QDir::currentPath():path) + "/bundler");
92 }
93 
95 {
96  _ui->doubleSpinBox_linearSpeed->setValue(0);
97  _ui->doubleSpinBox_angularSpeed->setValue(0);
98  _ui->doubleSpinBox_laplacianVariance->setValue(0);
99 }
100 
102 {
103  QString path = QFileDialog::getExistingDirectory(this, tr("Exporting cameras in Bundler format..."), _ui->lineEdit_path->text());
104  if(!path.isEmpty())
105  {
106  _ui->lineEdit_path->setText(path);
107  }
108 }
109 
111 {
112  return _ui->lineEdit_path->text();
113 }
114 
116 {
117  return _ui->doubleSpinBox_linearSpeed->value();
118 }
120 {
121  return _ui->doubleSpinBox_angularSpeed->value();
122 }
124 {
125  return _ui->doubleSpinBox_laplacianVariance->value();
126 }
127 
128 }
ExportBundlerDialog(QWidget *parent=0)
void setWorkingDirectory(const QString &path)
void saveSettings(QSettings &settings, const QString &group="") const
Ui_ExportBundlerDialog * _ui
void loadSettings(QSettings &settings, const QString &group="")


rtabmap
Author(s): Mathieu Labbe
autogenerated on Wed Jun 5 2019 22:41:31