mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-10 05:20:19 +08:00
Remove recursively tmp textures folder
This commit is contained in:
@@ -4542,6 +4542,29 @@ void MainWindow::viewClouds()
|
||||
}
|
||||
}
|
||||
|
||||
bool removeDir(const QString & dirName)
|
||||
{
|
||||
bool result = true;
|
||||
QDir dir(dirName);
|
||||
|
||||
if (dir.exists(dirName)) {
|
||||
Q_FOREACH(QFileInfo info, dir.entryInfoList(QDir::NoDotAndDotDot | QDir::System | QDir::Hidden | QDir::AllDirs | QDir::Files, QDir::DirsFirst)) {
|
||||
if (info.isDir()) {
|
||||
result = removeDir(info.absoluteFilePath());
|
||||
}
|
||||
else {
|
||||
result = QFile::remove(info.absoluteFilePath());
|
||||
}
|
||||
|
||||
if (!result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
result = dir.rmdir(dirName);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool MainWindow::getExportedClouds(
|
||||
std::map<int, pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr> & cloudsWithNormals,
|
||||
std::map<int, pcl::PolygonMesh::Ptr> & meshes,
|
||||
@@ -4639,7 +4662,7 @@ bool MainWindow::getExportedClouds(
|
||||
pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr cloudWithNormals(new pcl::PointCloud<pcl::PointXYZRGBNormal>);
|
||||
if(_exportDialog->getMLS())
|
||||
{
|
||||
_initProgressDialog->appendText(tr("Smoothing (MLS) of the assembled cloud (%1 points)...").arg(iter->second->size()));
|
||||
_initProgressDialog->appendText(tr("Smoothing (MLS) the cloud (%1 points)...").arg(iter->second->size()));
|
||||
QApplication::processEvents();
|
||||
|
||||
cloudWithNormals = util3d::mls(
|
||||
@@ -4654,7 +4677,7 @@ bool MainWindow::getExportedClouds(
|
||||
_exportDialog->getMLSDilationIterations());
|
||||
|
||||
// Re-voxelize to make sure to have uniform density
|
||||
_initProgressDialog->appendText(tr("Voxelize assembled cloud (%1 points, voxel size = %2 m)...")
|
||||
_initProgressDialog->appendText(tr("Voxelize cloud (%1 points, voxel size = %2 m)...")
|
||||
.arg(cloudWithNormals->size())
|
||||
.arg(_exportDialog->getAssemble()?_exportDialog->getAssembleVoxel():_exportDialog->getGenerateVoxel()));
|
||||
QApplication::processEvents();
|
||||
@@ -4667,6 +4690,7 @@ bool MainWindow::getExportedClouds(
|
||||
else
|
||||
{
|
||||
//compute normals
|
||||
_initProgressDialog->appendText(tr("Computing normals (%1 points)...").arg(iter->second->size()));
|
||||
cloudWithNormals = util3d::computeNormals(iter->second, _exportDialog->getNormalKSearch());
|
||||
}
|
||||
|
||||
@@ -4719,6 +4743,9 @@ bool MainWindow::getExportedClouds(
|
||||
|
||||
if(toSave && _exportDialog->getMeshTexture())
|
||||
{
|
||||
QDir dir(_preferencesDialog->getWorkingDirectory());
|
||||
removeDir(_preferencesDialog->getWorkingDirectory()+QDir::separator()+"tmp_textures");
|
||||
dir.mkdir("tmp_textures");
|
||||
int i=0;
|
||||
for(std::map<int, pcl::PolygonMesh::Ptr>::iterator iter=meshes.begin();
|
||||
iter!= meshes.end();
|
||||
@@ -4766,8 +4793,6 @@ bool MainWindow::getExportedClouds(
|
||||
}
|
||||
if(cameraPoses.size())
|
||||
{
|
||||
QDir dir(_preferencesDialog->getWorkingDirectory());
|
||||
dir.mkdir("tmp_textures");
|
||||
pcl::TextureMesh::Ptr textureMesh = util3d::createTextureMesh(
|
||||
iter->second,
|
||||
cameraPoses,
|
||||
@@ -5240,6 +5265,7 @@ void MainWindow::saveTextureMeshes(const std::map<int, pcl::TextureMesh::Ptr> &
|
||||
pcl::TextureMesh mesh;
|
||||
mesh.tex_coordinates = meshes.begin()->second->tex_coordinates;
|
||||
mesh.tex_materials = meshes.begin()->second->tex_materials;
|
||||
removeDir(QFileInfo(path).absoluteDir().absolutePath()+QDir::separator()+QFileInfo(path).baseName());
|
||||
QDir(QFileInfo(path).absoluteDir().absolutePath()).mkdir(QFileInfo(path).baseName());
|
||||
for(unsigned int i=0;i<meshes.begin()->second->tex_materials.size(); ++i)
|
||||
{
|
||||
@@ -5295,6 +5321,7 @@ void MainWindow::saveTextureMeshes(const std::map<int, pcl::TextureMesh::Ptr> &
|
||||
pcl::TextureMesh mesh;
|
||||
mesh.tex_coordinates = iter->second->tex_coordinates;
|
||||
mesh.tex_materials = iter->second->tex_materials;
|
||||
QDir(path).rmdir(currentPrefix);
|
||||
QDir(path).mkdir(currentPrefix);
|
||||
for(unsigned int i=0;i<iter->second->tex_materials.size(); ++i)
|
||||
{
|
||||
|
||||
@@ -1014,15 +1014,15 @@ void PreferencesDialog::resetSettings(QGroupBox * groupBox)
|
||||
for(int i=0; i<2; ++i)
|
||||
{
|
||||
_3dRenderingShowClouds[i]->setChecked(true);
|
||||
_3dRenderingVoxelSize[i]->setValue(i==2?0.005:0.00);
|
||||
_3dRenderingDecimation[i]->setValue(i==0?4:i==1?2:1);
|
||||
_3dRenderingVoxelSize[i]->setValue(0.00);
|
||||
_3dRenderingDecimation[i]->setValue(i==0?4:2);
|
||||
_3dRenderingMaxDepth[i]->setValue(i==1?0.0:4.0);
|
||||
_3dRenderingShowScans[i]->setChecked(true);
|
||||
|
||||
_3dRenderingOpacity[i]->setValue(1.0);
|
||||
_3dRenderingPtSize[i]->setValue(i==0?1:2);
|
||||
_3dRenderingOpacityScan[i]->setValue(1.0);
|
||||
_3dRenderingPtSizeScan[i]->setValue(1);
|
||||
_3dRenderingOpacity[i]->setValue(i==0?1.0:0.5);
|
||||
_3dRenderingPtSize[i]->setValue(2);
|
||||
_3dRenderingOpacityScan[i]->setValue(i==0?1.0:0.5);
|
||||
_3dRenderingPtSizeScan[i]->setValue(2);
|
||||
}
|
||||
|
||||
_ui->checkBox_showGraphs->setChecked(true);
|
||||
@@ -1035,7 +1035,7 @@ void PreferencesDialog::resetSettings(QGroupBox * groupBox)
|
||||
_ui->checkBox_mls->setChecked(false);
|
||||
_ui->doubleSpinBox_mlsRadius->setValue(0.04);
|
||||
|
||||
_ui->checkBox_nodeFiltering->setChecked(true);
|
||||
_ui->checkBox_nodeFiltering->setChecked(false);
|
||||
_ui->checkBox_subtractFiltering->setChecked(false);
|
||||
_ui->doubleSpinBox_cloudFilterRadius->setValue(0.1);
|
||||
_ui->doubleSpinBox_cloudFilterAngle->setValue(30);
|
||||
|
||||
@@ -63,9 +63,9 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>-394</y>
|
||||
<width>759</width>
|
||||
<height>938</height>
|
||||
<y>-542</y>
|
||||
<width>755</width>
|
||||
<height>1591</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_16">
|
||||
@@ -468,7 +468,7 @@ Show a yellow background when the number of odometry inliers goes under this thr
|
||||
<string/>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -955,6 +955,9 @@ Show a yellow background when the number of odometry inliers goes under this thr
|
||||
<property name="maximum">
|
||||
<number>64</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>2</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
@@ -965,6 +968,9 @@ Show a yellow background when the number of odometry inliers goes under this thr
|
||||
<property name="maximum">
|
||||
<number>64</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>2</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
|
||||
Reference in New Issue
Block a user