Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Simplify logic in vtkMRMLViewInteractorStyle::CustomProcessEvents #7495

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jcfr
Copy link
Member

@jcfr jcfr commented Dec 19, 2023

Considering that:

  1. we always have to first attempt to delegate to our displayable managers, and then call the "regular" interactor style processing only if these are not "delegated", checking for the interaction state is not needed.
  2. we are not observing events like InteractionEvent, StartInteractionEvent or EndInteractionEvent currently used to process interaction state in regular VTK widgets.

... we remove the check of the interaction state.

For reference,this logic was initially introduced in 364ff7b (ENH: Use common interactor style for slice and 3D views). At the time of that commit1, the function DelegateInteractionEventToDisplayableManagers was invoked once at the beginning of CustomProcessEvents for each events only if "state" was not VTKIS_NONE. It was also systematically invoked in the overridden OnXXX() functions, called as a side effect of Superclass::ProcessEvents.

Following the refactoring introduced in commit 1cc3b2c (ENH: Improve Event Delegation in qMRMLThreeDView and qMRMLSliceView), the function DelegateInteractionEventToDisplayableManagers now ends up being called only once for all observed events and then the "original" interactor style function are called from vtkMRMLViewInteractorStyle::ProcessEvents().

Footnotes

  1. https://github.com/Slicer/Slicer/blob/364ff7b6d4758629b8659712fdec990d8bddd81b/Libs/MRML/DisplayableManager/vtkMRMLViewInteractorStyle.cxx#L351-L360

Considering that:
1. we always have to first attempt to delegate to our displayable managers,
and then call the "regular" interactor style processing only if these are
not "delegated", checking for the interaction state is not needed.
2. we are not observing events like InteractionEvent, StartInteractionEvent
or EndInteractionEvent currently used to process interaction state in
regular VTK widgets.

... we remove the check of the interaction state.

For reference,this logic was initially introduced in 364ff7b (`ENH: Use
common interactor style for slice and 3D views`). At the time of that commit[^1],
the function `DelegateInteractionEventToDisplayableManagers` was invoked
once at the beginning of `CustomProcessEvents` for each events only if
"state" was not VTKIS_NONE. It was also systematically invoked in the
overridden `OnXXX()` functions, called as a side effect of `Superclass::ProcessEvents`.

Following the refactoring introduced in commit 1cc3b2c (`ENH: Improve
Event Delegation in qMRMLThreeDView and qMRMLSliceView`), the function
`DelegateInteractionEventToDisplayableManagers` now ends up being called
only once for all observed events and then the "original" interactor
style function are called from `vtkMRMLViewInteractorStyle::ProcessEvents()`.

[^1]: https://github.com/Slicer/Slicer/blob/364ff7b6d4758629b8659712fdec990d8bddd81b/Libs/MRML/DisplayableManager/vtkMRMLViewInteractorStyle.cxx#L351-L360
@jcfr jcfr changed the title ENH: Simplify logic in vtkMRMLViewInteractorStyle::CustomProcessEvents ENH: Simplify logic in vtkMRMLViewInteractorStyle::CustomProcessEvents Dec 19, 2023
@jcfr jcfr force-pushed the remove-obsolete-check-from-vtkMRMLViewInteractorStyle-CustomProcessEvents branch from 7f18f6b to abcf009 Compare December 19, 2023 11:22
@jcfr
Copy link
Member Author

jcfr commented Dec 19, 2023

I just understood something critical related to how event handling was implemented the way it was. I will be addressing the issue and add documentation as expected.

@jcfr jcfr marked this pull request as draft December 22, 2023 06:10
@jcfr jcfr added the Status: Draft This pull-request is not yet ready for integration label Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Draft This pull-request is not yet ready for integration
Development

Successfully merging this pull request may close these issues.

None yet

1 participant