|
|
|
@@ -128,6 +128,7 @@ CloudViewer::CloudViewer(QWidget *parent) :
|
|
|
|
_aSetRenderingRate(0),
|
|
|
|
_aSetRenderingRate(0),
|
|
|
|
_aSetLighting(0),
|
|
|
|
_aSetLighting(0),
|
|
|
|
_aSetEdgeVisibility(0),
|
|
|
|
_aSetEdgeVisibility(0),
|
|
|
|
|
|
|
|
_aBackfaceCulling(0),
|
|
|
|
_menu(0),
|
|
|
|
_menu(0),
|
|
|
|
_trajectory(new pcl::PointCloud<pcl::PointXYZ>),
|
|
|
|
_trajectory(new pcl::PointCloud<pcl::PointXYZ>),
|
|
|
|
_maxTrajectorySize(100),
|
|
|
|
_maxTrajectorySize(100),
|
|
|
|
@@ -140,7 +141,6 @@ CloudViewer::CloudViewer(QWidget *parent) :
|
|
|
|
_workingDirectory("."),
|
|
|
|
_workingDirectory("."),
|
|
|
|
_defaultBgColor(Qt::black),
|
|
|
|
_defaultBgColor(Qt::black),
|
|
|
|
_currentBgColor(Qt::black),
|
|
|
|
_currentBgColor(Qt::black),
|
|
|
|
_backfaceCulling(false),
|
|
|
|
|
|
|
|
_frontfaceCulling(false),
|
|
|
|
_frontfaceCulling(false),
|
|
|
|
_renderingRate(5.0),
|
|
|
|
_renderingRate(5.0),
|
|
|
|
_octomapActor(0)
|
|
|
|
_octomapActor(0)
|
|
|
|
@@ -241,6 +241,9 @@ void CloudViewer::createMenu()
|
|
|
|
_aSetEdgeVisibility = new QAction("Show edges", this);
|
|
|
|
_aSetEdgeVisibility = new QAction("Show edges", this);
|
|
|
|
_aSetEdgeVisibility->setCheckable(true);
|
|
|
|
_aSetEdgeVisibility->setCheckable(true);
|
|
|
|
_aSetEdgeVisibility->setChecked(false);
|
|
|
|
_aSetEdgeVisibility->setChecked(false);
|
|
|
|
|
|
|
|
_aBackfaceCulling = new QAction("Backface culling", this);
|
|
|
|
|
|
|
|
_aBackfaceCulling->setCheckable(true);
|
|
|
|
|
|
|
|
_aBackfaceCulling->setChecked(true);
|
|
|
|
|
|
|
|
|
|
|
|
QMenu * cameraMenu = new QMenu("Camera", this);
|
|
|
|
QMenu * cameraMenu = new QMenu("Camera", this);
|
|
|
|
cameraMenu->addAction(_aLockCamera);
|
|
|
|
cameraMenu->addAction(_aLockCamera);
|
|
|
|
@@ -279,6 +282,7 @@ void CloudViewer::createMenu()
|
|
|
|
_menu->addAction(_aSetRenderingRate);
|
|
|
|
_menu->addAction(_aSetRenderingRate);
|
|
|
|
_menu->addAction(_aSetLighting);
|
|
|
|
_menu->addAction(_aSetLighting);
|
|
|
|
_menu->addAction(_aSetEdgeVisibility);
|
|
|
|
_menu->addAction(_aSetEdgeVisibility);
|
|
|
|
|
|
|
|
_menu->addAction(_aBackfaceCulling);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CloudViewer::saveSettings(QSettings & settings, const QString & group) const
|
|
|
|
void CloudViewer::saveSettings(QSettings & settings, const QString & group) const
|
|
|
|
@@ -542,14 +546,8 @@ bool CloudViewer::addCloudMesh(
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetLighting(_aSetLighting->isChecked());
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetLighting(_aSetLighting->isChecked());
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetEdgeVisibility(_aSetEdgeVisibility->isChecked());
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetEdgeVisibility(_aSetEdgeVisibility->isChecked());
|
|
|
|
if(_backfaceCulling)
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetBackfaceCulling(_aBackfaceCulling->isChecked());
|
|
|
|
{
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetFrontfaceCulling(_frontfaceCulling);
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->BackfaceCullingOn();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(_frontfaceCulling)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->FrontfaceCullingOn();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
_visualizer->updatePointCloudPose(id, pose.toEigen3f());
|
|
|
|
_visualizer->updatePointCloudPose(id, pose.toEigen3f());
|
|
|
|
_addedClouds.insert(id, pose);
|
|
|
|
_addedClouds.insert(id, pose);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
@@ -573,14 +571,8 @@ bool CloudViewer::addCloudMesh(
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetLighting(_aSetLighting->isChecked());
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetLighting(_aSetLighting->isChecked());
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetEdgeVisibility(_aSetEdgeVisibility->isChecked());
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetEdgeVisibility(_aSetEdgeVisibility->isChecked());
|
|
|
|
if(_backfaceCulling)
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetBackfaceCulling(_aBackfaceCulling->isChecked());
|
|
|
|
{
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetFrontfaceCulling(_frontfaceCulling);
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->BackfaceCullingOn();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(_frontfaceCulling)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->FrontfaceCullingOn();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
_visualizer->updatePointCloudPose(id, pose.toEigen3f());
|
|
|
|
_visualizer->updatePointCloudPose(id, pose.toEigen3f());
|
|
|
|
_addedClouds.insert(id, pose);
|
|
|
|
_addedClouds.insert(id, pose);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
@@ -604,14 +596,8 @@ bool CloudViewer::addCloudMesh(
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetLighting(_aSetLighting->isChecked());
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetLighting(_aSetLighting->isChecked());
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetEdgeVisibility(_aSetEdgeVisibility->isChecked());
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetEdgeVisibility(_aSetEdgeVisibility->isChecked());
|
|
|
|
if(_backfaceCulling)
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetBackfaceCulling(_aBackfaceCulling->isChecked());
|
|
|
|
{
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetFrontfaceCulling(_frontfaceCulling);
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->BackfaceCullingOn();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(_frontfaceCulling)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->FrontfaceCullingOn();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
_visualizer->updatePointCloudPose(id, pose.toEigen3f());
|
|
|
|
_visualizer->updatePointCloudPose(id, pose.toEigen3f());
|
|
|
|
_addedClouds.insert(id, pose);
|
|
|
|
_addedClouds.insert(id, pose);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
@@ -634,14 +620,8 @@ bool CloudViewer::addCloudMesh(
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetLighting(_aSetLighting->isChecked());
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetLighting(_aSetLighting->isChecked());
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetEdgeVisibility(_aSetEdgeVisibility->isChecked());
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetEdgeVisibility(_aSetEdgeVisibility->isChecked());
|
|
|
|
if(_backfaceCulling)
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetBackfaceCulling(_aBackfaceCulling->isChecked());
|
|
|
|
{
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetFrontfaceCulling(_frontfaceCulling);
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->BackfaceCullingOn();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(_frontfaceCulling)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->FrontfaceCullingOn();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
_visualizer->updatePointCloudPose(id, pose.toEigen3f());
|
|
|
|
_visualizer->updatePointCloudPose(id, pose.toEigen3f());
|
|
|
|
_addedClouds.insert(id, pose);
|
|
|
|
_addedClouds.insert(id, pose);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
@@ -665,14 +645,8 @@ bool CloudViewer::addCloudTextureMesh(
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetLighting(_aSetLighting->isChecked());
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetLighting(_aSetLighting->isChecked());
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetEdgeVisibility(_aSetEdgeVisibility->isChecked());
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetEdgeVisibility(_aSetEdgeVisibility->isChecked());
|
|
|
|
if(_backfaceCulling)
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetBackfaceCulling(_aBackfaceCulling->isChecked());
|
|
|
|
{
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetFrontfaceCulling(_frontfaceCulling);
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->BackfaceCullingOn();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(_frontfaceCulling)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->FrontfaceCullingOn();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!textureMesh->cloud.is_dense)
|
|
|
|
if(!textureMesh->cloud.is_dense)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetTexture()->SetInterpolate(1);
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetTexture()->SetInterpolate(1);
|
|
|
|
@@ -1152,6 +1126,8 @@ bool CloudViewer::addTextureMesh (
|
|
|
|
|
|
|
|
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetLighting(_aSetLighting->isChecked());
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetLighting(_aSetLighting->isChecked());
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetEdgeVisibility(_aSetEdgeVisibility->isChecked());
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetEdgeVisibility(_aSetEdgeVisibility->isChecked());
|
|
|
|
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetBackfaceCulling(_aBackfaceCulling->isChecked());
|
|
|
|
|
|
|
|
_visualizer->getCloudActorMap()->find(id)->second.actor->GetProperty()->SetFrontfaceCulling(_frontfaceCulling);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1733,8 +1709,16 @@ Transform CloudViewer::getTargetPose() const
|
|
|
|
|
|
|
|
|
|
|
|
void CloudViewer::setBackfaceCulling(bool enabled, bool frontfaceCulling)
|
|
|
|
void CloudViewer::setBackfaceCulling(bool enabled, bool frontfaceCulling)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_backfaceCulling = enabled;
|
|
|
|
_aBackfaceCulling->setChecked(enabled);
|
|
|
|
_frontfaceCulling = frontfaceCulling;
|
|
|
|
_frontfaceCulling = frontfaceCulling;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pcl::visualization::CloudActorMapPtr cloudActorMap = _visualizer->getCloudActorMap();
|
|
|
|
|
|
|
|
for(pcl::visualization::CloudActorMap::iterator iter=cloudActorMap->begin(); iter!=cloudActorMap->end(); ++iter)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
iter->second.actor->GetProperty()->SetBackfaceCulling(_aBackfaceCulling->isChecked());
|
|
|
|
|
|
|
|
iter->second.actor->GetProperty()->SetFrontfaceCulling(_frontfaceCulling);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this->update();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CloudViewer::setRenderingRate(double rate)
|
|
|
|
void CloudViewer::setRenderingRate(double rate)
|
|
|
|
@@ -2507,6 +2491,10 @@ void CloudViewer::handleAction(QAction * a)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this->setEdgeVisibility(_aSetEdgeVisibility->isChecked());
|
|
|
|
this->setEdgeVisibility(_aSetEdgeVisibility->isChecked());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(a == _aBackfaceCulling)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
this->setBackfaceCulling(_aBackfaceCulling->isChecked(), _frontfaceCulling);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} /* namespace rtabmap */
|
|
|
|
} /* namespace rtabmap */
|
|
|
|
|