ALBA
|
#include <albaInteractor.h>
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 () |
albaView * | GetView () |
albaDevice * | GetDevice () |
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 albaObject * | NewObjectInstance () const =0 |
virtual const albaTypeID & | GetTypeId () 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) |
albaObserverCallback * | AddObserverCallback (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 albaObserver * | GetListener () |
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 | |
albaDevice * | m_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 |
albaVME * | m_VME |
albaView * | m_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 | |
albaObserver * | m_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 albaTypeID & | GetStaticTypeId () |
static albaObject * | SafeDownCast (albaObject *o) |
Protected Types inherited from albaEventBroadcaster | |
typedef std::list< albaObserver * > | albaObserversList |
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.
Enumerator | |
---|---|
SINGLE_BUTTON_MODE | |
MULTI_BUTTON_MODE |
Definition at line 147 of file albaInteractor.h.
albaInteractor::albaInteractor | ( | ) |
|
virtual |
albaInteractor::ALBA_ID_DEC | ( | INTERACTION_STARTED | ) |
Issued when interaction is started.
albaInteractor::ALBA_ID_DEC | ( | INTERACTION_STOPPED | ) |
Issued when interaction is stopped.
albaInteractor::ALBA_ID_DEC | ( | BUTTON_DOWN | ) |
Issued when a button is pressed.
albaInteractor::ALBA_ID_DEC | ( | BUTTON_UP | ) |
Issued when a button is released.
albaInteractor::albaAbstractTypeMacro | ( | albaInteractor | , |
albaAgent | |||
) |
|
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.
|
inline |
Definition at line 80 of file albaInteractor.h.
|
inline |
Definition at line 81 of file albaInteractor.h.
|
inline |
Return the current input device.
Definition at line 84 of file albaInteractor.h.
Referenced by albaInteractorPER::OnVmeSelected().
|
virtual |
Set the current input device.
|
virtual |
Set the node to be transformed.
Reimplemented in albaInteractorGenericInterface.
void albaInteractor::SetProp | ( | vtkProp3D * | prop | ) |
Set the prop to be transformed (optional and to be removed!!!)
|
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().
|
inline |
Definition at line 100 of file albaInteractor.h.
|
inline |
Definition at line 101 of file albaInteractor.h.
|
inline |
Definition at line 102 of file albaInteractor.h.
|
inline |
Set the event used to trigger the start of an interaction session.
Definition at line 105 of file albaInteractor.h.
|
inline |
Get the event used to trigger the start of an interaction session.
Definition at line 107 of file albaInteractor.h.
|
inline |
Set the event used to trigger the end of an interaction session.
Definition at line 110 of file albaInteractor.h.
|
inline |
Set the event used to trigger the end of an interaction session.
Definition at line 112 of file albaInteractor.h.
|
inline |
Set the modifier that should start the interaction.
Definition at line 115 of file albaInteractor.h.
|
inline |
Definition at line 116 of file albaInteractor.h.
|
inline |
Set the modifier that should start the interaction.
Definition at line 119 of file albaInteractor.h.
|
inline |
Definition at line 120 of file albaInteractor.h.
|
inline |
return the button which started the interaction
Definition at line 123 of file albaInteractor.h.
|
inline |
return the modifers at start of interaction
Definition at line 126 of file albaInteractor.h.
|
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.
|
virtual |
Stop the interaction, the optional argument force sending an event on the DefaultChannel advising the interaction has started.
This also unlock the device.
|
virtual |
return true if currently in a interaction session
|
virtual |
return true if the specified device is currently in a interaction session
|
inline |
Definition at line 149 of file albaInteractor.h.
|
inline |
Definition at line 150 of file albaInteractor.h.
|
inline |
Definition at line 151 of file albaInteractor.h.
|
inline |
Definition at line 152 of file albaInteractor.h.
|
virtual |
Process events coming from input device.
Reimplemented from albaAgent.
Reimplemented in albaAvatar, albaAvatar2D, albaAvatar3D, albaInteractor2DDistance, albaInteractor2DMeasure, albaInteractor6DOFCameraMove, albaInteractorCameraMove, albaInteractorCameraPicker, albaInteractorCompositorMouse, albaInteractorCompositorMouseFloatVME, albaInteractorDICOMImporter, albaInteractorGeneric6DOF, albaInteractorPER, albaInteractorPERBrushFeedback, albaInteractorPERScalarInformation, albaInteractorPicker, albaInteractorSegmentationPicker, albaInteractorSlider, and mmiInfoImage.
|
inline |
Turn On m_TestMode flag.
Definition at line 159 of file albaInteractor.h.
|
inline |
Used to turn off m_TestMode flag.
Definition at line 162 of file albaInteractor.h.
|
inline |
Get TestMode.
Definition at line 165 of file albaInteractor.h.
|
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.
|
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.
|
protectedvirtual |
|
protectedvirtual |
Reimplemented in albaInteractor2DAngle, albaInteractor2DDistance, albaInteractor2DIndicator, albaInteractorCameraMove, albaInteractorCameraPicker, albaInteractorCompositorMouse, albaInteractorCompositorMouseFloatVME, albaInteractorExtractIsosurface, albaInteractorPER, albaInteractorPicker, albaInteractorSelectCell, and mmiSelectPoint.
|
protected |
|
protected |
|
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().
|
protected |
true if the device has been set with SetDevice by other classes
Definition at line 200 of file albaInteractor.h.
|
protected |
the event ID starting the interaction
Definition at line 201 of file albaInteractor.h.
|
protected |
the event ID starting the interaction
Definition at line 202 of file albaInteractor.h.
|
protected |
flag to ignore start/stop interaction
Definition at line 203 of file albaInteractor.h.
Referenced by albaInteractor6DOF::GetIgnoreTriggerEvents().
|
protected |
flag if interacting
Definition at line 204 of file albaInteractor.h.
|
protected |
the button that can start the interaction
Definition at line 205 of file albaInteractor.h.
|
protected |
modifiers of the button for starting the interaction
Definition at line 206 of file albaInteractor.h.
|
protected |
the button that started the interaction
Definition at line 207 of file albaInteractor.h.
|
protected |
m_Modifiers state when interaction was started
Definition at line 208 of file albaInteractor.h.
|
protected |
Specify if working in single button or multi button mode.
Definition at line 209 of file albaInteractor.h.
|
protected |
Take count of the number of button pressed.
Definition at line 210 of file albaInteractor.h.
|
protected |
the object being interacted (optional)
Definition at line 212 of file albaInteractor.h.
|
protected |
the view this interactor is working on
Definition at line 213 of file albaInteractor.h.
|
protected |
the renderer this interactor is working on
Definition at line 215 of file albaInteractor.h.
|
protected |
the prop being interacted (optional)
Definition at line 216 of file albaInteractor.h.
|
protected |
Flag used with cppunitTest.
Definition at line 218 of file albaInteractor.h.