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

PCLVisualizer: make coordinate system actor unpickable #5719

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all 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
30 changes: 16 additions & 14 deletions visualization/src/pcl_visualizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,7 @@ pcl::visualization::PCLVisualizer::addCoordinateSystem (double scale, const std:

vtkSmartPointer<vtkLODActor> axes_actor = vtkSmartPointer<vtkLODActor>::New ();
axes_actor->SetMapper (axes_mapper);
axes_actor->SetPickable(false);

// Save the ID and actor pair to the global actor map
(*coordinate_actor_map_) [id] = axes_actor;
Expand Down Expand Up @@ -740,6 +741,7 @@ pcl::visualization::PCLVisualizer::addCoordinateSystem (double scale, float x, f
vtkSmartPointer<vtkLODActor> axes_actor = vtkSmartPointer<vtkLODActor>::New ();
axes_actor->SetMapper (axes_mapper);
axes_actor->SetPosition (x, y, z);
axes_actor->SetPickable(false);

// Save the ID and actor pair to the global actor map
(*coordinate_actor_map_) [id] = axes_actor;
Expand Down Expand Up @@ -1408,7 +1410,7 @@ pcl::visualization::PCLVisualizer::setPointCloudRenderingProperties (
// Check if the mapper has scalars
if (!actor->GetMapper ()->GetInput ()->GetPointData ()->GetScalars ())
break;

// Check that scalars are not unisgned char (i.e. check if a LUT is used to colormap scalars assuming vtk ColorMode is Default)
if (actor->GetMapper ()->GetInput ()->GetPointData ()->GetScalars ()->IsA ("vtkUnsignedCharArray"))
break;
Expand All @@ -1419,7 +1421,7 @@ pcl::visualization::PCLVisualizer::setPointCloudRenderingProperties (
PCL_WARN ("[setPointCloudRenderingProperties] Range max must be greater than range min!\n");
return (false);
}

// Update LUT
actor->GetMapper ()->GetLookupTable ()->SetRange (val1, val2);
actor->GetMapper()->UseLookupTableScalarRangeOn ();
Expand Down Expand Up @@ -1571,15 +1573,15 @@ pcl::visualization::PCLVisualizer::setPointCloudRenderingProperties (
// Check if the mapper has scalars
if (!actor->GetMapper ()->GetInput ()->GetPointData ()->GetScalars ())
break;

// Check that scalars are not unisgned char (i.e. check if a LUT is used to colormap scalars assuming vtk ColorMode is Default)
if (actor->GetMapper ()->GetInput ()->GetPointData ()->GetScalars ()->IsA ("vtkUnsignedCharArray"))
break;

// Get range limits from existing LUT
double *range;
range = actor->GetMapper ()->GetLookupTable ()->GetRange ();

actor->GetMapper ()->ScalarVisibilityOn ();
actor->GetMapper ()->SetScalarRange (range[0], range[1]);
vtkSmartPointer<vtkLookupTable> table;
Expand All @@ -1595,7 +1597,7 @@ pcl::visualization::PCLVisualizer::setPointCloudRenderingProperties (
// Check if the mapper has scalars
if (!actor->GetMapper ()->GetInput ()->GetPointData ()->GetScalars ())
break;

// Check that scalars are not unisgned char (i.e. check if a LUT is used to colormap scalars assuming vtk ColorMode is Default)
if (actor->GetMapper ()->GetInput ()->GetPointData ()->GetScalars ()->IsA ("vtkUnsignedCharArray"))
break;
Expand Down Expand Up @@ -1725,7 +1727,7 @@ pcl::visualization::PCLVisualizer::setShapeRenderingProperties (
// Check if the mapper has scalars
if (!actor->GetMapper ()->GetInput ()->GetPointData ()->GetScalars ())
break;

// Check that scalars are not unisgned char (i.e. check if a LUT is used to colormap scalars assuming vtk ColorMode is Default)
if (actor->GetMapper ()->GetInput ()->GetPointData ()->GetScalars ()->IsA ("vtkUnsignedCharArray"))
break;
Expand All @@ -1736,7 +1738,7 @@ pcl::visualization::PCLVisualizer::setShapeRenderingProperties (
PCL_WARN ("[setShapeRenderingProperties] Range max must be greater than range min!\n");
return (false);
}

// Update LUT
actor->GetMapper ()->GetLookupTable ()->SetRange (val1, val2);
actor->GetMapper()->UseLookupTableScalarRangeOn ();
Expand Down Expand Up @@ -1869,11 +1871,11 @@ pcl::visualization::PCLVisualizer::setShapeRenderingProperties (
// Check that scalars are not unisgned char (i.e. check if a LUT is used to colormap scalars assuming vtk ColorMode is Default)
if (actor->GetMapper ()->GetInput ()->GetPointData ()->GetScalars ()->IsA ("vtkUnsignedCharArray"))
break;

// Get range limits from existing LUT
double *range;
range = actor->GetMapper ()->GetLookupTable ()->GetRange ();

actor->GetMapper ()->ScalarVisibilityOn ();
actor->GetMapper ()->SetScalarRange (range[0], range[1]);
vtkSmartPointer<vtkLookupTable> table;
Expand Down Expand Up @@ -3013,7 +3015,7 @@ pcl::visualization::PCLVisualizer::addPolygonMesh (const pcl::PolygonMesh &poly_
pcl::fromPCLPointCloud2 (poly_mesh.cloud, *point_cloud);
poly_points->SetNumberOfPoints (point_cloud->size ());

for (std::size_t i = 0; i < point_cloud->size (); ++i)
for (std::size_t i = 0; i < point_cloud->size (); ++i)
{
const pcl::PointXYZ& p = (*point_cloud)[i];
poly_points->InsertPoint (i, p.x, p.y, p.z);
Expand Down Expand Up @@ -3183,7 +3185,7 @@ pcl::visualization::PCLVisualizer::updatePolygonMesh (

// Update the cells
cells = vtkSmartPointer<vtkCellArray>::New ();

const auto idx = details::fillCells(lookup, verts, cells, max_size_of_polygon);

cells->GetData ()->SetNumberOfValues (idx);
Expand Down Expand Up @@ -3427,7 +3429,7 @@ pcl::visualization::PCLVisualizer::addTextureMesh (const pcl::TextureMesh &mesh,
mapper->MapDataArrayToMultiTextureAttribute(tu,
this_coordinates_name.c_str(),
vtkDataObject::FIELD_ASSOCIATION_POINTS);

polydata->GetPointData ()->AddArray (coordinates);
actor->GetProperty ()->SetTexture (tu, texture);
++tex_id;
Expand Down Expand Up @@ -4346,7 +4348,7 @@ pcl::visualization::PCLVisualizer::close ()
void
pcl::visualization::PCLVisualizer::removeCorrespondences (
const std::string &id, int viewport)
{
{
removeShape (id, viewport);
}

Expand Down Expand Up @@ -4579,7 +4581,7 @@ pcl::visualization::PCLVisualizer::getUniqueCameraFile (int argc, char **argv)
p_file_indices = pcl::console::parse_file_extension_argument (argc, argv, ".pcd");
if (!p_file_indices.empty ())
{
boost::uuids::detail::sha1 sha1;
boost::uuids::detail::sha1 sha1;
bool valid = false;

// Calculate sha1 using canonical paths
Expand Down