mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-03 01:50:24 +08:00
CloudViewer: added setInteractorLayer() function
This commit is contained in:
@@ -308,6 +308,7 @@ public:
|
|||||||
const QColor & getDefaultBackgroundColor() const;
|
const QColor & getDefaultBackgroundColor() const;
|
||||||
const QColor & getBackgroundColor() const;
|
const QColor & getBackgroundColor() const;
|
||||||
Transform getTargetPose() const;
|
Transform getTargetPose() const;
|
||||||
|
std::string getIdByActor(vtkProp * actor) const;
|
||||||
|
|
||||||
void setBackfaceCulling(bool enabled, bool frontfaceCulling);
|
void setBackfaceCulling(bool enabled, bool frontfaceCulling);
|
||||||
void setPolygonPicking(bool enabled);
|
void setPolygonPicking(bool enabled);
|
||||||
@@ -315,6 +316,7 @@ public:
|
|||||||
void setLighting(bool on);
|
void setLighting(bool on);
|
||||||
void setShading(bool on);
|
void setShading(bool on);
|
||||||
void setEdgeVisibility(bool visible);
|
void setEdgeVisibility(bool visible);
|
||||||
|
void setInteractorLayer(int layer);
|
||||||
double getRenderingRate() const;
|
double getRenderingRate() const;
|
||||||
|
|
||||||
void getCameraPosition(
|
void getCameraPosition(
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ class RTABMAPGUI_EXP CloudViewerCellPicker : public vtkCellPicker {
|
|||||||
public:
|
public:
|
||||||
public:
|
public:
|
||||||
static CloudViewerCellPicker *New ();
|
static CloudViewerCellPicker *New ();
|
||||||
|
vtkTypeMacro(CloudViewerCellPicker, vtkCellPicker);
|
||||||
CloudViewerCellPicker();
|
CloudViewerCellPicker();
|
||||||
virtual ~CloudViewerCellPicker();
|
virtual ~CloudViewerCellPicker();
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ class RTABMAPGUI_EXP CloudViewerInteractorStyle: public pcl::visualization::PCLV
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static CloudViewerInteractorStyle *New ();
|
static CloudViewerInteractorStyle *New ();
|
||||||
|
vtkTypeMacro(CloudViewerInteractorStyle, pcl::visualization::PCLVisualizerInteractorStyle);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CloudViewerInteractorStyle();
|
CloudViewerInteractorStyle();
|
||||||
|
|||||||
@@ -2087,6 +2087,28 @@ Transform CloudViewer::getTargetPose() const
|
|||||||
return _lastPose;
|
return _lastPose;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string CloudViewer::getIdByActor(vtkProp * actor) const
|
||||||
|
{
|
||||||
|
pcl::visualization::CloudActorMapPtr cloudActorMap = _visualizer->getCloudActorMap();
|
||||||
|
for(pcl::visualization::CloudActorMap::iterator iter=cloudActorMap->begin(); iter!=cloudActorMap->end(); ++iter)
|
||||||
|
{
|
||||||
|
if(iter->second.actor.GetPointer() == actor)
|
||||||
|
{
|
||||||
|
return iter->first;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pcl::visualization::ShapeActorMapPtr shapeActorMap = _visualizer->getShapeActorMap();
|
||||||
|
for(pcl::visualization::ShapeActorMap::iterator iter=shapeActorMap->begin(); iter!=shapeActorMap->end(); ++iter)
|
||||||
|
{
|
||||||
|
if(iter->second.GetPointer() == actor)
|
||||||
|
{
|
||||||
|
return iter->first;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return std::string();
|
||||||
|
}
|
||||||
|
|
||||||
void CloudViewer::setBackfaceCulling(bool enabled, bool frontfaceCulling)
|
void CloudViewer::setBackfaceCulling(bool enabled, bool frontfaceCulling)
|
||||||
{
|
{
|
||||||
_aBackfaceCulling->setChecked(enabled);
|
_aBackfaceCulling->setChecked(enabled);
|
||||||
@@ -2162,6 +2184,24 @@ void CloudViewer::setEdgeVisibility(bool visible)
|
|||||||
this->update();
|
this->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CloudViewer::setInteractorLayer(int layer)
|
||||||
|
{
|
||||||
|
_visualizer->getRendererCollection()->InitTraversal ();
|
||||||
|
vtkRenderer* renderer = NULL;
|
||||||
|
int i =0;
|
||||||
|
while ((renderer = _visualizer->getRendererCollection()->GetNextItem ()) != NULL)
|
||||||
|
{
|
||||||
|
if(i==layer)
|
||||||
|
{
|
||||||
|
_visualizer->getInteractorStyle()->SetDefaultRenderer(renderer);
|
||||||
|
_visualizer->getInteractorStyle()->SetCurrentRenderer(renderer);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
UWARN("Could not set layer %d to interactor (layers=%d).", layer, _visualizer->getRendererCollection()->GetNumberOfItems());
|
||||||
|
}
|
||||||
|
|
||||||
void CloudViewer::getCameraPosition(
|
void CloudViewer::getCameraPosition(
|
||||||
float & x, float & y, float & z,
|
float & x, float & y, float & z,
|
||||||
float & focalX, float & focalY, float & focalZ,
|
float & focalX, float & focalY, float & focalZ,
|
||||||
|
|||||||
Reference in New Issue
Block a user