Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add another variant to getPointCloudRenderingProperties() #2142

Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 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,19 @@ 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)
* \return True if the property is effectively retrieved.
* \note The list of properties can be found in \ref pcl::visualization::LookUpTableRepresentationProperties.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lacks the comment about the \return value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

*/
bool
getPointCloudRenderingProperties (RenderingProperties 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
40 changes: 40 additions & 0 deletions visualization/src/pcl_visualizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1503,6 +1503,46 @@ pcl::visualization::PCLVisualizer::getPointCloudRenderingProperties (int propert
}
return (true);
}
/////////////////////////////////////////////////////////////////////////////////////////////
bool
pcl::visualization::PCLVisualizer::getPointCloudRenderingProperties (RenderingProperties 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);
val1 = rgb[0];
val2 = rgb[1];
val3 = rgb[2];
break;
}
default:
{
pcl::console::print_error ("[getPointCloudRenderingProperties] "
"Property (%d) is either unknown or it requires a different "
"number of variables to retrieve its contents.\n",
property);
return (false);
}
}
return (true);
}

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