///////////////////////////////////////////////////////////////////////////////////////
| 2246 | |
| 2247 | //////////////////////////////////////////////////////////////////////////////////////////// |
| 2248 | bool |
| 2249 | pcl::visualization::PCLVisualizer::addCylinder (const pcl::ModelCoefficients &coefficients, |
| 2250 | const std::string &id, int viewport) |
| 2251 | { |
| 2252 | // Check to see if this ID entry already exists (has it been already added to the visualizer?) |
| 2253 | auto am_it = shape_actor_map_->find (id); |
| 2254 | if (am_it != shape_actor_map_->end ()) |
| 2255 | { |
| 2256 | pcl::console::print_warn (stderr, "[addCylinder] A shape with id <%s> already exists! Please choose a different id and retry.\n", id.c_str ()); |
| 2257 | return (false); |
| 2258 | } |
| 2259 | |
| 2260 | if (coefficients.values.size () != 7) |
| 2261 | { |
| 2262 | PCL_WARN ("[addCylinder] Coefficients size does not match expected size (expected 7).\n"); |
| 2263 | return (false); |
| 2264 | } |
| 2265 | |
| 2266 | vtkSmartPointer<vtkDataSet> data = createCylinder (coefficients); |
| 2267 | |
| 2268 | // Create an Actor |
| 2269 | vtkSmartPointer<vtkLODActor> actor; |
| 2270 | createActorFromVTKDataSet (data, actor); |
| 2271 | actor->GetProperty ()->SetRepresentationToSurface (); |
| 2272 | addActorToRenderer (actor, viewport); |
| 2273 | |
| 2274 | // Save the pointer/ID pair to the global actor map |
| 2275 | (*shape_actor_map_)[id] = actor; |
| 2276 | return (true); |
| 2277 | } |
| 2278 | |
| 2279 | //////////////////////////////////////////////////////////////////////////////////////////// |
| 2280 | bool |
no test coverage detected