View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0010357VTK(No Category)public2010-03-02 23:162016-08-12 09:55
ReporterSam Barnes 
Assigned ToKitware Robot 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionmoved 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0010357: KeyPressActivation for vtkImagePlaneWidget not working
DescriptionKeyPressActivation for vtkImagePlaneWidget not working

The key press actication of the widget does not work (using version 5.4.2). I believe this is due to a change in revision 1.15 of vtkImagePlaneWidget.cxx.

Revision 1.15 introduced an implementation of OnChar(), this prevents the parent class implementation of OnChar() (in vtkInteractorObserver) from running. This is the one that provides the key press activation.

A fix is proposed below.
Additional InformationA simple fix is to combine the OnChar() code from vtkInteractorObserver and vtkImagePlaneWidget like this:

void vtkImagePlaneWidget::OnChar(void)
{
  //--------------
  //Code from vtkInteractorObserver::OnChar() version 5.4.2
  //--------------
  // catch additional keycodes otherwise
  if ( this->KeyPressActivation )
    {
    if (this->Interactor->GetKeyCode() == this->KeyPressActivationValue )
      {
      if ( !this->Enabled )
        {
        this->On();
        }
      else
        {
        this->Off();
        }
      this->KeyPressCallbackCommand->SetAbortFlag(1);
      return; //I Added this, not sure if necessary
      }
    }//if activation enabled
  

  //--------------
  //Original Code from vtkImagePlaneWidget::OnChar(void) version 5.4.2 (file revision 1.19)
  //--------------
  vtkRenderWindowInteractor *i = this->Interactor;
  if ( i->GetKeyCode() == 'r' || i->GetKeyCode() == 'R' )
    {
    if ( i->GetShiftKey() || i->GetControlKey() )
      {
      this->SetWindowLevel( this->OriginalWindow, this->OriginalLevel );
      double wl[2] = { this->CurrentWindow, this->CurrentLevel };

      this->EventCallbackCommand->SetAbortFlag(1);
      this->InvokeEvent(vtkCommand::ResetWindowLevelEvent, wl);
      }
    else
      {
      this->Interactor->GetInteractorStyle()->OnChar();
      }
    }
  else
    {
    this->Interactor->GetInteractorStyle()->OnChar();
    }
}

This restores proper functionality for this class. There is probably a more elegant solution though that will fix all inherited classes, but that is a little beyond me.
TagsNo tags attached.
Project
Type
Attached Files

 Relationships

  Notes
(0037149)
Kitware Robot (administrator)
2016-08-12 09:55

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current VTK Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2010-03-02 23:16 Sam Barnes New Issue
2011-06-16 13:11 Zack Galbreath Category => (No Category)
2016-08-12 09:55 Kitware Robot Note Added: 0037149
2016-08-12 09:55 Kitware Robot Status expired => closed
2016-08-12 09:55 Kitware Robot Resolution open => moved
2016-08-12 09:55 Kitware Robot Assigned To => Kitware Robot


Copyright © 2000 - 2018 MantisBT Team