mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-04 16:57:46 +08:00
Export dialog keeps last config. Updated "clear the cache" to remove all visible images/trajectory/background color.
git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@1811 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
@@ -127,6 +127,7 @@ public:
|
|||||||
|
|
||||||
void setTrajectoryShown(bool shown);
|
void setTrajectoryShown(bool shown);
|
||||||
void setTrajectorySize(int value);
|
void setTrajectorySize(int value);
|
||||||
|
void clearTrajectory();
|
||||||
|
|
||||||
void removeAllClouds(); //including meshes
|
void removeAllClouds(); //including meshes
|
||||||
bool removeCloud(const std::string & id); //including mesh
|
bool removeCloud(const std::string & id); //including mesh
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ class PdfPlotCurve;
|
|||||||
class StatsToolBox;
|
class StatsToolBox;
|
||||||
class DetailedProgressDialog;
|
class DetailedProgressDialog;
|
||||||
class TwistGridWidget;
|
class TwistGridWidget;
|
||||||
|
class ExportCloudsDialog;
|
||||||
|
|
||||||
class RTABMAPGUI_EXP MainWindow : public QMainWindow, public UEventsHandler
|
class RTABMAPGUI_EXP MainWindow : public QMainWindow, public UEventsHandler
|
||||||
{
|
{
|
||||||
@@ -240,6 +241,7 @@ private:
|
|||||||
//Dialogs
|
//Dialogs
|
||||||
PreferencesDialog * _preferencesDialog;
|
PreferencesDialog * _preferencesDialog;
|
||||||
AboutDialog * _aboutDialog;
|
AboutDialog * _aboutDialog;
|
||||||
|
ExportCloudsDialog * _exportDialog;
|
||||||
|
|
||||||
QSet<int> _lastIds;
|
QSet<int> _lastIds;
|
||||||
int _lastId;
|
int _lastId;
|
||||||
|
|||||||
@@ -429,6 +429,13 @@ void CloudViewer::setTrajectorySize(int value)
|
|||||||
_maxTrajectorySize = value;
|
_maxTrajectorySize = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CloudViewer::clearTrajectory()
|
||||||
|
{
|
||||||
|
_trajectory->clear();
|
||||||
|
_visualizer->removeShape("trajectory");
|
||||||
|
this->render();
|
||||||
|
}
|
||||||
|
|
||||||
void CloudViewer::removeAllClouds()
|
void CloudViewer::removeAllClouds()
|
||||||
{
|
{
|
||||||
_addedClouds.clear();
|
_addedClouds.clear();
|
||||||
@@ -877,9 +884,7 @@ void CloudViewer::handleAction(QAction * a)
|
|||||||
}
|
}
|
||||||
else if(a == _aClearTrajectory)
|
else if(a == _aClearTrajectory)
|
||||||
{
|
{
|
||||||
_trajectory->clear();
|
this->clearTrajectory();
|
||||||
_visualizer->removeShape("trajectory");
|
|
||||||
this->render();
|
|
||||||
}
|
}
|
||||||
else if(a == _aResetCamera)
|
else if(a == _aResetCamera)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,15 +32,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
namespace rtabmap {
|
namespace rtabmap {
|
||||||
|
|
||||||
ExportCloudsDialog::ExportCloudsDialog(QWidget *parent, bool toSave) :
|
ExportCloudsDialog::ExportCloudsDialog(QWidget *parent) :
|
||||||
QDialog(parent)
|
QDialog(parent)
|
||||||
{
|
{
|
||||||
_ui = new Ui_ExportCloudsDialog();
|
_ui = new Ui_ExportCloudsDialog();
|
||||||
_ui->setupUi(this);
|
_ui->setupUi(this);
|
||||||
if(toSave)
|
|
||||||
{
|
|
||||||
_ui->buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Save);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ExportCloudsDialog::~ExportCloudsDialog()
|
ExportCloudsDialog::~ExportCloudsDialog()
|
||||||
@@ -48,6 +44,16 @@ ExportCloudsDialog::~ExportCloudsDialog()
|
|||||||
delete _ui;
|
delete _ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ExportCloudsDialog::setSaveButton()
|
||||||
|
{
|
||||||
|
_ui->buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Save);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ExportCloudsDialog::setOkButton()
|
||||||
|
{
|
||||||
|
_ui->buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
||||||
|
}
|
||||||
|
|
||||||
bool ExportCloudsDialog::getAssemble() const
|
bool ExportCloudsDialog::getAssemble() const
|
||||||
{
|
{
|
||||||
return _ui->groupBox_assemble->isChecked();
|
return _ui->groupBox_assemble->isChecked();
|
||||||
|
|||||||
@@ -39,10 +39,13 @@ class ExportCloudsDialog : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ExportCloudsDialog(QWidget *parent = 0, bool toSave = false);
|
ExportCloudsDialog(QWidget *parent = 0);
|
||||||
|
|
||||||
virtual ~ExportCloudsDialog();
|
virtual ~ExportCloudsDialog();
|
||||||
|
|
||||||
|
void setSaveButton();
|
||||||
|
void setOkButton();
|
||||||
|
|
||||||
bool getAssemble() const;
|
bool getAssemble() const;
|
||||||
double getAssembleVoxel() const;
|
double getAssembleVoxel() const;
|
||||||
bool getGenerate() const;
|
bool getGenerate() const;
|
||||||
|
|||||||
+46
-25
@@ -110,6 +110,7 @@ MainWindow::MainWindow(PreferencesDialog * prefDialog, QWidget * parent) :
|
|||||||
_srcType(kSrcUndefined),
|
_srcType(kSrcUndefined),
|
||||||
_preferencesDialog(0),
|
_preferencesDialog(0),
|
||||||
_aboutDialog(0),
|
_aboutDialog(0),
|
||||||
|
_exportDialog(0),
|
||||||
_lastId(0),
|
_lastId(0),
|
||||||
_processingStatistics(false),
|
_processingStatistics(false),
|
||||||
_odometryReceived(false),
|
_odometryReceived(false),
|
||||||
@@ -134,6 +135,7 @@ MainWindow::MainWindow(PreferencesDialog * prefDialog, QWidget * parent) :
|
|||||||
|
|
||||||
// Create dialogs
|
// Create dialogs
|
||||||
_aboutDialog = new AboutDialog(this);
|
_aboutDialog = new AboutDialog(this);
|
||||||
|
_exportDialog = new ExportCloudsDialog(this);
|
||||||
|
|
||||||
_ui = new Ui_mainWindow();
|
_ui = new Ui_mainWindow();
|
||||||
_ui->setupUi(this);
|
_ui->setupUi(this);
|
||||||
@@ -2717,7 +2719,8 @@ void MainWindow::clearTheCache()
|
|||||||
_createdClouds.clear();
|
_createdClouds.clear();
|
||||||
_createdScans.clear();
|
_createdScans.clear();
|
||||||
_ui->widget_cloudViewer->removeAllClouds();
|
_ui->widget_cloudViewer->removeAllClouds();
|
||||||
_ui->widget_cloudViewer->render();
|
_ui->widget_cloudViewer->setBackgroundColor(Qt::black);
|
||||||
|
_ui->widget_cloudViewer->clearTrajectory();
|
||||||
_currentPosesMap.clear();
|
_currentPosesMap.clear();
|
||||||
_odometryCorrection = Transform::getIdentity();
|
_odometryCorrection = Transform::getIdentity();
|
||||||
_lastOdomPose.setNull();
|
_lastOdomPose.setNull();
|
||||||
@@ -2737,7 +2740,15 @@ void MainWindow::clearTheCache()
|
|||||||
_ui->label_stats_loopClosuresRejected->setText("0");
|
_ui->label_stats_loopClosuresRejected->setText("0");
|
||||||
_refIds.clear();
|
_refIds.clear();
|
||||||
_loopClosureIds.clear();
|
_loopClosureIds.clear();
|
||||||
|
_ui->label_refId->clear();
|
||||||
|
_ui->label_matchId->clear();
|
||||||
_ui->graphicsView_graphView->clearAll();
|
_ui->graphicsView_graphView->clearAll();
|
||||||
|
_ui->imageView_source->clear();
|
||||||
|
_ui->imageView_loopClosure->clear();
|
||||||
|
_ui->imageView_source->resetTransform();
|
||||||
|
_ui->imageView_loopClosure->resetTransform();
|
||||||
|
_ui->imageView_source->setBackgroundBrush(QBrush(Qt::black));
|
||||||
|
_ui->imageView_loopClosure->setBackgroundBrush(QBrush(Qt::black));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateElapsedTime()
|
void MainWindow::updateElapsedTime()
|
||||||
@@ -3216,27 +3227,37 @@ bool MainWindow::getExportedClouds(
|
|||||||
std::map<int, pcl::PolygonMesh::Ptr> & meshes,
|
std::map<int, pcl::PolygonMesh::Ptr> & meshes,
|
||||||
bool toSave)
|
bool toSave)
|
||||||
{
|
{
|
||||||
ExportCloudsDialog * dialog = new ExportCloudsDialog(this, toSave);
|
if(_exportDialog->isVisible())
|
||||||
|
{
|
||||||
if(dialog->exec() == QDialog::Accepted)
|
return false;
|
||||||
|
}
|
||||||
|
if(toSave)
|
||||||
|
{
|
||||||
|
_exportDialog->setSaveButton();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_exportDialog->setOkButton();
|
||||||
|
}
|
||||||
|
if(_exportDialog->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
std::map<int, Transform> poses = _ui->widget_mapVisibility->getVisiblePoses();
|
std::map<int, Transform> poses = _ui->widget_mapVisibility->getVisiblePoses();
|
||||||
|
|
||||||
_initProgressDialog->setAutoClose(true, 1);
|
_initProgressDialog->setAutoClose(true, 1);
|
||||||
_initProgressDialog->resetProgress();
|
_initProgressDialog->resetProgress();
|
||||||
_initProgressDialog->show();
|
_initProgressDialog->show();
|
||||||
int mul = dialog->getMesh()&&!dialog->getGenerate()?3:dialog->getMLS()&&!dialog->getGenerate()?2:1;
|
int mul = _exportDialog->getMesh()&&!_exportDialog->getGenerate()?3:_exportDialog->getMLS()&&!_exportDialog->getGenerate()?2:1;
|
||||||
_initProgressDialog->setMaximumSteps(int(poses.size())*mul+1);
|
_initProgressDialog->setMaximumSteps(int(poses.size())*mul+1);
|
||||||
|
|
||||||
if(dialog->getAssemble())
|
if(_exportDialog->getAssemble())
|
||||||
{
|
{
|
||||||
pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud = this->getAssembledCloud(
|
pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud = this->getAssembledCloud(
|
||||||
poses,
|
poses,
|
||||||
dialog->getAssembleVoxel(),
|
_exportDialog->getAssembleVoxel(),
|
||||||
dialog->getGenerate(),
|
_exportDialog->getGenerate(),
|
||||||
dialog->getGenerateDecimation(),
|
_exportDialog->getGenerateDecimation(),
|
||||||
dialog->getGenerateVoxel(),
|
_exportDialog->getGenerateVoxel(),
|
||||||
dialog->getGenerateMaxDepth());
|
_exportDialog->getGenerateMaxDepth());
|
||||||
|
|
||||||
clouds.insert(std::make_pair(0, cloud));
|
clouds.insert(std::make_pair(0, cloud));
|
||||||
}
|
}
|
||||||
@@ -3244,48 +3265,48 @@ bool MainWindow::getExportedClouds(
|
|||||||
{
|
{
|
||||||
clouds = this->getClouds(
|
clouds = this->getClouds(
|
||||||
poses,
|
poses,
|
||||||
dialog->getGenerate(),
|
_exportDialog->getGenerate(),
|
||||||
dialog->getGenerateDecimation(),
|
_exportDialog->getGenerateDecimation(),
|
||||||
dialog->getGenerateVoxel(),
|
_exportDialog->getGenerateVoxel(),
|
||||||
dialog->getGenerateMaxDepth());
|
_exportDialog->getGenerateMaxDepth());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dialog->getMLS() || dialog->getMesh())
|
if(_exportDialog->getMLS() || _exportDialog->getMesh())
|
||||||
{
|
{
|
||||||
for(std::map<int, pcl::PointCloud<pcl::PointXYZRGB>::Ptr>::iterator iter=clouds.begin();
|
for(std::map<int, pcl::PointCloud<pcl::PointXYZRGB>::Ptr>::iterator iter=clouds.begin();
|
||||||
iter!= clouds.end();
|
iter!= clouds.end();
|
||||||
++iter)
|
++iter)
|
||||||
{
|
{
|
||||||
pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr cloudWithNormals;
|
pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr cloudWithNormals;
|
||||||
if(dialog->getMLS())
|
if(_exportDialog->getMLS())
|
||||||
{
|
{
|
||||||
_initProgressDialog->appendText(tr("Smoothing the surface of cloud %1 using Moving Least Squares (MLS) algorithm... "
|
_initProgressDialog->appendText(tr("Smoothing the surface of cloud %1 using Moving Least Squares (MLS) algorithm... "
|
||||||
"[search radius=%2m]").arg(iter->first).arg(dialog->getMLSRadius()));
|
"[search radius=%2m]").arg(iter->first).arg(_exportDialog->getMLSRadius()));
|
||||||
_initProgressDialog->incrementStep();
|
_initProgressDialog->incrementStep();
|
||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
|
|
||||||
cloudWithNormals = util3d::computeNormalsSmoothed(iter->second, (float)dialog->getMLSRadius());
|
cloudWithNormals = util3d::computeNormalsSmoothed(iter->second, (float)_exportDialog->getMLSRadius());
|
||||||
|
|
||||||
iter->second->clear();
|
iter->second->clear();
|
||||||
pcl::copyPointCloud(*cloudWithNormals, *iter->second);
|
pcl::copyPointCloud(*cloudWithNormals, *iter->second);
|
||||||
}
|
}
|
||||||
else if(dialog->getMesh())
|
else if(_exportDialog->getMesh())
|
||||||
{
|
{
|
||||||
_initProgressDialog->appendText(tr("Computing surface normals of cloud %1 (without smoothing)... "
|
_initProgressDialog->appendText(tr("Computing surface normals of cloud %1 (without smoothing)... "
|
||||||
"[K neighbors=%2]").arg(iter->first).arg(dialog->getMeshNormalKSearch()));
|
"[K neighbors=%2]").arg(iter->first).arg(_exportDialog->getMeshNormalKSearch()));
|
||||||
_initProgressDialog->incrementStep();
|
_initProgressDialog->incrementStep();
|
||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
|
|
||||||
cloudWithNormals = util3d::computeNormals(iter->second, dialog->getMeshNormalKSearch());
|
cloudWithNormals = util3d::computeNormals(iter->second, _exportDialog->getMeshNormalKSearch());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dialog->getMesh())
|
if(_exportDialog->getMesh())
|
||||||
{
|
{
|
||||||
_initProgressDialog->appendText(tr("Greedy projection triangulation... [radius=%1m]").arg(dialog->getMeshGp3Radius()));
|
_initProgressDialog->appendText(tr("Greedy projection triangulation... [radius=%1m]").arg(_exportDialog->getMeshGp3Radius()));
|
||||||
_initProgressDialog->incrementStep();
|
_initProgressDialog->incrementStep();
|
||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
|
|
||||||
pcl::PolygonMesh::Ptr mesh = util3d::createMesh(cloudWithNormals, dialog->getMeshGp3Radius());
|
pcl::PolygonMesh::Ptr mesh = util3d::createMesh(cloudWithNormals, _exportDialog->getMeshGp3Radius());
|
||||||
meshes.insert(std::make_pair(iter->first, mesh));
|
meshes.insert(std::make_pair(iter->first, mesh));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user