MCPcopy Create free account
hub / github.com/Kitware/VTK / OnChar

Method OnChar

Interaction/Style/vtkInteractorStyleImage.cxx:380–443  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

378
379//------------------------------------------------------------------------------
380void 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();

Callers

nothing calls this directly

Calls 15

SetImageOrientationMethod · 0.95
GetKeySymMethod · 0.80
FlyToImageMethod · 0.80
GetPickPositionMethod · 0.80
HasObserverMethod · 0.80
InvokeEventMethod · 0.80
RenderMethod · 0.65
transformFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
FindPokedRendererMethod · 0.45
PickMethod · 0.45

Tested by

no test coverage detected