ALBA
albaInteractorPER.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: ALBA (Agile Library for Biomedical Applications)
4 Module: albaInteractorPER
5 Authors: Marco Petrone, originally by Silvano Imboden
6
7 Copyright (c) BIC
8 All rights reserved. See Copyright.txt or
9
10
11 This software is distributed WITHOUT ANY WARRANTY; without even
12 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 PURPOSE. See the above copyright notice for more information.
14
15=========================================================================*/
16#ifndef __albaInteractorPER_h
17#define __albaInteractorPER_h
18
19#include "albaInteractor.h"
20#include <map>
21
22//----------------------------------------------------------------------------
23// forward declarations
24//----------------------------------------------------------------------------
25class albaVME;
26class myPIMPL;
27class vtkCamera;
28
39class ALBA_EXPORT albaInteractorPER : public albaInteractor
40{
41public:
43
44 virtual void EnableSelect(bool enable) {m_CanSelect = enable;};
45
47 virtual void FlyToMode() {m_FlyToFlag = true;};
48
53 bool IsInteracting(albaDevice *device, int button=-1);
54
56 virtual int StartInteraction(albaDevice *device, int button);
57
59 virtual int StopInteraction(albaDevice *device, int button);
60
61 virtual void OnEvent(albaEventBase *event);
62
63 void OnVmeSelected(albaVME *vme){ SetPickedVME(GetDevice(),vme); }
64
65 enum modalities {SINGLE_BUTTON=0,MULTI_BUTTON};
66
67 void SetMode(int mode) {m_Mode=mode;}
68 int GetMode() {return m_Mode;}
69 void SetModeToSingleButton() {m_Mode=SINGLE_BUTTON;}
70 void SetModeToMultiButton() {m_Mode=MULTI_BUTTON;}
71
72 albaInteractor *GetCameraMouseInteractor() {return m_CameraMouseBehavior;};
73
74 albaInteractor *GetCameraInteractor() {return m_CameraBehavior;};
75
76protected:
79
84
91
99 virtual void OnMove (albaEventInteraction *e);
100 virtual void OnChar (albaEventInteraction *e);
101
103 virtual void FlyTo(albaEventInteraction *e,int numstep=20, double zoom=1);
104
106 void InsertDevice(albaDevice *device,int button);
107
110
114
116 void SetPickedVME(albaDevice *device,albaVME *vme);
117
120
125
130
132 {
133 public:
136 };
137
138 std::map<albaID,DeviceItem> m_Devices;
139
140private:
141 albaInteractorPER(const albaInteractorPER&); // Not implemented.
142 void operator=(const albaInteractorPER&); // Not implemented.
143
145 friend class albaInteractorPERTest;
146};
147
148#endif
This abstract class manages function calls coming from devices and issue specific events to interacto...
Definition: albaDevice.h:40
Implementation of the message object for the Subject/Observer design pattern.
Definition: albaEventBase.h:49
Event class to transport a triggering button and a position from pointing devices.
Class implementing routing of events based on picking.
albaInteractor * m_CameraBehavior
the camera interactor
albaTypeMacro(albaInteractorPER, albaInteractor)
albaInteractor * GetCameraInteractor()
albaInteractor * GetCameraMouseInteractor()
bool m_ShowContextMenu
flag for showing the context menu
virtual void FlyToMode()
Enable fly to mode: next click will select where to fly to.
virtual int OnStopInteraction(albaEventInteraction *e)
redefined to support the three buttons
void SetPickedVME(albaDevice *device, albaVME *vme)
internally used to set VME picked by device at button down
virtual int StartInteraction(albaDevice *device, int button)
Redefined to support multiple input devices.
virtual void OnMove(albaEventInteraction *e)
virtual void FlyTo(albaEventInteraction *e, int numstep=20, double zoom=1)
internally used to fly to a clicked point
virtual void OnRightButtonDown(albaEventInteraction *e)
albaInteractor * m_CameraMouseBehavior
the mouse camera interactor
void RemoveDevice(albaDevice *device)
remove a device in the set of devices currently interacting
void SetMode(int mode)
virtual void OnLeftButtonDown(albaEventInteraction *e)
albaInteractor * GetCurrentBehavior(albaDevice *device)
virtual void OnMiddleButtonDown(albaEventInteraction *e)
virtual void OnChar(albaEventInteraction *e)
std::map< albaID, DeviceItem > m_Devices
Stores the list of devices currently interacting.
albaVME * GetPickedVME(albaDevice *device)
internally used to return the picked VME for given device
virtual ~albaInteractorPER()
bool IsInteracting(albaDevice *device, int button=-1)
return true if device is in the set of devices currently interacting the optional parameter can be us...
virtual void OnButtonDown(albaEventInteraction *e)
Perform a pick on start of interaction to find if the user pointed an object in the scene,...
virtual void EnableSelect(bool enable)
virtual void OnMiddleButtonUp(albaEventInteraction *e)
void SetCurrentBehavior(albaDevice *device, albaInteractor *inter)
internally used to set which behavior was picked by device
void InsertDevice(albaDevice *device, int button)
insert a device in the set of devices currently interacting
void OnVmeSelected(albaVME *vme)
virtual int OnStartInteraction(albaEventInteraction *e)
redefined to support the three buttons
virtual void OnLeftButtonUp(albaEventInteraction *e)
virtual void OnButtonUp(albaEventInteraction *e)
virtual int StopInteraction(albaDevice *device, int button)
Redefined to support multiple input devices.
virtual void OnRightButtonUp(albaEventInteraction *e)
virtual void OnEvent(albaEventBase *event)
Process events coming from input device.
Abstract class for ALBA interactors This class provides base interface and features of ALBA continuou...
albaDevice * GetDevice()
Return the current input device.
albaVME -
Definition: albaVME.h:150