///////////////////////////////////////////////////////////////////////////////////////// Update the look up table displayed when 'u' is pressed
| 1156 | ////////////////////////////////////////////////////////////////////////////////////////////// |
| 1157 | // Update the look up table displayed when 'u' is pressed |
| 1158 | void |
| 1159 | pcl::visualization::PCLVisualizerInteractorStyle::updateLookUpTableDisplay (bool add_lut) |
| 1160 | { |
| 1161 | bool actor_found = false; |
| 1162 | |
| 1163 | if (!lut_enabled_ && !add_lut) |
| 1164 | return; |
| 1165 | |
| 1166 | if (!lut_actor_id_.empty()) // Search if provided actor id is in CloudActorMap or ShapeActorMap |
| 1167 | { |
| 1168 | auto am_it = cloud_actors_->find (lut_actor_id_); |
| 1169 | if (am_it == cloud_actors_->end ()) |
| 1170 | { |
| 1171 | auto sm_it = shape_actors_->find (lut_actor_id_); |
| 1172 | if (sm_it == shape_actors_->end ()) |
| 1173 | { |
| 1174 | PCL_WARN ("[updateLookUpTableDisplay] Could not find any actor with id <%s>!\n", lut_actor_id_.c_str ()); |
| 1175 | if (lut_enabled_) |
| 1176 | { // Remove LUT and exit |
| 1177 | CurrentRenderer->RemoveActor (lut_actor_); |
| 1178 | lut_enabled_ = false; |
| 1179 | } |
| 1180 | return; |
| 1181 | } |
| 1182 | |
| 1183 | // ShapeActor found |
| 1184 | vtkSmartPointer<vtkProp> *act = & (*sm_it).second; |
| 1185 | vtkSmartPointer<vtkActor> actor = vtkActor::SafeDownCast (*act); |
| 1186 | if (!actor || !actor->GetMapper ()->GetInput ()->GetPointData ()->GetScalars ()) |
| 1187 | { |
| 1188 | PCL_WARN ("[updateLookUpTableDisplay] id <%s> does not hold any color information!\n", lut_actor_id_.c_str ()); |
| 1189 | if (lut_enabled_) |
| 1190 | { // Remove LUT and exit |
| 1191 | CurrentRenderer->RemoveActor (lut_actor_); |
| 1192 | lut_enabled_ = false; |
| 1193 | } |
| 1194 | return; |
| 1195 | } |
| 1196 | |
| 1197 | lut_actor_->SetLookupTable (actor->GetMapper ()->GetLookupTable ()); |
| 1198 | lut_actor_->Modified (); |
| 1199 | actor_found = true; |
| 1200 | } |
| 1201 | else |
| 1202 | { |
| 1203 | // CloudActor |
| 1204 | CloudActor *act = & (*am_it).second; |
| 1205 | if (!act->actor->GetMapper ()->GetLookupTable () && !act->actor->GetMapper ()->GetInput ()->GetPointData ()->GetScalars ()) |
| 1206 | { |
| 1207 | PCL_WARN ("[updateLookUpTableDisplay] id <%s> does not hold any color information!\n", lut_actor_id_.c_str ()); |
| 1208 | if (lut_enabled_) |
| 1209 | { // Remove LUT and exit |
| 1210 | CurrentRenderer->RemoveActor (lut_actor_); |
| 1211 | lut_enabled_ = false; |
| 1212 | } |
| 1213 | return; |
| 1214 | } |
| 1215 |
no test coverage detected