Skip to content

Commit

Permalink
[VISU] Add another method 'getPointCloudRenderingProperties()' to han…
Browse files Browse the repository at this point in the history
…dle color.
  • Loading branch information
frozar committed Dec 11, 2017
1 parent abf77ff commit 79f6553
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
12 changes: 12 additions & 0 deletions visualization/include/pcl/visualization/pcl_visualizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -1179,6 +1179,18 @@ namespace pcl
getPointCloudRenderingProperties (int property, double &value,
const std::string &id = "cloud");

/** \brief Get the rendering properties of a PointCloud
* \param[in] property the property type
* \param[out] val1 the resultant property value
* \param[out] val2 the resultant property value
* \param[out] val3 the resultant property value
* \param[in] id the point cloud object id (default: cloud)
* \note The list of properties can be found in \ref pcl::visualization::LookUpTableRepresentationProperties.
*/
bool
getPointCloudRenderingProperties (int property, double &val1, double &val2, double &val3,
const std::string &id = "cloud");

/** \brief Set whether the point cloud is selected or not
* \param[in] selected whether the cloud is selected or not (true = selected)
* \param[in] id the point cloud object id (default: cloud)
Expand Down
34 changes: 34 additions & 0 deletions visualization/src/pcl_visualizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1503,6 +1503,40 @@ pcl::visualization::PCLVisualizer::getPointCloudRenderingProperties (int propert
}
return (true);
}
/////////////////////////////////////////////////////////////////////////////////////////////
bool
pcl::visualization::PCLVisualizer::getPointCloudRenderingProperties (int property, double &val1, double &val2, double &val3, const std::string &id)
{
// Check to see if this ID entry already exists (has it been already added to the visualizer?)
CloudActorMap::iterator am_it = cloud_actor_map_->find (id);

if (am_it == cloud_actor_map_->end ())
return (false);
// Get the actor pointer
vtkLODActor* actor = vtkLODActor::SafeDownCast (am_it->second.actor);
if (!actor)
return (false);

switch (property)
{
case PCL_VISUALIZER_COLOR:
{
double rgb[3];
actor->GetProperty ()->GetColor (rgb);
actor->Modified ();
val1 = rgb[0];
val2 = rgb[1];
val3 = rgb[2];
break;
}
default:
{
pcl::console::print_error ("[getPointCloudRenderingProperties] Unknown property (%d) specified!\n", property);
return (false);
}
}
return (true);
}

/////////////////////////////////////////////////////////////////////////////////////////////
bool
Expand Down

0 comments on commit 79f6553

Please sign in to comment.