Page MenuHomePhabricator

Define events for sychronized display interaction
Closed, ResolvedPublic

Description

Events should allow to accept a lambda function, that is processed with the event.
Those events should minimize the necessary checks inside the lambda function (filter sender, etc.).

Event Timeline

kalali triaged this task as Normal priority.Feb 15 2018, 7:03 PM
kalali created this task.
This comment was removed by kalali.

The task description is not valid anymore. A command-approach is used to connect std::functions that should be executed on a specific event.
The events are used to define on which invoked event the command should be used (execute its std::functions).

DisplayActionEvents are a subclass of itk::AnyEvent. They are further subclassed to provide methods for getting and setting event-specific properties (e.g. zoom factor).
The events are invoked by the DisplayActionEventBroadcast-class to inform the observer about a certain event.
The DisplayActionEventHandler-class can be used to set a command as an observer of a display action event. Such a command can contain a filter function and an action function which is used to check a condition and execute an action if the event was received.

The implementation is contained in T23760-Custom-multi-widget-editor (see mitkDisplayActionEvents.h; see mitkDisplayActionEventBroadcast.cpp and mitkDisplayActionEventFunctions.cpp for usage).