ALBA
albaAvatar.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: ALBA (Agile Library for Biomedical Applications)
4 Module: albaAvatar
5 Authors: Marco Petrone & Michele Diegoli
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
17#ifndef __albaAvatar_h
18#define __albaAvatar_h
19
21#include "albaStorable.h"
22
23//----------------------------------------------------------------------------
24// forward declarations :
25//----------------------------------------------------------------------------
27class albaGUI;
28class albaEvent;
29class albaEventBase;
30class albaMatrix;
31class albaDevice;
33class albaView;
34class vtkProp3D;
35class vtkActor;
36class vtkRenderer;
37class vtkActor2D;
38class vtkAbstractPropPicker;
39
48class ALBA_EXPORT albaAvatar : public albaInteractionAgent, public albaStorable
49{
50public:
51 //----------------------------------------------------------------------------
52 // GUI Constants
53 //----------------------------------------------------------------------------
55 {
56 ID_NAME=MINID,
57 ID_LAST
58 };
59
60 enum AvatarModality {MODE_2D=0, MODE_3D};
61
63
68 virtual void SetRendererAndView(vtkRenderer *ren, albaView *view);
69
78 void SetActor3D(vtkProp3D *avatar);
80 vtkProp3D *GetActor3D() {return m_Actor3D;}
81
85 void SetActor2D(vtkActor2D *avatar);
87 vtkActor2D *GetActor2D() {return m_Actor2D;}
88
92 virtual void Hide();
93
97 virtual void Show();
98
101 virtual void HideCursor3D();
102
106 virtual void ShowCursor3D();
107
110 virtual void HideCursor2D();
111
115 virtual void ShowCursor2D();
116
118 virtual int Pick(albaMatrix &pose) {return false;}
119 virtual int Pick(double X, double Y) {return false;}
120
122 virtual void OnEvent(albaEventBase *event);
123
125 albaDevice *GetDevice() {return m_Device;}
126
128 void SetDevice(albaDevice *device);
129
133 //albaGUIAvatarSettings *GetSettings() {if (!Settings) CreateSettings(); return Settings;}
134
143
145 void SetMode(int mode) {m_Mode=mode;}
146
148 int GetMode() {return m_Mode;}
149
151 void SetModeTo2D() {SetMode(MODE_2D);}
152
154 void SetModeTo3D() {SetMode(MODE_3D);}
155
159 virtual vtkAbstractPropPicker *GetPicker(){ return NULL; }
160
163
165 virtual void CreateGui();
166
168 virtual void UpdateGui();
169
170protected:
171
173 virtual ~albaAvatar();
174
180
182
184 virtual int InternalInitialize();
185
187 virtual void InternalShutdown();
188
189
192
195 int m_Mode;
196
199
200private:
201 albaAvatar(const albaAvatar&); // Not implemented.
202 void operator=(const albaAvatar&); // Not implemented.
203};
204
205#endif
MINID
Definition: albaDecl.h:416
Avatars are entities moving in the virtual world according to user's movements, and thus representing...
Definition: albaAvatar.h:49
int m_Mode
Avatar modality, either 2D or 3D
Definition: albaAvatar.h:195
virtual void InternalShutdown()
redefined to remove Cursor from renderer
virtual void ShowCursor2D()
Show the Avatar's 2D cursor actor.
int m_Cursor3DHideCounter
counter of the HideCursor3D() calls, used to manage concurrent calls
Definition: albaAvatar.h:197
virtual int InternalStore(albaStorageElement *node)
This is used to allow nested serialization of subclasses.
virtual vtkAbstractPropPicker * GetPicker()
return the picker used by this avatar: from the picker is possible to obtain information about the pi...
Definition: albaAvatar.h:159
int m_Cursor2DHideCounter
counter of the HideCursor2D() calls, used to manage concurrent calls
Definition: albaAvatar.h:198
vtkActor2D * GetActor2D()
Return the prop3D used for this avatar.
Definition: albaAvatar.h:87
virtual void ShowCursor3D()
Show the Avatar's 3D cursor actor.
virtual void OnEvent(albaEventBase *event)
Process events coming from tracker: the base avatar does not forward them (see albaAgent::OnEvent)
void SetDevice(albaDevice *device)
Set the device the avatar follows: the avatar observes its input channel.
void SetActor2D(vtkActor2D *avatar)
Set the actor used to display the 2D cursor.
albaGUI * GetGui()
Return pointer to the GUI.
virtual int Pick(double X, double Y)
Definition: albaAvatar.h:119
albaAbstractTypeMacro(albaAvatar, albaInteractionAgent)
int GetMode()
return the current avatar modality.
Definition: albaAvatar.h:148
void SetActor3D(vtkProp3D *avatar)
Set the actor used to display the 3D cursor.
albaDevice * m_Device
the device the avatar follows
Definition: albaAvatar.h:193
virtual void SetTracker(albaDeviceButtonsPadTracker *tracker)
set the tracker attached to this avatar: the avatar usually follows the movements of the tracker
virtual void CreateGui()
internal function to create device GUI for settings
virtual int Pick(albaMatrix &pose)
pick in the scene with this avatar, give the avatar pose
Definition: albaAvatar.h:118
virtual void UpdateGui()
force GUI update
void SetMode(int mode)
Set Avatar modality: MODE_2D or MODE_3D.
Definition: albaAvatar.h:145
albaGUI * m_Gui
the settings Gui
Definition: albaAvatar.h:194
virtual int InternalInitialize()
redefined to add the Cursor actor into the selected renderer
virtual ~albaAvatar()
virtual int InternalRestore(albaStorageElement *node)
This is called by Restore() and must be reimplemented by subclasses The element from which the object...
void SetModeTo2D()
Set Avatar modality to MODE_2D.
Definition: albaAvatar.h:151
vtkALBASmartPointer< vtkProp3D > m_Actor3D
3D representation of the avatar
Definition: albaAvatar.h:190
virtual void HideCursor2D()
Hide the Avatar's 2D cursor actor, i.e.
vtkALBASmartPointer< vtkActor2D > m_Actor2D
2D representation of the avatar
Definition: albaAvatar.h:191
albaDevice * GetDevice()
Return the device the avatar follows.
Definition: albaAvatar.h:125
virtual void Hide()
Hide all the Avatar's graphics actors, i.e.
void SetModeTo3D()
Set Avatar modality to MODE_3D.
Definition: albaAvatar.h:154
virtual void HideCursor3D()
Hide the Avatar's 3D cursor actor, i.e.
vtkProp3D * GetActor3D()
Return the prop3D used for this avatar.
Definition: albaAvatar.h:80
albaDeviceButtonsPadTracker * GetTracker()
Return settings object for this Avatar, and if not yet allocated create it.
virtual void Show()
Show all the Avatar's graphics actors.
virtual void SetRendererAndView(vtkRenderer *ren, albaView *view)
Set the renderer this avatar is attached to.
Generic spatial position tracking device.
This abstract class manages function calls coming from devices and issue specific events to interacto...
Definition: albaDevice.h:42
Implementation of the message object for the Subject/Observer design pattern.
Definition: albaEventBase.h:49
albaEvent - Class implementing ALBA application events.
Definition: albaEvent.h:55
albaGUI is a panel with function to easily create GUI.
Definition: albaGUI.h:110
Common base class of interactors and interaction tools.
albaMatrix - Time stamped 4x4 Matrix.
Definition: albaMatrix.h:45
albaStorable is an interface for serializable objects.
Definition: albaStorable.h:41
Abstract class representing the interface for the unit of information stored in the storage.
albaView is the base class for Views in alba.
Definition: albaView.h:78