////////////////////////////////////////////////////////////////////////////////////////
| 915 | |
| 916 | ///////////////////////////////////////////////////////////////////////////////////////////// |
| 917 | bool |
| 918 | pcl::visualization::PCLVisualizer::removeText3D (const std::string &id, int viewport) |
| 919 | { |
| 920 | if (viewport < 0) |
| 921 | return false; |
| 922 | |
| 923 | bool success = true; |
| 924 | |
| 925 | // If there is no custom viewport and the viewport number is not 0, exit |
| 926 | if (rens_->GetNumberOfItems () <= viewport) |
| 927 | { |
| 928 | PCL_ERROR ("[removeText3D] The viewport [%d] doesn't exist (id <%s>)!\n", |
| 929 | viewport, |
| 930 | id.c_str ()); |
| 931 | return false; |
| 932 | } |
| 933 | |
| 934 | // check all or an individual viewport for a similar id |
| 935 | rens_->InitTraversal (); |
| 936 | for (std::size_t i = viewport; rens_->GetNextItem (); ++i) |
| 937 | { |
| 938 | const std::string uid = id + std::string (i, '*'); |
| 939 | auto am_it = shape_actor_map_->find (uid); |
| 940 | |
| 941 | // was it found |
| 942 | if (am_it == shape_actor_map_->end ()) |
| 943 | { |
| 944 | if (viewport > 0) |
| 945 | return (false); |
| 946 | |
| 947 | continue; |
| 948 | } |
| 949 | |
| 950 | // Remove it from all renderers |
| 951 | if (removeActorFromRenderer (am_it->second, i)) |
| 952 | { |
| 953 | // Remove the pointer/ID pair to the global actor map |
| 954 | shape_actor_map_->erase (am_it); |
| 955 | if (viewport > 0) |
| 956 | return (true); |
| 957 | |
| 958 | success &= true; |
| 959 | } |
| 960 | else |
| 961 | success = false; |
| 962 | } |
| 963 | |
| 964 | return success; |
| 965 | } |
| 966 | |
| 967 | ///////////////////////////////////////////////////////////////////////////////////////////// |
| 968 | bool |