///////////////////////////////////////////////////////////////////////////////////////
| 2396 | |
| 2397 | //////////////////////////////////////////////////////////////////////////////////////////// |
| 2398 | bool |
| 2399 | pcl::visualization::PCLVisualizer::addSphere (const pcl::ModelCoefficients &coefficients, |
| 2400 | const std::string &id, int viewport) |
| 2401 | { |
| 2402 | // Check to see if this ID entry already exists (has it been already added to the visualizer?) |
| 2403 | auto am_it = shape_actor_map_->find (id); |
| 2404 | if (am_it != shape_actor_map_->end ()) |
| 2405 | { |
| 2406 | pcl::console::print_warn (stderr, "[addSphere] A shape with id <%s> already exists! Please choose a different id and retry.\n", id.c_str ()); |
| 2407 | return (false); |
| 2408 | } |
| 2409 | |
| 2410 | if (coefficients.values.size () != 4) |
| 2411 | { |
| 2412 | PCL_WARN ("[addSphere] Coefficients size does not match expected size (expected 4).\n"); |
| 2413 | return (false); |
| 2414 | } |
| 2415 | |
| 2416 | vtkSmartPointer<vtkDataSet> data = createSphere (coefficients); |
| 2417 | |
| 2418 | // Create an Actor |
| 2419 | vtkSmartPointer<vtkLODActor> actor; |
| 2420 | createActorFromVTKDataSet (data, actor); |
| 2421 | actor->GetProperty ()->SetRepresentationToSurface (); |
| 2422 | addActorToRenderer (actor, viewport); |
| 2423 | |
| 2424 | // Save the pointer/ID pair to the global actor map |
| 2425 | (*shape_actor_map_)[id] = actor; |
| 2426 | return (true); |
| 2427 | } |
| 2428 | |
| 2429 | //////////////////////////////////////////////////////////////////////////////////////////// |
| 2430 | bool |
no test coverage detected