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

#include <albaInteractorGenericMouse.h>

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

Public Types

enum  MouseAction { MOUSE_DOWN = 0 , MOUSE_MOVE , MOUSE_UP }
 
- Public Types inherited from albaInteractor
enum  modalities { SINGLE_BUTTON_MODE =0 , MULTI_BUTTON_MODE }
 

Public Member Functions

 albaTypeMacro (albaInteractorGenericMouse, albaInteractor)
 
void OnButtonDownAction (int X, int Y)
 
void OnMouseMoveAction (int X, int Y)
 
void OnButtonUpAction ()
 
void SendTransformMatrix (const albaMatrix &matrix, int mouseAction=MOUSE_MOVE, double rotationAngle=0)
 
virtual void SetCurrentCamera (vtkCamera *camera)
 
void SetResultMatrixConcatenationSemanticToPostMultiply ()
 
void SetResultMatrixConcatenationSemanticToPreMultiply ()
 
int GetResultMatrixConcatenationSemantic ()
 
void SetResultMatrixConcatenation (bool active)
 
bool GetResultMatrixConcatenation ()
 
void ResultMatrixConcatenationOn ()
 
void ResultMatrixConcatenationOff ()
 
- Public Member Functions inherited from albaInteractorGenericInterface
 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 Types

enum  HELPER_POINT_STATUS { NOT_ON_GRID_POINT , ON_GRID_POINT }
 
enum  { PREMULTIPLY , POSTMULTIPLY }
 
- Protected Types inherited from albaEventBroadcaster
typedef std::list< albaObserver * > albaObserversList
 

Protected Member Functions

 albaInteractorGenericMouse ()
 
 ~albaInteractorGenericMouse ()
 
void EnableTranslationInternal (bool enable)
 
void EnableRotationInternal (bool enable)
 
void EnableScalingInternal (bool enable)
 
void EnableUniformScalingInternal (bool enable)
 
void Translate (double *p1, double *p2)
 
void Rotate (double *p1, double *p2, double *viewup)
 
void Scale (double *p1, double *p2, double *viewup)
 
int BinarySearch (double pos, vtkDoubleArray *array, int &helper_point_status)
 
virtual void TrackballRotate ()
 
virtual void TrackballTranslate ()
 
virtual void TrackballRoll ()
 
void SnapOnSurface ()
 
void NormalOnSurface ()
 
- Protected Member Functions inherited from albaInteractorGenericInterface
 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

int m_HelperPointStatus
 
int m_HelpPIndex
 
albaMatrixm_ConstrainRefSys
 
albaMatrixm_ResultMatrix
 
int m_ResultMatrixConcatenationSemantic
 
int m_LastX
 
int m_LastY
 
int m_MousePointer2DPosition [2]
 
int m_LastMousePointer2DPosition [2]
 
vtkCamera * m_CurrentCamera
 
double m_LastPickPosition [3]
 
- Protected Attributes inherited from albaInteractorGenericInterface
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

- 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)
 

Detailed Description

Constrained interaction with mouse device.

Use albaInteractorCompositorMouse in order to associate instances of this class to mouse buttons with keys modifiers.

See also

Definition at line 42 of file albaInteractorGenericMouse.h.

Member Enumeration Documentation

◆ MouseAction

Used to notify the listener about the current mouse action performed; event Id field is set with this enum.

Enumerator
MOUSE_DOWN 
MOUSE_MOVE 
MOUSE_UP 

Definition at line 67 of file albaInteractorGenericMouse.h.

◆ HELPER_POINT_STATUS

Enumerator
NOT_ON_GRID_POINT 
ON_GRID_POINT 

Definition at line 145 of file albaInteractorGenericMouse.h.

◆ anonymous enum

anonymous enum
protected
Enumerator
PREMULTIPLY 
POSTMULTIPLY 

Definition at line 167 of file albaInteractorGenericMouse.h.

Constructor & Destructor Documentation

◆ albaInteractorGenericMouse()

albaInteractorGenericMouse::albaInteractorGenericMouse ( )
protected

◆ ~albaInteractorGenericMouse()

albaInteractorGenericMouse::~albaInteractorGenericMouse ( )
protected

Member Function Documentation

◆ albaTypeMacro()

albaInteractorGenericMouse::albaTypeMacro ( albaInteractorGenericMouse  ,
albaInteractor   
)

◆ OnButtonDownAction()

void albaInteractorGenericMouse::OnButtonDownAction ( int  X,
int  Y 
)

Action to be performed on button down event.

◆ OnMouseMoveAction()

void albaInteractorGenericMouse::OnMouseMoveAction ( int  X,
int  Y 
)

Action to be performed on mouse move event.

◆ OnButtonUpAction()

void albaInteractorGenericMouse::OnButtonUpAction ( )

Action to be performed on button up action.

◆ SendTransformMatrix()

void albaInteractorGenericMouse::SendTransformMatrix ( const albaMatrix matrix,
int  mouseAction = MOUSE_MOVE,
double  rotationAngle = 0 
)

◆ SetCurrentCamera()

virtual void albaInteractorGenericMouse::SetCurrentCamera ( vtkCamera *  camera)
inlinevirtual

Set the current camera.

Definition at line 74 of file albaInteractorGenericMouse.h.

◆ SetResultMatrixConcatenationSemanticToPostMultiply()

void albaInteractorGenericMouse::SetResultMatrixConcatenationSemanticToPostMultiply ( )
inline

Set the semantic of the concatenation, default is postmultiply ie the transform is concatenated after all the other transformations.

Definition at line 82 of file albaInteractorGenericMouse.h.

◆ SetResultMatrixConcatenationSemanticToPreMultiply()

void albaInteractorGenericMouse::SetResultMatrixConcatenationSemanticToPreMultiply ( )
inline

Definition at line 84 of file albaInteractorGenericMouse.h.

◆ GetResultMatrixConcatenationSemantic()

int albaInteractorGenericMouse::GetResultMatrixConcatenationSemantic ( )
inline

Definition at line 86 of file albaInteractorGenericMouse.h.

◆ SetResultMatrixConcatenation()

void albaInteractorGenericMouse::SetResultMatrixConcatenation ( bool  active)
inline

Set/Get if the concatenation is active.

Definition at line 91 of file albaInteractorGenericMouse.h.

◆ GetResultMatrixConcatenation()

bool albaInteractorGenericMouse::GetResultMatrixConcatenation ( )
inline

Definition at line 92 of file albaInteractorGenericMouse.h.

◆ ResultMatrixConcatenationOn()

void albaInteractorGenericMouse::ResultMatrixConcatenationOn ( )
inline

Enable/Disable the concatenation of the transform matrix to be sent to the result matrix

Definition at line 98 of file albaInteractorGenericMouse.h.

◆ ResultMatrixConcatenationOff()

void albaInteractorGenericMouse::ResultMatrixConcatenationOff ( )
inline

Definition at line 99 of file albaInteractorGenericMouse.h.

◆ EnableTranslationInternal()

void albaInteractorGenericMouse::EnableTranslationInternal ( bool  enable)
protectedvirtual

Superclass override; only one flag can be true.

Reimplemented from albaInteractorGenericInterface.

◆ EnableRotationInternal()

void albaInteractorGenericMouse::EnableRotationInternal ( bool  enable)
protectedvirtual

Reimplemented from albaInteractorGenericInterface.

◆ EnableScalingInternal()

void albaInteractorGenericMouse::EnableScalingInternal ( bool  enable)
protectedvirtual

Reimplemented from albaInteractorGenericInterface.

◆ EnableUniformScalingInternal()

void albaInteractorGenericMouse::EnableUniformScalingInternal ( bool  enable)
protectedvirtual

Reimplemented from albaInteractorGenericInterface.

◆ Translate()

void albaInteractorGenericMouse::Translate ( double *  p1,
double *  p2 
)
protected

Perform translation.

◆ Rotate()

void albaInteractorGenericMouse::Rotate ( double *  p1,
double *  p2,
double *  viewup 
)
protected

Perform rotation.

◆ Scale()

void albaInteractorGenericMouse::Scale ( double *  p1,
double *  p2,
double *  viewup 
)
protected

Perform scaling.

◆ BinarySearch()

int albaInteractorGenericMouse::BinarySearch ( double  pos,
vtkDoubleArray *  array,
int &  helper_point_status 
)
protected

Binary search for pos into array.

If the helper point is on the grid returns the index of the corresponding grid point and set helper_point_status to ON_GRID_POINT otherwise returns the index of the first element array on the left of the helper point (-1 if the helper point pos is lower than first array component) and set
helper_point_status to NOT_ON_GRID_POINT ^ |
----—A->-—0----—1--—i--—|--—i+1---—N-1----—>- A B

pos = A => BinarySearch returns i && helper_point_status = ON_GRID_POINT pos = B => BinarySearch returns i && helper_point_status = NOT_ON_GRID_POINT

◆ TrackballRotate()

virtual void albaInteractorGenericMouse::TrackballRotate ( )
protectedvirtual

◆ TrackballTranslate()

virtual void albaInteractorGenericMouse::TrackballTranslate ( )
protectedvirtual

◆ TrackballRoll()

virtual void albaInteractorGenericMouse::TrackballRoll ( )
protectedvirtual

◆ SnapOnSurface()

void albaInteractorGenericMouse::SnapOnSurface ( )
protected

◆ NormalOnSurface()

void albaInteractorGenericMouse::NormalOnSurface ( )
protected

Member Data Documentation

◆ m_HelperPointStatus

int albaInteractorGenericMouse::m_HelperPointStatus
protected

Definition at line 143 of file albaInteractorGenericMouse.h.

◆ m_HelpPIndex

int albaInteractorGenericMouse::m_HelpPIndex
protected

Definition at line 154 of file albaInteractorGenericMouse.h.

◆ m_ConstrainRefSys

albaMatrix* albaInteractorGenericMouse::m_ConstrainRefSys
protected

Definition at line 157 of file albaInteractorGenericMouse.h.

◆ m_ResultMatrix

albaMatrix* albaInteractorGenericMouse::m_ResultMatrix
protected

Definition at line 163 of file albaInteractorGenericMouse.h.

◆ m_ResultMatrixConcatenationSemantic

int albaInteractorGenericMouse::m_ResultMatrixConcatenationSemantic
protected

Definition at line 165 of file albaInteractorGenericMouse.h.

◆ m_LastX

int albaInteractorGenericMouse::m_LastX
protected

Definition at line 196 of file albaInteractorGenericMouse.h.

◆ m_LastY

int albaInteractorGenericMouse::m_LastY
protected

Definition at line 196 of file albaInteractorGenericMouse.h.

◆ m_MousePointer2DPosition

int albaInteractorGenericMouse::m_MousePointer2DPosition[2]
protected

Definition at line 200 of file albaInteractorGenericMouse.h.

◆ m_LastMousePointer2DPosition

int albaInteractorGenericMouse::m_LastMousePointer2DPosition[2]
protected

Definition at line 201 of file albaInteractorGenericMouse.h.

◆ m_CurrentCamera

vtkCamera* albaInteractorGenericMouse::m_CurrentCamera
protected

Stores camera to which the interaction is currently assigned.

Definition at line 203 of file albaInteractorGenericMouse.h.

◆ m_LastPickPosition

double albaInteractorGenericMouse::m_LastPickPosition[3]
protected

Definition at line 205 of file albaInteractorGenericMouse.h.


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