Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::Dispatcher Class Reference

Central event distribution hub for interaction events. More...

#include <mitkDispatcher.h>

Inheritance diagram for mitk::Dispatcher:
Collaboration diagram for mitk::Dispatcher:

Public Types

typedef std::list< mitk::WeakPointer< DataInteractor > > ListInteractorType
 List type for storing weak pointers to DataInteractors. More...
 
typedef std::list< itk::SmartPointer< InteractionEvent > > ListEventsType
 List type for storing queued InteractionEvents. More...
 

Public Member Functions

 mitkClassMacroItkParent (Dispatcher, itk::LightObject)
 
 mitkNewMacro1Param (Self, const std::string &)
 
bool ProcessEvent (InteractionEvent *event)
 Process an interaction event by dispatching it to registered DataInteractors. More...
 
void QueueEvent (InteractionEvent *event)
 Queue an event for deferred processing. More...
 
void AddDataInteractor (const DataNode *dataNode)
 Register the DataInteractor associated with the given DataNode. More...
 
void RemoveDataInteractor (const DataNode *dataNode)
 Remove all DataInteractors associated with the given DataNode. More...
 
size_t GetNumberOfInteractors ()
 Get the number of currently registered DataInteractors. More...
 

Protected Member Functions

 Dispatcher (const std::string &rendererName)
 
 ~Dispatcher () override
 

Detailed Description

Central event distribution hub for interaction events.

The Dispatcher receives InteractionEvents (mouse, key, etc.) and dispatches them to registered DataInteractor objects. The order in which DataInteractors are offered an event is determined by the "layer" property of their associated DataNode – higher layers are preferred.

After all DataInteractors have been offered the event, registered InteractionEventObserver instances are notified.

The Dispatcher supports several processing modes (REGULAR, GRABINPUT, PREFERINPUT, CONNECTEDMOUSEACTION) that control how events are routed during ongoing interactions such as mouse drags.

See also
DataInteractor
InteractionEventObserver
BaseRenderer

Definition at line 54 of file mitkDispatcher.h.

Member Typedef Documentation

◆ ListEventsType

List type for storing queued InteractionEvents.

Definition at line 63 of file mitkDispatcher.h.

◆ ListInteractorType

List type for storing weak pointers to DataInteractors.

Definition at line 61 of file mitkDispatcher.h.

Constructor & Destructor Documentation

◆ Dispatcher()

mitk::Dispatcher::Dispatcher ( const std::string &  rendererName)
protected

◆ ~Dispatcher()

mitk::Dispatcher::~Dispatcher ( )
overrideprotected

Member Function Documentation

◆ AddDataInteractor()

void mitk::Dispatcher::AddDataInteractor ( const DataNode *  dataNode)

Register the DataInteractor associated with the given DataNode.

If a DataInteractor for the same DataNode already exists, it is removed first. Orphaned interactors (without valid DataNodes) are also cleaned up.

Parameters
[in]dataNodeThe DataNode whose DataInteractor should be registered.

◆ GetNumberOfInteractors()

size_t mitk::Dispatcher::GetNumberOfInteractors ( )

Get the number of currently registered DataInteractors.

Returns
The number of interactors.

◆ mitkClassMacroItkParent()

mitk::Dispatcher::mitkClassMacroItkParent ( Dispatcher  ,
itk::LightObject   
)

◆ mitkNewMacro1Param()

mitk::Dispatcher::mitkNewMacro1Param ( Self  ,
const std::string &   
)

◆ ProcessEvent()

bool mitk::Dispatcher::ProcessEvent ( InteractionEvent *  event)

Process an interaction event by dispatching it to registered DataInteractors.

The event is offered to DataInteractors in order of descending layer. Internal events are handled separately. After dispatching, all registered InteractionEventObservers are notified. Queued events are processed after the current event is fully handled.

Parameters
[in]eventThe interaction event to process.
Returns
true if the event was handled by a DataInteractor, false otherwise.

◆ QueueEvent()

void mitk::Dispatcher::QueueEvent ( InteractionEvent *  event)

Queue an event for deferred processing.

Queued events are processed after the currently dispatched event has been fully handled (including state transitions). This allows DataInteractors to post follow-up events without interrupting the current dispatch.

Parameters
[in]eventThe event to enqueue.
Note
Events queued from outside a DataInteractor/Observer will be delayed until the next regular event arrives.
Be careful not to cause infinite loops.

◆ RemoveDataInteractor()

void mitk::Dispatcher::RemoveDataInteractor ( const DataNode *  dataNode)

Remove all DataInteractors associated with the given DataNode.

Parameters
[in]dataNodeThe DataNode whose interactors should be removed.

The documentation for this class was generated from the following file: