------------------------------------------------------------------------------
| 378 | |
| 379 | //------------------------------------------------------------------------------ |
| 380 | void vtkInteractorStyleImage::OnChar() |
| 381 | { |
| 382 | vtkRenderWindowInteractor* rwi = this->Interactor; |
| 383 | char* cKeySym = rwi->GetKeySym(); |
| 384 | std::string keySym = cKeySym != nullptr ? cKeySym : ""; |
| 385 | std::transform(keySym.begin(), keySym.end(), keySym.begin(), ::toupper); |
| 386 | if (keySym == "F") |
| 387 | { |
| 388 | this->AnimState = VTKIS_ANIM_ON; |
| 389 | vtkAssemblyPath* path = nullptr; |
| 390 | this->FindPokedRenderer(rwi->GetEventPosition()[0], rwi->GetEventPosition()[1]); |
| 391 | rwi->GetPicker()->Pick( |
| 392 | rwi->GetEventPosition()[0], rwi->GetEventPosition()[1], 0.0, this->CurrentRenderer); |
| 393 | vtkAbstractPropPicker* picker; |
| 394 | if ((picker = vtkAbstractPropPicker::SafeDownCast(rwi->GetPicker()))) |
| 395 | { |
| 396 | path = picker->GetPath(); |
| 397 | } |
| 398 | if (path != nullptr) |
| 399 | { |
| 400 | rwi->FlyToImage(this->CurrentRenderer, picker->GetPickPosition()); |
| 401 | } |
| 402 | this->AnimState = VTKIS_ANIM_OFF; |
| 403 | } |
| 404 | else if (keySym == "R") |
| 405 | { |
| 406 | // Allow either shift/ctrl to trigger the usual 'r' binding |
| 407 | // otherwise trigger reset window level event |
| 408 | if (rwi->GetShiftKey() || rwi->GetControlKey()) |
| 409 | { |
| 410 | this->Superclass::OnChar(); |
| 411 | } |
| 412 | else if (this->HandleObservers && this->HasObserver(vtkCommand::ResetWindowLevelEvent)) |
| 413 | { |
| 414 | this->InvokeEvent(vtkCommand::ResetWindowLevelEvent, this); |
| 415 | } |
| 416 | else if (this->CurrentImageProperty) |
| 417 | { |
| 418 | vtkImageProperty* property = this->CurrentImageProperty; |
| 419 | property->SetColorWindow(this->WindowLevelInitial[0]); |
| 420 | property->SetColorLevel(this->WindowLevelInitial[1]); |
| 421 | this->Interactor->Render(); |
| 422 | } |
| 423 | } |
| 424 | else if (keySym == "X") |
| 425 | { |
| 426 | this->SetImageOrientation(this->XViewRightVector, this->XViewUpVector); |
| 427 | this->Interactor->Render(); |
| 428 | } |
| 429 | else if (keySym == "Y") |
| 430 | { |
| 431 | this->SetImageOrientation(this->YViewRightVector, this->YViewUpVector); |
| 432 | this->Interactor->Render(); |
| 433 | } |
| 434 | else if (keySym == "Z") |
| 435 | { |
| 436 | this->SetImageOrientation(this->ZViewRightVector, this->ZViewUpVector); |
| 437 | this->Interactor->Render(); |
nothing calls this directly
no test coverage detected