///////////////////////////////////////////////////////////////////////////////////////
| 2278 | |
| 2279 | //////////////////////////////////////////////////////////////////////////////////////////// |
| 2280 | bool |
| 2281 | pcl::visualization::PCLVisualizer::addCube (const pcl::ModelCoefficients &coefficients, |
| 2282 | const std::string &id, int viewport) |
| 2283 | { |
| 2284 | // Check to see if this ID entry already exists (has it been already added to the visualizer?) |
| 2285 | auto am_it = shape_actor_map_->find (id); |
| 2286 | if (am_it != shape_actor_map_->end ()) |
| 2287 | { |
| 2288 | pcl::console::print_warn (stderr, "[addCube] A shape with id <%s> already exists! Please choose a different id and retry.\n", id.c_str ()); |
| 2289 | return (false); |
| 2290 | } |
| 2291 | |
| 2292 | if (coefficients.values.size () != 10) |
| 2293 | { |
| 2294 | PCL_WARN ("[addCube] Coefficients size does not match expected size (expected 10).\n"); |
| 2295 | return (false); |
| 2296 | } |
| 2297 | |
| 2298 | vtkSmartPointer<vtkDataSet> data = createCube (coefficients); |
| 2299 | |
| 2300 | // Create an Actor |
| 2301 | vtkSmartPointer<vtkLODActor> actor; |
| 2302 | createActorFromVTKDataSet (data, actor); |
| 2303 | actor->GetProperty ()->SetRepresentationToSurface (); |
| 2304 | addActorToRenderer (actor, viewport); |
| 2305 | |
| 2306 | // Save the pointer/ID pair to the global actor map |
| 2307 | (*shape_actor_map_)[id] = actor; |
| 2308 | return (true); |
| 2309 | } |
| 2310 | |
| 2311 | //////////////////////////////////////////////////////////////////////////////////////////// |
| 2312 | bool |
no test coverage detected