[vtk-developers] deprecate vtkInteractorStyleTrackball

Sebastien BARRE sebastien.barre at kitware.com
Thu May 2 15:41:35 EDT 2002


Hi Bill

At 5/2/2002 03:10 PM, Lorensen, William E (Research) wrote:
>We have a class that subclasses from Interactor. It no longer builds!

No pb, send me the code :)

>"/home/lorensen/GEVTK/volume/vtkFunctionEditorInteractorStyle.cxx", line 
>101: Error: LastPos is not a member of vtkFunctionEditorInteractorStyle.

Rational: LastPos was an attribute that was used to keep track of the mouse 
position of the last event (not the current one, the previous one). It was 
highly dependent on the fact that each and everyone of the On...() 
functions would correctly track and update it. I noticed in several styles 
that it was not done correctly or consistently, leading to some bad 
side-effects (demonstrated by running the tests for example).

The problem was indeed plaguing the whole vtkInteractorStyle class, which 
had an incredible number of duplicate copy of piece of informations already 
available through the RenderWindowInteractor ( Center[2], DeltaAzimuth, 
DeltaElevation, CtrlKey, ShiftKey, LastPos[2], FocalDepth, etc., etc.).

As a result, the overall "stability" of each new incarnation of this class 
was getting worse over the time since each of its methods would (or would 
not) update parts or all of these duplicate informations, trying to keep it 
in sync with the RenderWindowInteractor and the user interactions.

My humble opinion is that the render window interactor should drive the 
interactor style, not the contrary (which I noticed in several methods). So 
I tried to clean these classes a bit (except the Unicam, which is too far 
from the standard and InteractorUser that should be deprecated) as well as 
enforce this behaviour, so that this hierarchy could be maintained in an 
easy way, as it used to be :)

As for LastPos is concerned, I've modified the SetEventPosition and 
SetEventInformation (etc.) in vtkRenderWindowInteractor so that each time 
the event position is set, the LastEventPosition[2] member saves the old 
position.

In that case, replace :
         this->LastPos
by:
         this->Interactor->GetLastEventPosition()

Warning: check that what you want is *really* the previous position. I 
noticed in several methods that this LastPos attribute was used in a way 
that implied that it should be the *current* position. This is not true, 
the current position is the EventPosition[2], as generated by a 
MouseMoveEvent for example.

>"/home/lorensen/GEVTK/volume/vtkFunctionEditorInteractorStyle.cxx", line 
>112: Error: CtrlKey is not a member of vtkFunctionEditorInteractorStyle.

In that case, replace :
         this->CtrlKey
by:
         this->Interactor->GetControlKey()

>"/home/lorensen/GEVTK/volume/vtkFunctionEditorInteractorStyle.cxx", line 
>113: Error: ShiftKey is not a member of vtkFunctionEditorInteractorStyle.

In that case, replace :
         this->ShiftKey
by:
         this->Interactor->GetShiftKey()


--
Sebastien Barre




More information about the vtk-developers mailing list