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

Method ProcessKeyEvents

Interaction/Widgets/vtkBoxWidget2.cxx:524–557  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

522
523//------------------------------------------------------------------------------
524void vtkBoxWidget2::ProcessKeyEvents(vtkObject*, unsigned long event, void* clientdata, void*)
525{
526 vtkBoxWidget2* self = static_cast<vtkBoxWidget2*>(clientdata);
527 vtkBoxRepresentation* rep = vtkBoxRepresentation::SafeDownCast(self->WidgetRep);
528 char* cKeySym = self->Interactor->GetKeySym();
529 std::string keySym = cKeySym != nullptr ? cKeySym : "";
530 std::transform(keySym.begin(), keySym.end(), keySym.begin(), ::toupper);
531 if (event == vtkCommand::KeyPressEvent)
532 {
533 if (keySym == "X")
534 {
535 rep->SetXTranslationAxisOn();
536 rep->SetRotationAxisModeToX();
537 }
538 else if (keySym == "Y")
539 {
540 rep->SetYTranslationAxisOn();
541 rep->SetRotationAxisModeToY();
542 }
543 else if (keySym == "Z")
544 {
545 rep->SetZTranslationAxisOn();
546 rep->SetRotationAxisModeToZ();
547 }
548 }
549 else if (event == vtkCommand::KeyReleaseEvent)
550 {
551 if (keySym == "X" || keySym == "Y" || keySym == "Z")
552 {
553 rep->SetTranslationAxisOff();
554 rep->SetRotationAxisModeToFree();
555 }
556 }
557}
558
559//------------------------------------------------------------------------------
560void vtkBoxWidget2::PrintSelf(ostream& os, vtkIndent indent)

Callers

nothing calls this directly

Calls 4

GetKeySymMethod · 0.80
transformFunction · 0.50
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected