ALBA
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
albaInteractor Class Reference

#include <albaInteractor.h>

Inheritance diagram for albaInteractor:
Inheritance graph
[legend]
Collaboration diagram for albaInteractor:
Collaboration graph
[legend]

Public Types

enum  modalities { SINGLE_BUTTON_MODE =0 , MULTI_BUTTON_MODE }
 

Public Member Functions

 albaInteractor ()
 
virtual ~albaInteractor ()
 
 ALBA_ID_DEC (INTERACTION_STARTED)
 
 ALBA_ID_DEC (INTERACTION_STOPPED)
 
 ALBA_ID_DEC (BUTTON_DOWN)
 
 ALBA_ID_DEC (BUTTON_UP)
 
 albaAbstractTypeMacro (albaInteractor, albaAgent)
 
virtual void SetRendererAndView (vtkRenderer *ren, albaView *view)
 
vtkRenderer * GetRenderer ()
 
albaViewGetView ()
 
albaDeviceGetDevice ()
 
virtual void SetDevice (albaDevice *)
 
virtual void SetVME (albaVME *vme)
 
void SetProp (vtkProp3D *prop)
 
void SetIgnoreTriggerEvents (bool flag)
 
int GetIgnoreTriggerEvents (bool flag)
 
void IgnoreTriggerEventsOn ()
 
void IgnoreTriggerEventsOff ()
 
void SetStartInteractionEvent (albaID event)
 
albaID GetStartInteractionEvent ()
 
void SetStopInteractionEvent (albaID event)
 
albaID GetStopInteractionEvent ()
 
void SetStartButton (int btn)
 
int GetStartButton ()
 
void SetModifiers (int mod)
 
int GetModifiers ()
 
int GetCurrentButton ()
 
unsigned long GetCurrentModifier ()
 
virtual int StartInteraction (albaDevice *device)
 
virtual int StopInteraction (albaDevice *device)
 
virtual bool IsInteracting ()
 
virtual bool IsInteracting (albaDevice *device)
 
void SetButtonMode (int mode)
 
int GetButtonMode ()
 
void SetButtonModeToSingleButton ()
 
void SetButtonModeToMultiButton ()
 
virtual void OnEvent (albaEventBase *event)
 
void TestModeOn ()
 
void TestModeOff ()
 
bool GetTestMode ()
 
- Public Member Functions inherited from albaAgent
 albaAbstractTypeMacro (albaAgent, albaReferenceCounted)
 
 ALBA_ID_DEC (AGENT_INITIALIZE)
 
void AddObserver (albaObserver *listener, albaID channel=MCH_UP)
 
void RemoveObserver (albaObserver *listener)
 
void RemoveAllObservers ()
 
virtual void OnEvent (albaEventBase *event)
 
bool HasObservers (albaID channel)
 
void GetObservers (albaID channel, std::vector< albaObserver * > &olist)
 
int Initialize ()
 
void Shutdown ()
 
int IsInitialized ()
 
virtual void SetName (const char *name)
 
const char * GetName ()
 
- Public Member Functions inherited from albaReferenceCounted
 albaReferenceCounted ()
 
virtual ~albaReferenceCounted ()
 
 albaAbstractTypeMacro (albaReferenceCounted, albaObject)
 
virtual void Delete ()
 
void Register (void *obj)
 
virtual void UnRegister (void *obj)
 
int GetReferenceCount ()
 
void SetReferenceCount (int)
 
- Public Member Functions inherited from albaObject
 albaObject ()
 
virtual ~albaObject ()
 
virtual void Delete ()
 
virtual const char * GetTypeName () const
 
virtual bool IsA (const char *type_name) const
 
virtual bool IsA (const albaTypeID &type_id) const
 
virtual albaObjectNewObjectInstance () const =0
 
virtual const albaTypeIDGetTypeId () const
 
virtual void Print (std::ostream &os, const int indent=0) const
 
 albaObject (const albaObject &c)
 
- Public Member Functions inherited from albaObserver
 albaObserver ()
 
virtual ~albaObserver ()
 
virtual void OnEvent (albaEventBase *e)=0
 
- Public Member Functions inherited from albaEventBroadcaster
 albaEventBroadcaster (void *owner=NULL)
 
virtual ~albaEventBroadcaster ()
 
 albaEventBroadcaster (const albaEventBroadcaster &c)
 
void AddObserver (albaObserver *obj)
 
void AddObserver (albaObserver &obj)
 
albaObserverCallbackAddObserverCallback (void(*f)(void *sender, albaID eid, void *clientdata, void *calldata))
 
bool RemoveObserver (albaObserver *obj)
 
void RemoveAllObservers ()
 
bool IsObserver (albaObserver *obj)
 
bool HasObservers ()
 
void GetObservers (std::vector< albaObserver * > &olist)
 
void InvokeEvent (albaEventBase &e)
 
void InvokeEvent (albaEventBase *e)
 
void InvokeEvent (void *sender, albaID id=ID_NO_EVENT, void *data=NULL)
 
void SetChannel (albaID ch)
 
albaID GetChannel ()
 
virtual void SetListener (albaObserver *o)
 
- Public Member Functions inherited from albaEventSender
 albaEventSender ()
 
virtual void SetListener (albaObserver *o)
 
virtual albaObserverGetListener ()
 
virtual bool HasListener ()
 
virtual void InvokeEvent (albaEventBase &e)
 
virtual void InvokeEvent (albaEventBase *e)
 
virtual void InvokeEvent (void *sender, albaID id=ID_NO_EVENT, void *data=NULL)
 

Protected Member Functions

virtual int OnStartInteraction (albaEventInteraction *e)
 
virtual int OnStopInteraction (albaEventInteraction *e)
 
virtual void OnButtonDown (albaEventInteraction *e)
 
virtual void OnButtonUp (albaEventInteraction *e)
 
void ComputeDisplayToWorld (double x, double y, double z, double worldPt[4])
 
void ComputeWorldToDisplay (double x, double y, double z, double displayPt[3])
 
- Protected Member Functions inherited from albaAgent
 albaAgent ()
 
virtual ~albaAgent ()
 
virtual int InternalInitialize ()
 
virtual void InternalShutdown ()
 
void InvokeEvent (albaEventBase &event, albaID channel=-1)
 
void InvokeEvent (albaEventBase *event, albaID channel=-1)
 
void InvokeEvent (void *sender, int id, albaID channel=MCH_UP, void *data=NULL)
 

Protected Attributes

albaDevicem_Device
 
bool m_DeviceIsSet
 
albaID m_StartInteractionEvent
 
albaID m_StopInteractionEvent
 
int m_IgnoreTriggerEvents
 
int m_InteractionFlag
 
int m_StartButton
 
unsigned long m_Modifiers
 
int m_CurrentButton
 
unsigned long m_CurrentModifier
 
int m_ButtonMode
 
int m_ButtonsCounter
 
albaVMEm_VME
 
albaViewm_View
 
vtkALBASmartPointer< vtkRenderer > m_Renderer
 
vtkALBASmartPointer< vtkProp3D > m_Prop
 
bool m_TestMode
 
- Protected Attributes inherited from albaAgent
albaString m_Name
 
bool m_Initialized
 
std::vector< albaEventBroadcaster * > m_Channels
 
- Protected Attributes inherited from albaReferenceCounted
int m_ReferenceCount
 
- Protected Attributes inherited from albaObject
bool m_HeapFlag
 
- Protected Attributes inherited from albaEventBroadcaster
albaObserversList m_Observers
 
albaID m_Channel
 
- Protected Attributes inherited from albaEventSender
albaObserverm_Listener
 

Additional Inherited Members

- Static Public Member Functions inherited from albaObject
static const char * GetStaticTypeName ()
 
static bool IsStaticType (const char *type_name)
 
static bool IsStaticType (const albaTypeID &type_id)
 
static const albaTypeIDGetStaticTypeId ()
 
static albaObjectSafeDownCast (albaObject *o)
 
- Protected Types inherited from albaEventBroadcaster
typedef std::list< albaObserver * > albaObserversList
 

Detailed Description

Abstract class for ALBA interactors This class provides base interface and features of ALBA continuous event interactors.

Among the available features we find support for a current renderer member variable, that may be used by interactors to perform interaction according to user point of view, current device member variable, where the device performing the interaction is stored. In general the interactor starts working when a StartInteraction event is received and stops interacting when a m_StopInteractionEvent arrives. These two events are by default mapped to BUTTON_DOWN and BUTTON_UP, but can be redefined as necessary. The interactor can also be programmed to ignore start and stop interaction events and run continuously. During an interaction session the current render window and the current device cannot be changed!!! Subclasses can redefine StartInteraction() and StopInteraction() functions to perform special tasks on starting/stopping of the interaction. When interaction is started the device is locked The interactor class can be programmed in different ways:

Interactors usually send output events through the DefaultChannel, and also through the m_listener by wrapping the event inside a MFL_EVENT_ID event (event can be retrieved with albaEvent::GetVtkObject().

Definition at line 60 of file albaInteractor.h.

Member Enumeration Documentation

◆ modalities

Enumerator
SINGLE_BUTTON_MODE 
MULTI_BUTTON_MODE 

Definition at line 147 of file albaInteractor.h.

Constructor & Destructor Documentation

◆ albaInteractor()

albaInteractor::albaInteractor ( )

◆ ~albaInteractor()

virtual albaInteractor::~albaInteractor ( )
virtual

Member Function Documentation

◆ ALBA_ID_DEC() [1/4]

albaInteractor::ALBA_ID_DEC ( INTERACTION_STARTED  )

Issued when interaction is started.

◆ ALBA_ID_DEC() [2/4]

albaInteractor::ALBA_ID_DEC ( INTERACTION_STOPPED  )

Issued when interaction is stopped.

◆ ALBA_ID_DEC() [3/4]

albaInteractor::ALBA_ID_DEC ( BUTTON_DOWN  )

Issued when a button is pressed.

◆ ALBA_ID_DEC() [4/4]

albaInteractor::ALBA_ID_DEC ( BUTTON_UP  )

Issued when a button is released.

◆ albaAbstractTypeMacro()

albaInteractor::albaAbstractTypeMacro ( albaInteractor  ,
albaAgent   
)

◆ SetRendererAndView()

virtual void albaInteractor::SetRendererAndView ( vtkRenderer *  ren,
albaView view 
)
virtual

Set/Get the renderer this interactor is attached to.

This methods is redefined in subclasses to perform specialized actions when the renderer is changed

Reimplemented in albaAvatar, albaAvatar3D, albaInteractorDICOMImporter, and albaInteractorGenericInterface.

◆ GetRenderer()

vtkRenderer * albaInteractor::GetRenderer ( )
inline

Definition at line 80 of file albaInteractor.h.

◆ GetView()

albaView * albaInteractor::GetView ( )
inline

Definition at line 81 of file albaInteractor.h.

◆ GetDevice()

albaDevice * albaInteractor::GetDevice ( )
inline

Return the current input device.

Definition at line 84 of file albaInteractor.h.

Referenced by albaInteractorPER::OnVmeSelected().

◆ SetDevice()

virtual void albaInteractor::SetDevice ( albaDevice )
virtual

Set the current input device.

◆ SetVME()

virtual void albaInteractor::SetVME ( albaVME vme)
virtual

Set the node to be transformed.

Reimplemented in albaInteractorGenericInterface.

◆ SetProp()

void albaInteractor::SetProp ( vtkProp3D *  prop)

Set the prop to be transformed (optional and to be removed!!!)

◆ SetIgnoreTriggerEvents()

void albaInteractor::SetIgnoreTriggerEvents ( bool  flag)
inline

Enable/Disable trigger events processing.

Trigger events are StartInteraction and StopInteraction events which are used to start/stop the interaction. If enabled this flag makes the interactor to ignore these events and to be continuously active. Default is false.

Definition at line 99 of file albaInteractor.h.

Referenced by albaInteractor6DOF::IgnoreTriggerEventsOff(), and albaInteractor6DOF::IgnoreTriggerEventsOn().

◆ GetIgnoreTriggerEvents()

int albaInteractor::GetIgnoreTriggerEvents ( bool  flag)
inline

Definition at line 100 of file albaInteractor.h.

◆ IgnoreTriggerEventsOn()

void albaInteractor::IgnoreTriggerEventsOn ( )
inline

Definition at line 101 of file albaInteractor.h.

◆ IgnoreTriggerEventsOff()

void albaInteractor::IgnoreTriggerEventsOff ( )
inline

Definition at line 102 of file albaInteractor.h.

◆ SetStartInteractionEvent()

void albaInteractor::SetStartInteractionEvent ( albaID  event)
inline

Set the event used to trigger the start of an interaction session.

Definition at line 105 of file albaInteractor.h.

◆ GetStartInteractionEvent()

albaID albaInteractor::GetStartInteractionEvent ( )
inline

Get the event used to trigger the start of an interaction session.

Definition at line 107 of file albaInteractor.h.

◆ SetStopInteractionEvent()

void albaInteractor::SetStopInteractionEvent ( albaID  event)
inline

Set the event used to trigger the end of an interaction session.

Definition at line 110 of file albaInteractor.h.

◆ GetStopInteractionEvent()

albaID albaInteractor::GetStopInteractionEvent ( )
inline

Set the event used to trigger the end of an interaction session.

Definition at line 112 of file albaInteractor.h.

◆ SetStartButton()

void albaInteractor::SetStartButton ( int  btn)
inline

Set the modifier that should start the interaction.

Definition at line 115 of file albaInteractor.h.

◆ GetStartButton()

int albaInteractor::GetStartButton ( )
inline

Definition at line 116 of file albaInteractor.h.

◆ SetModifiers()

void albaInteractor::SetModifiers ( int  mod)
inline

Set the modifier that should start the interaction.

Definition at line 119 of file albaInteractor.h.

◆ GetModifiers()

int albaInteractor::GetModifiers ( )
inline

Definition at line 120 of file albaInteractor.h.

◆ GetCurrentButton()

int albaInteractor::GetCurrentButton ( )
inline

return the button which started the interaction

Definition at line 123 of file albaInteractor.h.

◆ GetCurrentModifier()

unsigned long albaInteractor::GetCurrentModifier ( )
inline

return the modifers at start of interaction

Definition at line 126 of file albaInteractor.h.

◆ StartInteraction()

virtual int albaInteractor::StartInteraction ( albaDevice device)
virtual

Start the interaction, the optional argument force sending an event on the DefaultChannel advising the interaction has started.

This function is responsible to decide if the interaction can start. It also stores the m_Device starting the interaction and locks it and locks the interactor itself.

◆ StopInteraction()

virtual int albaInteractor::StopInteraction ( albaDevice device)
virtual

Stop the interaction, the optional argument force sending an event on the DefaultChannel advising the interaction has started.

This also unlock the device.

◆ IsInteracting() [1/2]

virtual bool albaInteractor::IsInteracting ( )
virtual

return true if currently in a interaction session

◆ IsInteracting() [2/2]

virtual bool albaInteractor::IsInteracting ( albaDevice device)
virtual

return true if the specified device is currently in a interaction session

◆ SetButtonMode()

void albaInteractor::SetButtonMode ( int  mode)
inline

Definition at line 149 of file albaInteractor.h.

◆ GetButtonMode()

int albaInteractor::GetButtonMode ( )
inline

Definition at line 150 of file albaInteractor.h.

◆ SetButtonModeToSingleButton()

void albaInteractor::SetButtonModeToSingleButton ( )
inline

Definition at line 151 of file albaInteractor.h.

◆ SetButtonModeToMultiButton()

void albaInteractor::SetButtonModeToMultiButton ( )
inline

Definition at line 152 of file albaInteractor.h.

◆ OnEvent()

virtual void albaInteractor::OnEvent ( albaEventBase event)
virtual

◆ TestModeOn()

void albaInteractor::TestModeOn ( )
inline

Turn On m_TestMode flag.

Definition at line 159 of file albaInteractor.h.

◆ TestModeOff()

void albaInteractor::TestModeOff ( )
inline

Used to turn off m_TestMode flag.

Definition at line 162 of file albaInteractor.h.

◆ GetTestMode()

bool albaInteractor::GetTestMode ( )
inline

Get TestMode.

Definition at line 165 of file albaInteractor.h.

◆ OnStartInteraction()

virtual int albaInteractor::OnStartInteraction ( albaEventInteraction e)
protectedvirtual

Process StartInteractionEvent.

If m_IgnoreTriggerEvents flag or interaction is alredy ongoing it does nothing and return false (0), else if the event is one of main three buttons return true, else false. Subclasses can redefine this function to add support for extra buttons.

Reimplemented in albaInteractorPER, and albaInteractor6DOF.

◆ OnStopInteraction()

virtual int albaInteractor::OnStopInteraction ( albaEventInteraction e)
protectedvirtual

Process m_StopInteractionEvent.

If interaction is not ongoing or sender is not the m_Device who started the interaction does nothing and return false, else return true. Subclasses can redefine this function to add extra functionalities.

Reimplemented in albaInteractorPER, and albaInteractor6DOF.

◆ OnButtonDown()

virtual void albaInteractor::OnButtonDown ( albaEventInteraction e)
protectedvirtual

◆ OnButtonUp()

virtual void albaInteractor::OnButtonUp ( albaEventInteraction e)
protectedvirtual

◆ ComputeDisplayToWorld()

void albaInteractor::ComputeDisplayToWorld ( double  x,
double  y,
double  z,
double  worldPt[4] 
)
protected

◆ ComputeWorldToDisplay()

void albaInteractor::ComputeWorldToDisplay ( double  x,
double  y,
double  z,
double  displayPt[3] 
)
protected

Member Data Documentation

◆ m_Device

albaDevice* albaInteractor::m_Device
protected

Find the pocked VME at button down.

As argument the function needs the device which performed the action, and provides as result pointers to piked prop, vme and its behavior if it exists.

Definition at line 198 of file albaInteractor.h.

Referenced by albaInteractor6DOF::GetTracker().

◆ m_DeviceIsSet

bool albaInteractor::m_DeviceIsSet
protected

true if the device has been set with SetDevice by other classes

Definition at line 200 of file albaInteractor.h.

◆ m_StartInteractionEvent

albaID albaInteractor::m_StartInteractionEvent
protected

the event ID starting the interaction

Definition at line 201 of file albaInteractor.h.

◆ m_StopInteractionEvent

albaID albaInteractor::m_StopInteractionEvent
protected

the event ID starting the interaction

Definition at line 202 of file albaInteractor.h.

◆ m_IgnoreTriggerEvents

int albaInteractor::m_IgnoreTriggerEvents
protected

flag to ignore start/stop interaction

Definition at line 203 of file albaInteractor.h.

Referenced by albaInteractor6DOF::GetIgnoreTriggerEvents().

◆ m_InteractionFlag

int albaInteractor::m_InteractionFlag
protected

flag if interacting

Definition at line 204 of file albaInteractor.h.

◆ m_StartButton

int albaInteractor::m_StartButton
protected

the button that can start the interaction

Definition at line 205 of file albaInteractor.h.

◆ m_Modifiers

unsigned long albaInteractor::m_Modifiers
protected

modifiers of the button for starting the interaction

Definition at line 206 of file albaInteractor.h.

◆ m_CurrentButton

int albaInteractor::m_CurrentButton
protected

the button that started the interaction

Definition at line 207 of file albaInteractor.h.

◆ m_CurrentModifier

unsigned long albaInteractor::m_CurrentModifier
protected

m_Modifiers state when interaction was started

Definition at line 208 of file albaInteractor.h.

◆ m_ButtonMode

int albaInteractor::m_ButtonMode
protected

Specify if working in single button or multi button mode.

Definition at line 209 of file albaInteractor.h.

◆ m_ButtonsCounter

int albaInteractor::m_ButtonsCounter
protected

Take count of the number of button pressed.

Definition at line 210 of file albaInteractor.h.

◆ m_VME

albaVME* albaInteractor::m_VME
protected

the object being interacted (optional)

Definition at line 212 of file albaInteractor.h.

◆ m_View

albaView* albaInteractor::m_View
protected

the view this interactor is working on

Definition at line 213 of file albaInteractor.h.

◆ m_Renderer

vtkALBASmartPointer<vtkRenderer> albaInteractor::m_Renderer
protected

the renderer this interactor is working on

Definition at line 215 of file albaInteractor.h.

◆ m_Prop

vtkALBASmartPointer<vtkProp3D> albaInteractor::m_Prop
protected

the prop being interacted (optional)

Definition at line 216 of file albaInteractor.h.

◆ m_TestMode

bool albaInteractor::m_TestMode
protected

Flag used with cppunitTest.

Definition at line 218 of file albaInteractor.h.


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