------------------------------------------------------------------------------
| 271 | |
| 272 | //------------------------------------------------------------------------------ |
| 273 | void vtkCameraPathWidget::ProcessKeyEvents(vtkObject*, unsigned long event, void* clientdata, void*) |
| 274 | { |
| 275 | vtkCameraPathWidget* self = static_cast<vtkCameraPathWidget*>(clientdata); |
| 276 | vtkCameraPathRepresentation* rep = vtkCameraPathRepresentation::SafeDownCast(self->WidgetRep); |
| 277 | char* cKeySym = self->Interactor->GetKeySym(); |
| 278 | std::string keySym = cKeySym != nullptr ? cKeySym : ""; |
| 279 | std::transform(keySym.begin(), keySym.end(), keySym.begin(), ::toupper); |
| 280 | if (event == vtkCommand::KeyPressEvent) |
| 281 | { |
| 282 | if (keySym == "X") |
| 283 | { |
| 284 | rep->SetXTranslationAxisOn(); |
| 285 | } |
| 286 | else if (keySym == "Y") |
| 287 | { |
| 288 | rep->SetYTranslationAxisOn(); |
| 289 | } |
| 290 | else if (keySym == "Z") |
| 291 | { |
| 292 | rep->SetZTranslationAxisOn(); |
| 293 | } |
| 294 | } |
| 295 | else if (event == vtkCommand::KeyReleaseEvent) |
| 296 | { |
| 297 | if (keySym == "X" || keySym == "Y" || keySym == "Z") |
| 298 | { |
| 299 | rep->SetTranslationAxisOff(); |
| 300 | } |
| 301 | } |
| 302 | } |
| 303 | |
| 304 | //------------------------------------------------------------------------------ |
| 305 | void vtkCameraPathWidget::PrintSelf(ostream& os, vtkIndent indent) |