Go to the documentation of this file.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 "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 }