mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 01:20:25 +08:00
Saving ExportCloudsDialog and PostProcessing parameters to config file.
This commit is contained in:
@@ -138,7 +138,7 @@ public:
|
||||
void removeAllGraphs();
|
||||
|
||||
bool isTrajectoryShown() const;
|
||||
int getTrajectorySize() const;
|
||||
unsigned int getTrajectorySize() const;
|
||||
void setTrajectoryShown(bool shown);
|
||||
void setTrajectorySize(unsigned int value);
|
||||
void clearTrajectory();
|
||||
|
||||
@@ -61,8 +61,6 @@ class OdometryThread;
|
||||
class CameraThread;
|
||||
class Signature;
|
||||
class LoopClosureViewer;
|
||||
class CloudViewer;
|
||||
class ImageView;
|
||||
|
||||
class RTABMAPGUI_EXP PreferencesDialog : public QDialog
|
||||
{
|
||||
@@ -103,10 +101,8 @@ public:
|
||||
void loadWindowGeometry(const QString & windowName, QWidget * window);
|
||||
void saveMainWindowState(const QMainWindow * mainWindow);
|
||||
void loadMainWindowState(QMainWindow * mainWindow);
|
||||
void saveCloudViewerState(const QString & name, const CloudViewer * viewer);
|
||||
void loadCloudViewerState(const QString & name, CloudViewer * viewer);
|
||||
void saveImageViewState(const QString & name, const ImageView * view);
|
||||
void loadImageViewState(const QString & name, ImageView * view);
|
||||
void saveWidgetState(const QString & name, const QWidget * widget);
|
||||
void loadWidgetState(const QString & name, QWidget * widget);
|
||||
|
||||
void saveCustomConfig(const QString & section, const QString & key, const QString & value);
|
||||
QString loadCustomConfig(const QString & section, const QString & key);
|
||||
|
||||
@@ -496,7 +496,7 @@ bool CloudViewer::isTrajectoryShown() const
|
||||
return _aShowTrajectory->isChecked();
|
||||
}
|
||||
|
||||
int CloudViewer::getTrajectorySize() const
|
||||
unsigned int CloudViewer::getTrajectorySize() const
|
||||
{
|
||||
return _maxTrajectorySize;
|
||||
}
|
||||
|
||||
@@ -82,10 +82,10 @@ void DetailedProgressDialog::setAutoClose(bool on, int delayedClosingTimeSec)
|
||||
_closeWhenDoneCheckBox->setChecked(on);
|
||||
}
|
||||
|
||||
void DetailedProgressDialog::appendText(const QString & text)
|
||||
void DetailedProgressDialog::appendText(const QString & text, const QColor & color)
|
||||
{
|
||||
_text->setText(text);
|
||||
QString html = tr("<html><font color=\"#999999\">%1 </font>%2</html>").arg(QTime::currentTime().toString("HH:mm:ss")).arg(text);
|
||||
QString html = tr("<html><font color=\"#999999\">%1 </font><font color=\"%2\">%3</font></html>").arg(QTime::currentTime().toString("HH:mm:ss")).arg(color.name()).arg(text);
|
||||
_detailedText->append(html);
|
||||
_detailedText->ensureCursorVisible();
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ protected:
|
||||
virtual void closeEvent(QCloseEvent * event);
|
||||
|
||||
public slots:
|
||||
void appendText(const QString & text);
|
||||
void appendText(const QString & text ,const QColor & color = Qt::black);
|
||||
void incrementStep();
|
||||
void clear();
|
||||
void resetProgress();
|
||||
|
||||
@@ -65,6 +65,7 @@ void ExportCloudsDialog::enableRegeneration(bool enabled)
|
||||
_ui->groupBox_regenerate->setEnabled(enabled);
|
||||
}
|
||||
|
||||
//getters
|
||||
bool ExportCloudsDialog::getAssemble() const
|
||||
{
|
||||
return _ui->groupBox_assemble->isChecked();
|
||||
@@ -125,5 +126,55 @@ double ExportCloudsDialog::getMeshGp3Radius() const
|
||||
return _ui->doubleSpinBox_gp3Radius->value();
|
||||
}
|
||||
|
||||
//setters
|
||||
void ExportCloudsDialog::setAssemble(bool on)
|
||||
{
|
||||
_ui->groupBox_assemble->setChecked(on);
|
||||
}
|
||||
void ExportCloudsDialog::setAssembleVoxel(double voxel)
|
||||
{
|
||||
_ui->doubleSpinBox_voxelSize_assembled->setValue(voxel);
|
||||
}
|
||||
void ExportCloudsDialog::setGenerate(bool on)
|
||||
{
|
||||
_ui->groupBox_regenerate->setChecked(on);
|
||||
}
|
||||
void ExportCloudsDialog::setGenerateDecimation(int decimation)
|
||||
{
|
||||
_ui->spinBox_decimation->setValue(decimation);
|
||||
}
|
||||
void ExportCloudsDialog::setGenerateVoxel(double voxel)
|
||||
{
|
||||
_ui->doubleSpinBox_voxelSize->setValue(voxel);
|
||||
}
|
||||
void ExportCloudsDialog::setGenerateMaxDepth(double maxDepth)
|
||||
{
|
||||
_ui->doubleSpinBox_maxDepth->setValue(maxDepth);
|
||||
}
|
||||
void ExportCloudsDialog::setBinaryFile(bool on)
|
||||
{
|
||||
_ui->checkBox_binary->setChecked(on);
|
||||
}
|
||||
void ExportCloudsDialog::setMLS(bool on)
|
||||
{
|
||||
_ui->groupBox_mls->setChecked(on);
|
||||
}
|
||||
void ExportCloudsDialog::setMLSRadius(double radius)
|
||||
{
|
||||
_ui->doubleSpinBox_mlsRadius->setValue(radius);
|
||||
}
|
||||
void ExportCloudsDialog::setMesh(bool on)
|
||||
{
|
||||
_ui->groupBox_gp3->setChecked(on);
|
||||
}
|
||||
void ExportCloudsDialog::setMeshNormalKSearch(int k)
|
||||
{
|
||||
_ui->spinBox_normalKSearch->setValue(k);
|
||||
}
|
||||
void ExportCloudsDialog::setMeshGp3Radius(double radius)
|
||||
{
|
||||
_ui->doubleSpinBox_gp3Radius->setValue(radius);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ public:
|
||||
void setOkButton();
|
||||
void enableRegeneration(bool enabled);
|
||||
|
||||
//getters
|
||||
bool getAssemble() const;
|
||||
double getAssembleVoxel() const;
|
||||
bool getGenerate() const;
|
||||
@@ -60,6 +61,20 @@ public:
|
||||
int getMeshNormalKSearch() const;
|
||||
double getMeshGp3Radius() const;
|
||||
|
||||
//setters
|
||||
void setAssemble(bool on);
|
||||
void setAssembleVoxel(double voxel);
|
||||
void setGenerate(bool on);
|
||||
void setGenerateDecimation(int decimation);
|
||||
void setGenerateVoxel(double voxel);
|
||||
void setGenerateMaxDepth(double maxDepth);
|
||||
void setBinaryFile(bool on);
|
||||
void setMLS(bool on);
|
||||
void setMLSRadius(double radius);
|
||||
void setMesh(bool on);
|
||||
void setMeshNormalKSearch(int k);
|
||||
void setMeshGp3Radius(double radius);
|
||||
|
||||
private:
|
||||
Ui_ExportCloudsDialog * _ui;
|
||||
};
|
||||
|
||||
@@ -141,7 +141,9 @@ MainWindow::MainWindow(PreferencesDialog * prefDialog, QWidget * parent) :
|
||||
// Create dialogs
|
||||
_aboutDialog = new AboutDialog(this);
|
||||
_exportDialog = new ExportCloudsDialog(this);
|
||||
_exportDialog->setObjectName("ExportCloudsDialog");
|
||||
_postProcessingDialog = new PostProcessingDialog(this);
|
||||
_postProcessingDialog->setObjectName("PostProcessingDialog");
|
||||
|
||||
_ui = new Ui_mainWindow();
|
||||
_ui->setupUi(this);
|
||||
@@ -196,9 +198,9 @@ MainWindow::MainWindow(PreferencesDialog * prefDialog, QWidget * parent) :
|
||||
_ui->imageView_source->setBackgroundBrush(QBrush(Qt::black));
|
||||
_ui->imageView_loopClosure->setBackgroundBrush(QBrush(Qt::black));
|
||||
_ui->imageView_odometry->setBackgroundBrush(QBrush(Qt::black));
|
||||
_preferencesDialog->loadImageViewState(_ui->imageView_source->objectName(), _ui->imageView_source);
|
||||
_preferencesDialog->loadImageViewState(_ui->imageView_loopClosure->objectName(), _ui->imageView_loopClosure);
|
||||
_preferencesDialog->loadImageViewState(_ui->imageView_odometry->objectName(), _ui->imageView_odometry);
|
||||
_preferencesDialog->loadWidgetState(_ui->imageView_source->objectName(), _ui->imageView_source);
|
||||
_preferencesDialog->loadWidgetState(_ui->imageView_loopClosure->objectName(), _ui->imageView_loopClosure);
|
||||
_preferencesDialog->loadWidgetState(_ui->imageView_odometry->objectName(), _ui->imageView_odometry);
|
||||
|
||||
_posteriorCurve = new PdfPlotCurve("Posterior", &_cachedSignatures, this);
|
||||
_ui->posteriorPlot->addCurve(_posteriorCurve, false);
|
||||
@@ -373,7 +375,11 @@ MainWindow::MainWindow(PreferencesDialog * prefDialog, QWidget * parent) :
|
||||
_ui->statsToolBox->setWorkingDirectory(_preferencesDialog->getWorkingDirectory());
|
||||
_ui->graphicsView_graphView->setWorkingDirectory(_preferencesDialog->getWorkingDirectory());
|
||||
_ui->widget_cloudViewer->setWorkingDirectory(_preferencesDialog->getWorkingDirectory());
|
||||
_preferencesDialog->loadCloudViewerState(_ui->widget_cloudViewer->objectName(), _ui->widget_cloudViewer);
|
||||
_preferencesDialog->loadWidgetState(_ui->widget_cloudViewer->objectName(), _ui->widget_cloudViewer);
|
||||
|
||||
//dialog states
|
||||
_preferencesDialog->loadWidgetState(_exportDialog->objectName(), _exportDialog);
|
||||
_preferencesDialog->loadWidgetState(_postProcessingDialog->objectName(), _postProcessingDialog);
|
||||
|
||||
if(_ui->statsToolBox->findChildren<StatItem*>().size() == 0)
|
||||
{
|
||||
@@ -452,11 +458,12 @@ void MainWindow::closeEvent(QCloseEvent* event)
|
||||
|
||||
//write settings before quit?
|
||||
_preferencesDialog->saveMainWindowState(this);
|
||||
_preferencesDialog->saveCloudViewerState(_ui->widget_cloudViewer->objectName(), _ui->widget_cloudViewer);
|
||||
_preferencesDialog->saveImageViewState(_ui->imageView_source->objectName(), _ui->imageView_source);
|
||||
_preferencesDialog->saveImageViewState(_ui->imageView_loopClosure->objectName(), _ui->imageView_loopClosure);
|
||||
_preferencesDialog->saveImageViewState(_ui->imageView_odometry->objectName(), _ui->imageView_odometry);
|
||||
|
||||
_preferencesDialog->saveWidgetState(_ui->widget_cloudViewer->objectName(), _ui->widget_cloudViewer);
|
||||
_preferencesDialog->saveWidgetState(_ui->imageView_source->objectName(), _ui->imageView_source);
|
||||
_preferencesDialog->saveWidgetState(_ui->imageView_loopClosure->objectName(), _ui->imageView_loopClosure);
|
||||
_preferencesDialog->saveWidgetState(_ui->imageView_odometry->objectName(), _ui->imageView_odometry);
|
||||
_preferencesDialog->saveWidgetState(_exportDialog->objectName(), _exportDialog);
|
||||
_preferencesDialog->saveWidgetState(_postProcessingDialog->objectName(), _postProcessingDialog);
|
||||
_ui->dockWidget_imageView->close();
|
||||
_ui->dockWidget_likelihood->close();
|
||||
_ui->dockWidget_rawlikelihood->close();
|
||||
@@ -3111,7 +3118,9 @@ void MainWindow::postProcessing()
|
||||
}
|
||||
else
|
||||
{
|
||||
UWARN("Cannot refine link %d->%d (converged=%s variance=%f)", from, to, hasConverged?"true":"false", variance);
|
||||
QString str = tr("Cannot refine link %1->%2 (converged=%3 variance=%4 correspondencesRatio=%5 (ref=%6))").arg(from).arg(to).arg(hasConverged?"true":"false").arg(variance).arg(correspondencesRatio).arg(correspondenceRatio);
|
||||
_initProgressDialog->appendText(str, Qt::darkYellow);
|
||||
UWARN("%s", str.toStdString().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,4 +89,34 @@ bool PostProcessingDialog::isRefineLoopClosureLinks() const
|
||||
return _ui->refineLoopClosureLinks->isChecked();
|
||||
}
|
||||
|
||||
//setters
|
||||
void PostProcessingDialog::setDetectMoreLoopClosures(bool on)
|
||||
{
|
||||
_ui->detectMoreLoopClosures->setChecked(on);
|
||||
}
|
||||
void PostProcessingDialog::setClusterRadius(double radius)
|
||||
{
|
||||
_ui->clusterRadius->setValue(radius);
|
||||
}
|
||||
void PostProcessingDialog::setClusterAngle(double angle)
|
||||
{
|
||||
_ui->clusterAngle->setValue(angle);
|
||||
}
|
||||
void PostProcessingDialog::setIterations(int iterations)
|
||||
{
|
||||
_ui->iterations->setValue(iterations);
|
||||
}
|
||||
void PostProcessingDialog::setReextractFeatures(bool on)
|
||||
{
|
||||
_ui->reextractFeatures->setChecked(on);
|
||||
}
|
||||
void PostProcessingDialog::setRefineNeighborLinks(bool on)
|
||||
{
|
||||
_ui->refineNeighborLinks->setChecked(on);
|
||||
}
|
||||
void PostProcessingDialog::setRefineLoopClosureLinks(bool on)
|
||||
{
|
||||
_ui->refineLoopClosureLinks->setChecked(on);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ public:
|
||||
|
||||
virtual ~PostProcessingDialog();
|
||||
|
||||
//getters
|
||||
bool isDetectMoreLoopClosures() const;
|
||||
double clusterRadius() const;
|
||||
double clusterAngle() const;
|
||||
@@ -51,6 +52,15 @@ public:
|
||||
bool isRefineNeighborLinks() const;
|
||||
bool isRefineLoopClosureLinks() const;
|
||||
|
||||
//setters
|
||||
void setDetectMoreLoopClosures(bool on);
|
||||
void setClusterRadius(double radius);
|
||||
void setClusterAngle(double angle);
|
||||
void setIterations(int iterations);
|
||||
void setReextractFeatures(bool on);
|
||||
void setRefineNeighborLinks(bool on);
|
||||
void setRefineLoopClosureLinks(bool on);
|
||||
|
||||
private slots:
|
||||
void updateButtonBox();
|
||||
|
||||
|
||||
@@ -59,6 +59,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "rtabmap/gui/DataRecorder.h"
|
||||
#include "rtabmap/gui/CloudViewer.h"
|
||||
#include "rtabmap/gui/ImageView.h"
|
||||
#include "ExportCloudsDialog.h"
|
||||
#include "PostProcessingDialog.h"
|
||||
|
||||
#include <rtabmap/utilite/ULogger.h>
|
||||
#include <rtabmap/utilite/UConversion.h>
|
||||
@@ -1690,120 +1692,178 @@ void PreferencesDialog::loadMainWindowState(QMainWindow * mainWindow)
|
||||
loadWindowGeometry("MainWindow", mainWindow);
|
||||
}
|
||||
|
||||
void PreferencesDialog::saveCloudViewerState(const QString & name, const CloudViewer * viewer)
|
||||
void PreferencesDialog::saveWidgetState(const QString & name, const QWidget * widget)
|
||||
{
|
||||
QSettings settings(getIniFilePath(), QSettings::IniFormat);
|
||||
settings.beginGroup("Gui");
|
||||
settings.beginGroup(name);
|
||||
|
||||
float poseX, poseY, poseZ, focalX, focalY, focalZ, upX, upY, upZ;
|
||||
viewer->getCameraPosition(poseX, poseY, poseZ, focalX, focalY, focalZ, upX, upY, upZ);
|
||||
QVector3D pose(poseX, poseY, poseZ);
|
||||
QVector3D focal(focalX, focalY, focalZ);
|
||||
if(!viewer->isCameraFree())
|
||||
const CloudViewer * cloudViewer = qobject_cast<const CloudViewer*>(widget);
|
||||
const ImageView * imageView = qobject_cast<const ImageView*>(widget);
|
||||
const ExportCloudsDialog * exportCloudsDialog = qobject_cast<const ExportCloudsDialog*>(widget);
|
||||
const PostProcessingDialog * postProcessingDialog = qobject_cast<const PostProcessingDialog *>(widget);
|
||||
|
||||
if(cloudViewer)
|
||||
{
|
||||
// make camera position relative to target
|
||||
Transform T = viewer->getTargetPose();
|
||||
if(viewer->isCameraTargetLocked())
|
||||
float poseX, poseY, poseZ, focalX, focalY, focalZ, upX, upY, upZ;
|
||||
cloudViewer->getCameraPosition(poseX, poseY, poseZ, focalX, focalY, focalZ, upX, upY, upZ);
|
||||
QVector3D pose(poseX, poseY, poseZ);
|
||||
QVector3D focal(focalX, focalY, focalZ);
|
||||
if(!cloudViewer->isCameraFree())
|
||||
{
|
||||
T = Transform(T.x(), T.y(), T.z(), 0,0,0);
|
||||
// make camera position relative to target
|
||||
Transform T = cloudViewer->getTargetPose();
|
||||
if(cloudViewer->isCameraTargetLocked())
|
||||
{
|
||||
T = Transform(T.x(), T.y(), T.z(), 0,0,0);
|
||||
}
|
||||
Transform F(focalX, focalY, focalZ, 0,0,0);
|
||||
Transform P(poseX, poseY, poseZ, 0,0,0);
|
||||
Transform newFocal = T.inverse() * F;
|
||||
Transform newPose = newFocal * F.inverse() * P;
|
||||
pose = QVector3D(newPose.x(), newPose.y(), newPose.z());
|
||||
focal = QVector3D(newFocal.x(), newFocal.y(), newFocal.z());
|
||||
}
|
||||
Transform F(focalX, focalY, focalZ, 0,0,0);
|
||||
Transform P(poseX, poseY, poseZ, 0,0,0);
|
||||
Transform newFocal = T.inverse() * F;
|
||||
Transform newPose = newFocal * F.inverse() * P;
|
||||
pose = QVector3D(newPose.x(), newPose.y(), newPose.z());
|
||||
focal = QVector3D(newFocal.x(), newFocal.y(), newFocal.z());
|
||||
settings.setValue("camera_pose", pose);
|
||||
settings.setValue("camera_focal", focal);
|
||||
settings.setValue("camera_up", QVector3D(upX, upY, upZ));
|
||||
|
||||
settings.setValue("grid", cloudViewer->isGridShown());
|
||||
settings.setValue("grid_cell_count", cloudViewer->getGridCellCount());
|
||||
settings.setValue("grid_cell_size", cloudViewer->getGridCellSize());
|
||||
|
||||
settings.setValue("trajectory_shown", cloudViewer->isTrajectoryShown());
|
||||
settings.setValue("trajectory_size", cloudViewer->getTrajectorySize());
|
||||
|
||||
settings.setValue("camera_target_locked", cloudViewer->isCameraTargetLocked());
|
||||
settings.setValue("camera_target_follow", cloudViewer->isCameraTargetFollow());
|
||||
settings.setValue("camera_free", cloudViewer->isCameraFree());
|
||||
settings.setValue("camera_lockZ", cloudViewer->isCameraLockZ());
|
||||
|
||||
settings.setValue("bg_color", cloudViewer->getBackgroundColor());
|
||||
}
|
||||
settings.setValue("camera_pose", pose);
|
||||
settings.setValue("camera_focal", focal);
|
||||
settings.setValue("camera_up", QVector3D(upX, upY, upZ));
|
||||
|
||||
settings.setValue("grid", viewer->isGridShown());
|
||||
settings.setValue("grid_cell_count", viewer->getGridCellCount());
|
||||
settings.setValue("grid_cell_size", viewer->getGridCellSize());
|
||||
|
||||
settings.setValue("trajectory_shown", viewer->isTrajectoryShown());
|
||||
settings.setValue("trajectory_size", viewer->getTrajectorySize());
|
||||
|
||||
settings.setValue("camera_target_locked", viewer->isCameraTargetLocked());
|
||||
settings.setValue("camera_target_follow", viewer->isCameraTargetFollow());
|
||||
settings.setValue("camera_free", viewer->isCameraFree());
|
||||
settings.setValue("camera_lockZ", viewer->isCameraLockZ());
|
||||
|
||||
settings.setValue("bg_color", viewer->getBackgroundColor());
|
||||
|
||||
settings.endGroup(); // "name"
|
||||
settings.endGroup(); // Gui
|
||||
}
|
||||
|
||||
void PreferencesDialog::loadCloudViewerState(const QString & name, CloudViewer * viewer)
|
||||
{
|
||||
QByteArray bytes;
|
||||
QSettings settings(getIniFilePath(), QSettings::IniFormat);
|
||||
settings.beginGroup("Gui");
|
||||
settings.beginGroup(name);
|
||||
|
||||
float poseX, poseY, poseZ, focalX, focalY, focalZ, upX, upY, upZ;
|
||||
viewer->getCameraPosition(poseX, poseY, poseZ, focalX, focalY, focalZ, upX, upY, upZ);
|
||||
QVector3D pose(poseX, poseY, poseZ), focal(focalX, focalY, focalZ), up(upX, upY, upZ);
|
||||
pose = settings.value("camera_pose", pose).value<QVector3D>();
|
||||
focal = settings.value("camera_focal", focal).value<QVector3D>();
|
||||
up = settings.value("camera_up", up).value<QVector3D>();
|
||||
viewer->setCameraPosition(pose.x(),pose.y(),pose.z(), focal.x(),focal.y(),focal.z(), up.x(),up.y(),up.z());
|
||||
|
||||
viewer->setGridShown(settings.value("grid", viewer->isGridShown()).toBool());
|
||||
viewer->setGridCellCount(settings.value("grid_cell_count", viewer->getGridCellCount()).toInt());
|
||||
viewer->setGridCellSize(settings.value("grid_cell_size", viewer->getGridCellSize()).toFloat());
|
||||
|
||||
viewer->setTrajectoryShown(settings.value("trajectory_shown", viewer->isTrajectoryShown()).toBool());
|
||||
viewer->setTrajectorySize(settings.value("trajectory_size", viewer->getTrajectorySize()).toInt());
|
||||
|
||||
viewer->setCameraTargetLocked(settings.value("camera_target_locked", viewer->isCameraTargetLocked()).toBool());
|
||||
viewer->setCameraTargetFollow(settings.value("camera_target_follow", viewer->isCameraTargetFollow()).toBool());
|
||||
if(settings.value("camera_free", viewer->isCameraFree()).toBool())
|
||||
else if(imageView)
|
||||
{
|
||||
viewer->setCameraFree();
|
||||
settings.setValue("image_shown", imageView->isImageShown());
|
||||
settings.setValue("depth_shown", imageView->isImageDepthShown());
|
||||
settings.setValue("features_shown", imageView->isFeaturesShown());
|
||||
settings.setValue("lines_shown", imageView->isLinesShown());
|
||||
}
|
||||
else if(exportCloudsDialog)
|
||||
{
|
||||
settings.setValue("assemble", exportCloudsDialog->getAssemble());
|
||||
settings.setValue("assemble_voxel", exportCloudsDialog->getAssembleVoxel());
|
||||
settings.setValue("regenerate", exportCloudsDialog->getGenerate());
|
||||
settings.setValue("regenerate_decimation", exportCloudsDialog->getGenerateDecimation());
|
||||
settings.setValue("regenerate_voxel", exportCloudsDialog->getGenerateVoxel());
|
||||
settings.setValue("regenerate_max_depth", exportCloudsDialog->getGenerateMaxDepth());
|
||||
settings.setValue("binary", exportCloudsDialog->getBinaryFile());
|
||||
settings.setValue("mls", exportCloudsDialog->getMLS());
|
||||
settings.setValue("mls_radius", exportCloudsDialog->getMLSRadius());
|
||||
settings.setValue("mesh", exportCloudsDialog->getMesh());
|
||||
settings.setValue("mesh_k", exportCloudsDialog->getMeshNormalKSearch());
|
||||
settings.setValue("mesh_radius", exportCloudsDialog->getMeshGp3Radius());
|
||||
}
|
||||
else if(postProcessingDialog)
|
||||
{
|
||||
settings.setValue("detect_more_lc", postProcessingDialog->isDetectMoreLoopClosures());
|
||||
settings.setValue("cluster_radius", postProcessingDialog->clusterRadius());
|
||||
settings.setValue("cluster_angle", postProcessingDialog->clusterAngle());
|
||||
settings.setValue("iterations", postProcessingDialog->iterations());
|
||||
settings.setValue("reextract_features", postProcessingDialog->isReextractFeatures());
|
||||
settings.setValue("refine_neigbors", postProcessingDialog->isRefineNeighborLinks());
|
||||
settings.setValue("refine_lc", postProcessingDialog->isRefineLoopClosureLinks());
|
||||
}
|
||||
else
|
||||
{
|
||||
UERROR("Widget \"%s\" cannot be exported in config file.", widget->objectName().toStdString().c_str());
|
||||
}
|
||||
viewer->setCameraLockZ(settings.value("camera_lockZ", viewer->isCameraLockZ()).toBool());
|
||||
|
||||
viewer->setBackgroundColor(settings.value("bg_color", viewer->getBackgroundColor()).value<QColor>());
|
||||
|
||||
settings.endGroup(); //"name"
|
||||
settings.endGroup(); // Gui
|
||||
}
|
||||
|
||||
void PreferencesDialog::saveImageViewState(const QString & name, const ImageView * view)
|
||||
{
|
||||
QSettings settings(getIniFilePath(), QSettings::IniFormat);
|
||||
settings.beginGroup("Gui");
|
||||
settings.beginGroup(name);
|
||||
|
||||
settings.setValue("image_shown", view->isImageShown());
|
||||
settings.setValue("depth_shown", view->isImageDepthShown());
|
||||
settings.setValue("features_shown", view->isFeaturesShown());
|
||||
settings.setValue("lines_shown", view->isLinesShown());
|
||||
|
||||
settings.endGroup(); // "name"
|
||||
settings.endGroup(); // Gui
|
||||
}
|
||||
|
||||
void PreferencesDialog::loadImageViewState(const QString & name, ImageView * view)
|
||||
void PreferencesDialog::loadWidgetState(const QString & name, QWidget * widget)
|
||||
{
|
||||
QByteArray bytes;
|
||||
QSettings settings(getIniFilePath(), QSettings::IniFormat);
|
||||
settings.beginGroup("Gui");
|
||||
settings.beginGroup(name);
|
||||
|
||||
view->setImageShown(settings.value("image_shown", view->isImageShown()).toBool());
|
||||
view->setImageDepthShown(settings.value("depth_shown", view->isImageDepthShown()).toBool());
|
||||
view->setFeaturesShown(settings.value("features_shown", view->isFeaturesShown()).toBool());
|
||||
view->setLinesShown(settings.value("lines_shown", view->isLinesShown()).toBool());
|
||||
CloudViewer * cloudViewer = qobject_cast<CloudViewer*>(widget);
|
||||
ImageView * imageView = qobject_cast<ImageView*>(widget);
|
||||
ExportCloudsDialog * exportCloudsDialog = qobject_cast<ExportCloudsDialog*>(widget);
|
||||
PostProcessingDialog * postProcessingDialog = qobject_cast<PostProcessingDialog *>(widget);
|
||||
|
||||
if(cloudViewer)
|
||||
{
|
||||
float poseX, poseY, poseZ, focalX, focalY, focalZ, upX, upY, upZ;
|
||||
cloudViewer->getCameraPosition(poseX, poseY, poseZ, focalX, focalY, focalZ, upX, upY, upZ);
|
||||
QVector3D pose(poseX, poseY, poseZ), focal(focalX, focalY, focalZ), up(upX, upY, upZ);
|
||||
pose = settings.value("camera_pose", pose).value<QVector3D>();
|
||||
focal = settings.value("camera_focal", focal).value<QVector3D>();
|
||||
up = settings.value("camera_up", up).value<QVector3D>();
|
||||
cloudViewer->setCameraPosition(pose.x(),pose.y(),pose.z(), focal.x(),focal.y(),focal.z(), up.x(),up.y(),up.z());
|
||||
|
||||
cloudViewer->setGridShown(settings.value("grid", cloudViewer->isGridShown()).toBool());
|
||||
cloudViewer->setGridCellCount(settings.value("grid_cell_count", cloudViewer->getGridCellCount()).toUInt());
|
||||
cloudViewer->setGridCellSize(settings.value("grid_cell_size", cloudViewer->getGridCellSize()).toFloat());
|
||||
|
||||
cloudViewer->setTrajectoryShown(settings.value("trajectory_shown", cloudViewer->isTrajectoryShown()).toBool());
|
||||
cloudViewer->setTrajectorySize(settings.value("trajectory_size", cloudViewer->getTrajectorySize()).toUInt());
|
||||
|
||||
cloudViewer->setCameraTargetLocked(settings.value("camera_target_locked", cloudViewer->isCameraTargetLocked()).toBool());
|
||||
cloudViewer->setCameraTargetFollow(settings.value("camera_target_follow", cloudViewer->isCameraTargetFollow()).toBool());
|
||||
if(settings.value("camera_free", cloudViewer->isCameraFree()).toBool())
|
||||
{
|
||||
cloudViewer->setCameraFree();
|
||||
}
|
||||
cloudViewer->setCameraLockZ(settings.value("camera_lockZ", cloudViewer->isCameraLockZ()).toBool());
|
||||
|
||||
cloudViewer->setBackgroundColor(settings.value("bg_color", cloudViewer->getBackgroundColor()).value<QColor>());
|
||||
}
|
||||
else if(imageView)
|
||||
{
|
||||
imageView->setImageShown(settings.value("image_shown", imageView->isImageShown()).toBool());
|
||||
imageView->setImageDepthShown(settings.value("depth_shown", imageView->isImageDepthShown()).toBool());
|
||||
imageView->setFeaturesShown(settings.value("features_shown", imageView->isFeaturesShown()).toBool());
|
||||
imageView->setLinesShown(settings.value("lines_shown", imageView->isLinesShown()).toBool());
|
||||
}
|
||||
else if(exportCloudsDialog)
|
||||
{
|
||||
exportCloudsDialog->setAssemble(settings.value("assemble", exportCloudsDialog->getAssemble()).toBool());
|
||||
exportCloudsDialog->setAssembleVoxel(settings.value("assemble_voxel", exportCloudsDialog->getAssembleVoxel()).toDouble());
|
||||
exportCloudsDialog->setGenerate(settings.value("regenerate", exportCloudsDialog->getGenerate()).toBool());
|
||||
exportCloudsDialog->setGenerateDecimation(settings.value("regenerate_decimation", exportCloudsDialog->getGenerateDecimation()).toInt());
|
||||
exportCloudsDialog->setGenerateVoxel(settings.value("regenerate_voxel", exportCloudsDialog->getGenerateVoxel()).toDouble());
|
||||
exportCloudsDialog->setGenerateMaxDepth(settings.value("regenerate_max_depth", exportCloudsDialog->getGenerateMaxDepth()).toDouble());
|
||||
exportCloudsDialog->setBinaryFile(settings.value("binary", exportCloudsDialog->getBinaryFile()).toBool());
|
||||
exportCloudsDialog->setMLS(settings.value("mls", exportCloudsDialog->getMLS()).toBool());
|
||||
exportCloudsDialog->setMLSRadius(settings.value("mls_radius", exportCloudsDialog->getMLSRadius()).toDouble());
|
||||
exportCloudsDialog->setMesh(settings.value("mesh", exportCloudsDialog->getMesh()).toBool());
|
||||
exportCloudsDialog->setMeshNormalKSearch(settings.value("mesh_k", exportCloudsDialog->getMeshNormalKSearch()).toInt());
|
||||
exportCloudsDialog->setMeshGp3Radius(settings.value("mesh_radius", exportCloudsDialog->getMeshGp3Radius()).toDouble());
|
||||
}
|
||||
else if(postProcessingDialog)
|
||||
{
|
||||
postProcessingDialog->setDetectMoreLoopClosures(settings.value("detect_more_lc", postProcessingDialog->isDetectMoreLoopClosures()).toBool());
|
||||
postProcessingDialog->setClusterRadius(settings.value("cluster_radius", postProcessingDialog->clusterRadius()).toDouble());
|
||||
postProcessingDialog->setClusterAngle(settings.value("cluster_angle", postProcessingDialog->clusterAngle()).toDouble());
|
||||
postProcessingDialog->setIterations(settings.value("iterations", postProcessingDialog->iterations()).toInt());
|
||||
postProcessingDialog->setReextractFeatures(settings.value("reextract_features", postProcessingDialog->isReextractFeatures()).toBool());
|
||||
postProcessingDialog->setRefineNeighborLinks(settings.value("refine_neigbors", postProcessingDialog->isRefineNeighborLinks()).toBool());
|
||||
postProcessingDialog->setRefineLoopClosureLinks(settings.value("refine_lc", postProcessingDialog->isRefineLoopClosureLinks()).toBool());
|
||||
}
|
||||
else
|
||||
{
|
||||
UERROR("Widget \"%s\" cannot be loaded from config file.", widget->objectName().toStdString().c_str());
|
||||
}
|
||||
|
||||
settings.endGroup(); //"name"
|
||||
settings.endGroup(); // Gui
|
||||
}
|
||||
|
||||
|
||||
void PreferencesDialog::saveCustomConfig(const QString & section, const QString & key, const QString & value)
|
||||
{
|
||||
QSettings settings(getIniFilePath(), QSettings::IniFormat);
|
||||
|
||||
Reference in New Issue
Block a user