mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-03 01:50:24 +08:00
GUI: export clouds in binary mode by default
git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@2007 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
@@ -232,9 +232,9 @@ private:
|
|||||||
|
|
||||||
bool getExportedScans(std::map<int, pcl::PointCloud<pcl::PointXYZ>::Ptr > & scans);
|
bool getExportedScans(std::map<int, pcl::PointCloud<pcl::PointXYZ>::Ptr > & scans);
|
||||||
bool getExportedClouds(std::map<int, pcl::PointCloud<pcl::PointXYZRGB>::Ptr> & clouds, std::map<int, pcl::PolygonMesh::Ptr> & meshes, bool toSave);
|
bool getExportedClouds(std::map<int, pcl::PointCloud<pcl::PointXYZRGB>::Ptr> & clouds, std::map<int, pcl::PolygonMesh::Ptr> & meshes, bool toSave);
|
||||||
void saveClouds(const std::map<int, pcl::PointCloud<pcl::PointXYZRGB>::Ptr> & clouds);
|
void saveClouds(const std::map<int, pcl::PointCloud<pcl::PointXYZRGB>::Ptr> & clouds, bool binaryMode = true);
|
||||||
void saveMeshes(const std::map<int, pcl::PolygonMesh::Ptr> & meshes);
|
void saveMeshes(const std::map<int, pcl::PolygonMesh::Ptr> & meshes, bool binaryMode = true);
|
||||||
void saveScans(const std::map<int, pcl::PointCloud<pcl::PointXYZ>::Ptr> & clouds);
|
void saveScans(const std::map<int, pcl::PointCloud<pcl::PointXYZ>::Ptr> & clouds, bool binaryMode = true);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui_mainWindow * _ui;
|
Ui_mainWindow * _ui;
|
||||||
|
|||||||
@@ -47,11 +47,13 @@ ExportCloudsDialog::~ExportCloudsDialog()
|
|||||||
void ExportCloudsDialog::setSaveButton()
|
void ExportCloudsDialog::setSaveButton()
|
||||||
{
|
{
|
||||||
_ui->buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Save);
|
_ui->buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Save);
|
||||||
|
_ui->checkBox_binary->setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExportCloudsDialog::setOkButton()
|
void ExportCloudsDialog::setOkButton()
|
||||||
{
|
{
|
||||||
_ui->buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
_ui->buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
||||||
|
_ui->checkBox_binary->setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ExportCloudsDialog::getAssemble() const
|
bool ExportCloudsDialog::getAssemble() const
|
||||||
@@ -84,6 +86,11 @@ double ExportCloudsDialog::getGenerateMaxDepth() const
|
|||||||
return _ui->doubleSpinBox_maxDepth->value();
|
return _ui->doubleSpinBox_maxDepth->value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ExportCloudsDialog::getBinaryFile() const
|
||||||
|
{
|
||||||
|
return _ui->checkBox_binary->isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
bool ExportCloudsDialog::getMLS() const
|
bool ExportCloudsDialog::getMLS() const
|
||||||
{
|
{
|
||||||
return _ui->groupBox_mls->isChecked();
|
return _ui->groupBox_mls->isChecked();
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ public:
|
|||||||
int getGenerateDecimation() const;
|
int getGenerateDecimation() const;
|
||||||
double getGenerateVoxel() const;
|
double getGenerateVoxel() const;
|
||||||
double getGenerateMaxDepth() const;
|
double getGenerateMaxDepth() const;
|
||||||
|
bool getBinaryFile() const;
|
||||||
bool getMLS() const;
|
bool getMLS() const;
|
||||||
double getMLSRadius() const;
|
double getMLSRadius() const;
|
||||||
bool getMesh() const;
|
bool getMesh() const;
|
||||||
|
|||||||
@@ -3511,7 +3511,16 @@ void MainWindow::exportScans()
|
|||||||
{
|
{
|
||||||
if(scans.size())
|
if(scans.size())
|
||||||
{
|
{
|
||||||
this->saveScans(scans);
|
QMessageBox::StandardButton b = QMessageBox::question(this,
|
||||||
|
tr("Binary file?"),
|
||||||
|
tr("Do you want to save in binary mode?"),
|
||||||
|
QMessageBox::No | QMessageBox::Yes,
|
||||||
|
QMessageBox::Yes);
|
||||||
|
|
||||||
|
if(b == QMessageBox::No || b == QMessageBox::Yes)
|
||||||
|
{
|
||||||
|
this->saveScans(scans, b == QMessageBox::Yes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_initProgressDialog->setValue(_initProgressDialog->maximumSteps());
|
_initProgressDialog->setValue(_initProgressDialog->maximumSteps());
|
||||||
}
|
}
|
||||||
@@ -3657,11 +3666,11 @@ void MainWindow::exportClouds()
|
|||||||
{
|
{
|
||||||
if(meshes.size())
|
if(meshes.size())
|
||||||
{
|
{
|
||||||
saveMeshes(meshes);
|
saveMeshes(meshes, _exportDialog->getBinaryFile());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
saveClouds(clouds);
|
saveClouds(clouds, _exportDialog->getBinaryFile());
|
||||||
}
|
}
|
||||||
_initProgressDialog->setValue(_initProgressDialog->maximumSteps());
|
_initProgressDialog->setValue(_initProgressDialog->maximumSteps());
|
||||||
}
|
}
|
||||||
@@ -3886,7 +3895,7 @@ void MainWindow::dataRecorder()
|
|||||||
|
|
||||||
//END ACTIONS
|
//END ACTIONS
|
||||||
|
|
||||||
void MainWindow::saveClouds(const std::map<int, pcl::PointCloud<pcl::PointXYZRGB>::Ptr> & clouds)
|
void MainWindow::saveClouds(const std::map<int, pcl::PointCloud<pcl::PointXYZRGB>::Ptr> & clouds, bool binaryMode)
|
||||||
{
|
{
|
||||||
if(clouds.size() == 1)
|
if(clouds.size() == 1)
|
||||||
{
|
{
|
||||||
@@ -3900,17 +3909,17 @@ void MainWindow::saveClouds(const std::map<int, pcl::PointCloud<pcl::PointXYZRGB
|
|||||||
bool success =false;
|
bool success =false;
|
||||||
if(QFileInfo(path).suffix() == "pcd")
|
if(QFileInfo(path).suffix() == "pcd")
|
||||||
{
|
{
|
||||||
success = pcl::io::savePCDFile(path.toStdString(), *clouds.begin()->second) == 0;
|
success = pcl::io::savePCDFile(path.toStdString(), *clouds.begin()->second, binaryMode) == 0;
|
||||||
}
|
}
|
||||||
else if(QFileInfo(path).suffix() == "ply")
|
else if(QFileInfo(path).suffix() == "ply")
|
||||||
{
|
{
|
||||||
success = pcl::io::savePLYFile(path.toStdString(), *clouds.begin()->second) == 0;
|
success = pcl::io::savePLYFile(path.toStdString(), *clouds.begin()->second, binaryMode) == 0;
|
||||||
}
|
}
|
||||||
else if(QFileInfo(path).suffix() == "")
|
else if(QFileInfo(path).suffix() == "")
|
||||||
{
|
{
|
||||||
//use ply by default
|
//use ply by default
|
||||||
path += ".ply";
|
path += ".ply";
|
||||||
success = pcl::io::savePCDFile(path.toStdString(), *clouds.begin()->second) == 0;
|
success = pcl::io::savePLYFile(path.toStdString(), *clouds.begin()->second, binaryMode) == 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -3962,11 +3971,11 @@ void MainWindow::saveClouds(const std::map<int, pcl::PointCloud<pcl::PointXYZRGB
|
|||||||
bool success =false;
|
bool success =false;
|
||||||
if(suffix == "pcd")
|
if(suffix == "pcd")
|
||||||
{
|
{
|
||||||
success = pcl::io::savePCDFile(pathFile.toStdString(), *transformedCloud) == 0;
|
success = pcl::io::savePCDFile(pathFile.toStdString(), *transformedCloud, binaryMode) == 0;
|
||||||
}
|
}
|
||||||
else if(suffix == "ply")
|
else if(suffix == "ply")
|
||||||
{
|
{
|
||||||
success = pcl::io::savePLYFile(pathFile.toStdString(), *transformedCloud) == 0;
|
success = pcl::io::savePLYFile(pathFile.toStdString(), *transformedCloud, binaryMode) == 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -3994,7 +4003,7 @@ void MainWindow::saveClouds(const std::map<int, pcl::PointCloud<pcl::PointXYZRGB
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::saveMeshes(const std::map<int, pcl::PolygonMesh::Ptr> & meshes)
|
void MainWindow::saveMeshes(const std::map<int, pcl::PolygonMesh::Ptr> & meshes, bool binaryMode)
|
||||||
{
|
{
|
||||||
if(meshes.size() == 1)
|
if(meshes.size() == 1)
|
||||||
{
|
{
|
||||||
@@ -4008,13 +4017,13 @@ void MainWindow::saveMeshes(const std::map<int, pcl::PolygonMesh::Ptr> & meshes)
|
|||||||
bool success =false;
|
bool success =false;
|
||||||
if(QFileInfo(path).suffix() == "ply")
|
if(QFileInfo(path).suffix() == "ply")
|
||||||
{
|
{
|
||||||
success = pcl::io::savePLYFile(path.toStdString(), *meshes.begin()->second) == 0;
|
success = pcl::io::savePLYFile(path.toStdString(), *meshes.begin()->second, binaryMode) == 0;
|
||||||
}
|
}
|
||||||
else if(QFileInfo(path).suffix() == "")
|
else if(QFileInfo(path).suffix() == "")
|
||||||
{
|
{
|
||||||
//default ply
|
//default ply
|
||||||
path += ".ply";
|
path += ".ply";
|
||||||
success = pcl::io::savePLYFile(path.toStdString(), *meshes.begin()->second) == 0;
|
success = pcl::io::savePLYFile(path.toStdString(), *meshes.begin()->second, binaryMode) == 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -4064,7 +4073,7 @@ void MainWindow::saveMeshes(const std::map<int, pcl::PolygonMesh::Ptr> & meshes)
|
|||||||
bool success =false;
|
bool success =false;
|
||||||
if(suffix == "ply")
|
if(suffix == "ply")
|
||||||
{
|
{
|
||||||
success = pcl::io::savePLYFile(pathFile.toStdString(), mesh) == 0;
|
success = pcl::io::savePLYFile(pathFile.toStdString(), mesh, binaryMode) == 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -4093,7 +4102,7 @@ void MainWindow::saveMeshes(const std::map<int, pcl::PolygonMesh::Ptr> & meshes)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::saveScans(const std::map<int, pcl::PointCloud<pcl::PointXYZ>::Ptr> & scans)
|
void MainWindow::saveScans(const std::map<int, pcl::PointCloud<pcl::PointXYZ>::Ptr> & scans, bool binaryMode)
|
||||||
{
|
{
|
||||||
if(scans.size() == 1)
|
if(scans.size() == 1)
|
||||||
{
|
{
|
||||||
@@ -4107,17 +4116,17 @@ void MainWindow::saveScans(const std::map<int, pcl::PointCloud<pcl::PointXYZ>::P
|
|||||||
bool success =false;
|
bool success =false;
|
||||||
if(QFileInfo(path).suffix() == "pcd")
|
if(QFileInfo(path).suffix() == "pcd")
|
||||||
{
|
{
|
||||||
success = pcl::io::savePCDFile(path.toStdString(), *scans.begin()->second) == 0;
|
success = pcl::io::savePCDFile(path.toStdString(), *scans.begin()->second, binaryMode) == 0;
|
||||||
}
|
}
|
||||||
else if(QFileInfo(path).suffix() == "ply")
|
else if(QFileInfo(path).suffix() == "ply")
|
||||||
{
|
{
|
||||||
success = pcl::io::savePLYFile(path.toStdString(), *scans.begin()->second) == 0;
|
success = pcl::io::savePLYFile(path.toStdString(), *scans.begin()->second, binaryMode) == 0;
|
||||||
}
|
}
|
||||||
else if(QFileInfo(path).suffix() == "")
|
else if(QFileInfo(path).suffix() == "")
|
||||||
{
|
{
|
||||||
//use ply by default
|
//use ply by default
|
||||||
path += ".ply";
|
path += ".ply";
|
||||||
success = pcl::io::savePCDFile(path.toStdString(), *scans.begin()->second) == 0;
|
success = pcl::io::savePLYFile(path.toStdString(), *scans.begin()->second, binaryMode) == 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -4169,11 +4178,11 @@ void MainWindow::saveScans(const std::map<int, pcl::PointCloud<pcl::PointXYZ>::P
|
|||||||
bool success =false;
|
bool success =false;
|
||||||
if(suffix == "pcd")
|
if(suffix == "pcd")
|
||||||
{
|
{
|
||||||
success = pcl::io::savePCDFile(pathFile.toStdString(), *transformedCloud) == 0;
|
success = pcl::io::savePCDFile(pathFile.toStdString(), *transformedCloud, binaryMode) == 0;
|
||||||
}
|
}
|
||||||
else if(suffix == "ply")
|
else if(suffix == "ply")
|
||||||
{
|
{
|
||||||
success = pcl::io::savePLYFile(pathFile.toStdString(), *transformedCloud) == 0;
|
success = pcl::io::savePLYFile(pathFile.toStdString(), *transformedCloud, binaryMode) == 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -148,6 +148,16 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox_binary">
|
||||||
|
<property name="text">
|
||||||
|
<string>Binary file</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_mls">
|
<widget class="QGroupBox" name="groupBox_mls">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
|||||||
Reference in New Issue
Block a user