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

#include <albaInteractorGenericInterface.h>

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

Public Member Functions

 ALBA_ID_DEC (MOVE_EVENT)
 
 albaAbstractTypeMacro (albaInteractorGenericInterface, albaInteractor)
 
albaRefSysGetTargetRefSys ()
 
void SetTargetRefSys (albaRefSys &ref_sys)
 
void SetTargetRefSys (albaRefSys *ref_sys)
 
void SetPivotRefSys (albaRefSys &pivot_frame)
 
void SetPivotRefSys (albaRefSys *pivot_frame)
 
albaRefSysGetPivotRefSys ()
 
void EnableTranslation (bool enable)
 
void EnableRotation (bool enable)
 
void EnableScaling (bool enable)
 
void EnableUniformScaling (bool enable)
 
bool GetTranslationFlag ()
 
bool GetRotationFlag ()
 
bool GetScalingFlag ()
 
bool GetUniformScalingFlag ()
 
albaInteractorConstraintGetTranslationConstraint ()
 
void SetTranslationConstraint (albaInteractorConstraint *constrain)
 
albaInteractorConstraintGetRotationConstraint ()
 
void SetRotationConstraint (albaInteractorConstraint *constrain)
 
albaInteractorConstraintGetScaleConstraint ()
 
void SetScaleConstraint (albaInteractorConstraint *constrain)
 
void SetResultMatrix (albaMatrix *result)
 
albaMatrixGetResultMatrix ()
 
void SetResultTransform (albaTransform *result)
 
albaTransformGetResultTransform ()
 
virtual void SetRendererAndView (vtkRenderer *ren, albaView *view)
 
virtual void SetVME (albaVME *vme)
 
void SetSurfaceSnap (bool flag)
 
bool GetSurfaceSnap ()
 
void SurfaceSnapOn ()
 
void SurfaceSnapOff ()
 
void SetSurfaceNormal (bool flag)
 
bool GetSurfaceNormal ()
 
void SurfaceNormalOn ()
 
void SurfaceNormalOff ()
 
- Public Member Functions inherited from albaInteractor
 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

 albaInteractorGenericInterface ()
 
virtual ~albaInteractorGenericInterface ()
 
virtual void EnableTranslationInternal (bool enable)
 
virtual void EnableRotationInternal (bool enable)
 
virtual void EnableScalingInternal (bool enable)
 
virtual void EnableUniformScalingInternal (bool enable)
 
- Protected Member Functions inherited from albaInteractor
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

albaInteractorConstraintm_TranslationConstraint
 
albaInteractorConstraintm_RotationConstraint
 
albaInteractorConstraintm_ScaleConstraint
 
albaRefSysm_TargetRefSys
 
albaRefSysm_PivotRefSys
 
albaTransformm_ResultTransform
 
bool m_TranslationFlag
 
bool m_RotationFlag
 
bool m_ScalingFlag
 
bool m_UniformScalingFlag
 
bool m_SurfaceSnap
 
bool m_SurfaceNormal
 
- Protected Attributes inherited from albaInteractor
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

- Public Types inherited from albaInteractor
enum  modalities { SINGLE_BUTTON_MODE =0 , MULTI_BUTTON_MODE }
 
- 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 general purpose interactor.

This abstract class defines the interface for a general purpose interactor. Specialized classes should be able to listen to different kind of input devices and implement all the interface functions. Among the other features we have: translation constrains, like projection on an axis or plane, and rotational constrains like rotation around a single axis or translation snapping on specified positions or rotation snap on specified angles. It can also provide movement snapped on predefined positions.

When working unconstrained (default) the interactor makes objects rotate around their center and translate along view axis (i.e. aligned as camera's ViewTransform). This means the TranslationConstraintts has a reference system set to "CAMERA" and the RotationConstraintt has the reference system set to "OBJECT". The interactor uses the pointer to the Renderer to retrieve the camera's ViewTransform and retrieve the object position from the VME pointer. In case this last is NULL the identity (i.e. rotation around the world center is used)

The interactor produces an output matrix (sent by means of MoveActionEvent to the listener) which can be post-multiplied to the original one to obtain a transformed matrix.

By setting the ResultMatrix the interactor will automatically concatenate the transformation matrix to the ResultMatrix.

See also
Todo:
  • togliere shortcut per i vari ref sys (ved todo albaRefSys)
  • fare esempi semplici da usare come tutorial

Definition at line 59 of file albaInteractorGenericInterface.h.

Constructor & Destructor Documentation

◆ albaInteractorGenericInterface()

albaInteractorGenericInterface::albaInteractorGenericInterface ( )
protected

◆ ~albaInteractorGenericInterface()

virtual albaInteractorGenericInterface::~albaInteractorGenericInterface ( )
protectedvirtual

Member Function Documentation

◆ ALBA_ID_DEC()

albaInteractorGenericInterface::ALBA_ID_DEC ( MOVE_EVENT  )

Issued when a move action has been performed.

◆ albaAbstractTypeMacro()

albaInteractorGenericInterface::albaAbstractTypeMacro ( albaInteractorGenericInterface  ,
albaInteractor   
)

◆ GetTargetRefSys()

albaRefSys * albaInteractorGenericInterface::GetTargetRefSys ( )

Get the Target ref sys, i.e.

the object hosting the output matrix reference system. You can change such a reference system by setting its reference matrix or copying from another reference system

◆ SetTargetRefSys() [1/2]

void albaInteractorGenericInterface::SetTargetRefSys ( albaRefSys ref_sys)

Set the Target reference system, i.e.

the frame with respect to which is expressed the output transform.Notice, the argument is copied and not referenced, but transform stored in the albaRefSys are always referenced! (DEFAULT GLOBAL)

◆ SetTargetRefSys() [2/2]

void albaInteractorGenericInterface::SetTargetRefSys ( albaRefSys ref_sys)

◆ SetPivotRefSys() [1/2]

void albaInteractorGenericInterface::SetPivotRefSys ( albaRefSys pivot_frame)

Set the Pivot frame.

The origin of this frame is used as a pivot point for rotation transform and as snapping point. Notice, the argument is copied and not referenced, but transform stored in the albaRefSys are always referenced!

◆ SetPivotRefSys() [2/2]

void albaInteractorGenericInterface::SetPivotRefSys ( albaRefSys pivot_frame)

◆ GetPivotRefSys()

albaRefSys * albaInteractorGenericInterface::GetPivotRefSys ( )
inline

Return the Pivot frame.

The origin of this frame is used as a pivot point for rotation transform.

Definition at line 92 of file albaInteractorGenericInterface.h.

◆ EnableTranslation()

void albaInteractorGenericInterface::EnableTranslation ( bool  enable)

Set the translation/rotation/scale to on/off.

◆ EnableRotation()

void albaInteractorGenericInterface::EnableRotation ( bool  enable)

◆ EnableScaling()

void albaInteractorGenericInterface::EnableScaling ( bool  enable)

◆ EnableUniformScaling()

void albaInteractorGenericInterface::EnableUniformScaling ( bool  enable)

◆ GetTranslationFlag()

bool albaInteractorGenericInterface::GetTranslationFlag ( )
inline

Return the translation flag.

Definition at line 109 of file albaInteractorGenericInterface.h.

◆ GetRotationFlag()

bool albaInteractorGenericInterface::GetRotationFlag ( )
inline

Definition at line 110 of file albaInteractorGenericInterface.h.

◆ GetScalingFlag()

bool albaInteractorGenericInterface::GetScalingFlag ( )
inline

Definition at line 111 of file albaInteractorGenericInterface.h.

◆ GetUniformScalingFlag()

bool albaInteractorGenericInterface::GetUniformScalingFlag ( )
inline

Definition at line 112 of file albaInteractorGenericInterface.h.

◆ GetTranslationConstraint()

albaInteractorConstraint * albaInteractorGenericInterface::GetTranslationConstraint ( )
inline

Get the translation constraint.

To set the constraint retrieve the constrain object and set it.

Definition at line 121 of file albaInteractorGenericInterface.h.

◆ SetTranslationConstraint()

void albaInteractorGenericInterface::SetTranslationConstraint ( albaInteractorConstraint constrain)

Set the translation constraint.

Notice the constraint is copied and not referenced

◆ GetRotationConstraint()

albaInteractorConstraint * albaInteractorGenericInterface::GetRotationConstraint ( )
inline

Get the rotation constraint.

To set the constraint retrieve the constrain object and set it.

Definition at line 129 of file albaInteractorGenericInterface.h.

◆ SetRotationConstraint()

void albaInteractorGenericInterface::SetRotationConstraint ( albaInteractorConstraint constrain)

Set the rotation constraint.

Notice the constraint is copied and not referenced

◆ GetScaleConstraint()

albaInteractorConstraint * albaInteractorGenericInterface::GetScaleConstraint ( )
inline

Get the scale constraint.

To set the constraint retrieve the constrain object and set it.

Definition at line 137 of file albaInteractorGenericInterface.h.

◆ SetScaleConstraint()

void albaInteractorGenericInterface::SetScaleConstraint ( albaInteractorConstraint constrain)

Set the scaling constraint.

Notice the constraint is copied and not referenced

◆ SetResultMatrix()

void albaInteractorGenericInterface::SetResultMatrix ( albaMatrix result)

The Result Matrix is an optional matrix to which the interactor concatenates the OutputTransform at each interaction.

The result matrix is referenced. The USER may set it e.g. to have the interactor implicitly control a vme.

◆ GetResultMatrix()

albaMatrix * albaInteractorGenericInterface::GetResultMatrix ( )

◆ SetResultTransform()

void albaInteractorGenericInterface::SetResultTransform ( albaTransform result)

The Result Transform is an optional transform to which the interactor concatenates the OutputTransform at each interaction.

The USER may set it to have the interactor implicitly control a vme.

◆ GetResultTransform()

albaTransform * albaInteractorGenericInterface::GetResultTransform ( )
inline

Definition at line 158 of file albaInteractorGenericInterface.h.

◆ SetRendererAndView()

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

redefined to set the renderer also in the constraint

Reimplemented from albaInteractor.

◆ SetVME()

virtual void albaInteractorGenericInterface::SetVME ( albaVME vme)
virtual

Set the node to be transformed.

Reimplemented from albaInteractor.

◆ SetSurfaceSnap()

void albaInteractorGenericInterface::SetSurfaceSnap ( bool  flag)
inline

If Surface Snap modifier is on translation and rotation will be constrained to picked surfaces if possible.

Definition at line 167 of file albaInteractorGenericInterface.h.

◆ GetSurfaceSnap()

bool albaInteractorGenericInterface::GetSurfaceSnap ( )
inline

Definition at line 168 of file albaInteractorGenericInterface.h.

◆ SurfaceSnapOn()

void albaInteractorGenericInterface::SurfaceSnapOn ( )
inline

Definition at line 169 of file albaInteractorGenericInterface.h.

◆ SurfaceSnapOff()

void albaInteractorGenericInterface::SurfaceSnapOff ( )
inline

Definition at line 170 of file albaInteractorGenericInterface.h.

◆ SetSurfaceNormal()

void albaInteractorGenericInterface::SetSurfaceNormal ( bool  flag)
inline

If Surface Snap modifier is on translation and rotation will be constrained to picked surfaces if possible.

Definition at line 173 of file albaInteractorGenericInterface.h.

◆ GetSurfaceNormal()

bool albaInteractorGenericInterface::GetSurfaceNormal ( )
inline

Definition at line 174 of file albaInteractorGenericInterface.h.

◆ SurfaceNormalOn()

void albaInteractorGenericInterface::SurfaceNormalOn ( )
inline

Definition at line 175 of file albaInteractorGenericInterface.h.

◆ SurfaceNormalOff()

void albaInteractorGenericInterface::SurfaceNormalOff ( )
inline

Definition at line 176 of file albaInteractorGenericInterface.h.

◆ EnableTranslationInternal()

virtual void albaInteractorGenericInterface::EnableTranslationInternal ( bool  enable)
protectedvirtual

Dervived classes should override this methods in order to set internal flags in a consistent way.

For example the mouse can only translate or rotate during a single mouse move action so setting translation flag to true must set the other flags to false while the tracker can translate and rotate in a single move event so it can have both translate and rotate flags set to true

Reimplemented in albaInteractorGenericMouse.

◆ EnableRotationInternal()

virtual void albaInteractorGenericInterface::EnableRotationInternal ( bool  enable)
protectedvirtual

Reimplemented in albaInteractorGenericMouse.

◆ EnableScalingInternal()

virtual void albaInteractorGenericInterface::EnableScalingInternal ( bool  enable)
protectedvirtual

Reimplemented in albaInteractorGenericMouse.

◆ EnableUniformScalingInternal()

virtual void albaInteractorGenericInterface::EnableUniformScalingInternal ( bool  enable)
protectedvirtual

Reimplemented in albaInteractorGenericMouse.

Member Data Documentation

◆ m_TranslationConstraint

albaInteractorConstraint* albaInteractorGenericInterface::m_TranslationConstraint
protected

the constrain for translation

Definition at line 192 of file albaInteractorGenericInterface.h.

◆ m_RotationConstraint

albaInteractorConstraint* albaInteractorGenericInterface::m_RotationConstraint
protected

the constrain for rotation

Definition at line 193 of file albaInteractorGenericInterface.h.

◆ m_ScaleConstraint

albaInteractorConstraint* albaInteractorGenericInterface::m_ScaleConstraint
protected

the constrain for scaling

Definition at line 194 of file albaInteractorGenericInterface.h.

◆ m_TargetRefSys

albaRefSys* albaInteractorGenericInterface::m_TargetRefSys
protected

the target ref_sys matrix

Definition at line 196 of file albaInteractorGenericInterface.h.

◆ m_PivotRefSys

albaRefSys* albaInteractorGenericInterface::m_PivotRefSys
protected

the pivot point (only position is considered)

Definition at line 197 of file albaInteractorGenericInterface.h.

◆ m_ResultTransform

albaTransform* albaInteractorGenericInterface::m_ResultTransform
protected

store the pointer to the matrix to be updated

Definition at line 198 of file albaInteractorGenericInterface.h.

◆ m_TranslationFlag

bool albaInteractorGenericInterface::m_TranslationFlag
protected

Definition at line 200 of file albaInteractorGenericInterface.h.

◆ m_RotationFlag

bool albaInteractorGenericInterface::m_RotationFlag
protected

Definition at line 201 of file albaInteractorGenericInterface.h.

◆ m_ScalingFlag

bool albaInteractorGenericInterface::m_ScalingFlag
protected

Definition at line 202 of file albaInteractorGenericInterface.h.

◆ m_UniformScalingFlag

bool albaInteractorGenericInterface::m_UniformScalingFlag
protected

Definition at line 203 of file albaInteractorGenericInterface.h.

◆ m_SurfaceSnap

bool albaInteractorGenericInterface::m_SurfaceSnap
protected

Definition at line 205 of file albaInteractorGenericInterface.h.

◆ m_SurfaceNormal

bool albaInteractorGenericInterface::m_SurfaceNormal
protected

Definition at line 206 of file albaInteractorGenericInterface.h.


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