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

Manages event distribution. More...

#include <mitkDispatcher.h>

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

Public Types

typedef Dispatcher Self
 
typedef itk::LightObject Superclass
 
typedef itk::SmartPointer< SelfPointer
 
typedef itk::SmartPointer< const SelfConstPointer
 
typedef std::list< mitk::WeakPointer< DataInteractor > > ListInteractorType
 
typedef std::list< itk::SmartPointer< InteractionEvent > > ListEventsType
 

Public Member Functions

virtual std::vector< std::string > GetClassHierarchy () const
 
virtual const char * GetClassName () const
 
bool ProcessEvent (InteractionEvent *event)
 
void QueueEvent (InteractionEvent *event)
 
void AddDataInteractor (const DataNode *dataNode)
 
void RemoveDataInteractor (const DataNode *dataNode)
 
vcl_size_t GetNumberOfInteractors ()
 

Static Public Member Functions

static const char * GetStaticNameOfClass ()
 
static Pointer New (const std::string &_arg)
 

Protected Member Functions

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

Detailed Description

Manages event distribution.

Receives Events (Mouse-,Key-, ... Events) and dispatches them to the registered DataInteractor Objects. The order in which DataInteractors are offered to handle an event is determined by layer of their associated DataNode. Higher layers are preferred.

Definition at line 48 of file mitkDispatcher.h.

Member Typedef Documentation

Definition at line 51 of file mitkDispatcher.h.

Definition at line 51 of file mitkDispatcher.h.

Definition at line 51 of file mitkDispatcher.h.

typedef itk::LightObject mitk::Dispatcher::Superclass

Definition at line 51 of file mitkDispatcher.h.

Constructor & Destructor Documentation

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

Definition at line 93 of file mitkDispatcher.cpp.

Member Function Documentation

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

Adds the DataInteractor that is associated with the DataNode to the Dispatcher Queue. If there already exists an DataInteractor that has a reference to the same DataNode, it is removed. Note that within this method also all other DataInteractors are checked and removed if they are no longer active, and were not removed properly.

Definition at line 54 of file mitkDispatcher.cpp.

References mitk::DataNode::GetDataInteractor().

virtual std::vector<std::string> mitk::Dispatcher::GetClassHierarchy ( ) const
inlinevirtual

Definition at line 51 of file mitkDispatcher.h.

virtual const char* mitk::Dispatcher::GetClassName ( ) const
virtual
vcl_size_t mitk::Dispatcher::GetNumberOfInteractors ( )

Definition at line 88 of file mitkDispatcher.cpp.

static const char* mitk::Dispatcher::GetStaticNameOfClass ( )
inlinestatic

Definition at line 51 of file mitkDispatcher.h.

static Pointer mitk::Dispatcher::New ( const std::string &  _arg)
inlinestatic
bool mitk::Dispatcher::ProcessEvent ( InteractionEvent event)

To post new Events which are to be handled by the Dispatcher.

Returns
Returns true if the event has been handled by an DataInteractor, and false else.

Definition at line 101 of file mitkDispatcher.cpp.

References mitk::BaseRenderer::GetRenderWindow(), mitk::InteractionEvent::GetSender(), mitk::InteractionEventObserver::IsEnabled(), and mitk::InteractionEventObserver::Notify().

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

Adds an Event to the Dispatchers EventQueue, these events will be processed after a a regular posted event has been fully handled. This allows DataInteractors to post their own events without interrupting regular Dispatching workflow. It is important to note that the queued events will be processed AFTER the state change of a current transition (which queued the events) is performed.

Note
1) If an event is added from an other source than an DataInteractor / Observer its execution will be delayed until the next regular event comes in.
2) Make sure you're not causing infinite loops!

Definition at line 255 of file mitkDispatcher.cpp.

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

Remove all DataInteractors related to this Node, to prevent double entries and dead references.

Definition at line 73 of file mitkDispatcher.cpp.


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