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
20#include "albaInteractor.h"
21#include "albaStorable.h"
22
23//----------------------------------------------------------------------------
24// forward declarations :
25//----------------------------------------------------------------------------
27class albaGUI;
28class albaEvent;
29class albaEventBase;
30class albaMatrix;
32class albaView;
33class vtkProp3D;
34class vtkActor;
35class vtkRenderer;
36class vtkActor2D;
37class vtkAbstractPropPicker;
38
47class ALBA_EXPORT albaAvatar : public albaInteractor, public albaStorable
48{
49public:
52 ALBA_ID_DEC(AVATAR_SCREEN_PLANE_SETTINGS);
53 ALBA_ID_DEC(AVATAR_WORKING_BOX_SETTINGS);
56 //----------------------------------------------------------------------------
57 // GUI Constants
58 //----------------------------------------------------------------------------
60 {
61 ID_NAME=MINID,
62 ID_LAST
63 };
64
65 enum AvatarModality {MODE_2D=0, MODE_3D};
66
68
73 virtual void SetRendererAndView(vtkRenderer *ren, albaView *view);
74
83 void SetActor3D(vtkProp3D *avatar);
85 vtkProp3D *GetActor3D() {return m_Actor3D;}
86
90 void SetActor2D(vtkActor2D *avatar);
92 vtkActor2D *GetActor2D() {return m_Actor2D;}
93
97 virtual void Hide();
98
102 virtual void Show();
103
106 virtual void HideCursor3D();
107
111 virtual void ShowCursor3D();
112
115 virtual void HideCursor2D();
116
120 virtual void ShowCursor2D();
121
123 virtual int Pick(albaMatrix &pose) {return false;}
124 virtual int Pick(double X, double Y) {return false;}
125
127 virtual void OnEvent(albaEventBase *event);
128
132 //albaGUIAvatarSettings *GetSettings() {if (!Settings) CreateSettings(); return Settings;}
133
142
144 void SetMode(int mode) {m_Mode=mode;}
145
147 int GetMode() {return m_Mode;}
148
150 void SetModeTo2D() {SetMode(MODE_2D);}
151
153 void SetModeTo3D() {SetMode(MODE_3D);}
154
158 virtual vtkAbstractPropPicker *GetPicker(){ return NULL; }
159
162
164 virtual void CreateGui();
165
167 virtual void UpdateGui();
168
169protected:
170
172 virtual ~albaAvatar();
173
179
181
183 virtual int InternalInitialize();
184
186 virtual void InternalShutdown();
187
189 virtual void OnPreResetCamera(albaEventBase *event);
190
192 virtual void OnPostResetCamera(albaEventBase *event);
193
195 virtual void OnViewSelected(albaEvent *e);
196
199
201 int m_Mode;
202
205
206private:
207 albaAvatar(const albaAvatar&); // Not implemented.
208 void operator=(const albaAvatar&); // Not implemented.
209};
210
211#endif
MINID
Definition: albaDecl.h:420
Avatars are entities moving in the virtual world according to user's movements, and thus representing...
Definition: albaAvatar.h:48
int m_Mode
Avatar modality, either 2D or 3D
Definition: albaAvatar.h:201
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:203
virtual int InternalStore(albaStorageElement *node)
This is used to allow nested serialization of subclasses.
virtual void OnPostResetCamera(albaEventBase *event)
process event sent after a camera reset
virtual vtkAbstractPropPicker * GetPicker()
return the picker used by this avatar: from the picker is possible to obtain information about the pi...
Definition: albaAvatar.h:158
int m_Cursor2DHideCounter
counter of the HideCursor2D() calls, used to manage concurrent calls
Definition: albaAvatar.h:204
vtkActor2D * GetActor2D()
Return the prop3D used for this avatar.
Definition: albaAvatar.h:92
virtual void ShowCursor3D()
Show the Avatar's 3D cursor actor.
virtual void OnEvent(albaEventBase *event)
Process events coming from tracker.
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:124
int GetMode()
return the current avatar modality.
Definition: albaAvatar.h:147
void SetActor3D(vtkProp3D *avatar)
Set the actor used to display the 3D cursor.
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:123
virtual void OnPreResetCamera(albaEventBase *event)
process event sent before a camera reset
virtual void UpdateGui()
force GUI update
virtual void OnViewSelected(albaEvent *e)
process event sent when a view has been selected
void SetMode(int mode)
Set Avatar modality: MODE_2D or MODE_3D.
Definition: albaAvatar.h:144
albaGUI * m_Gui
the settings Gui
Definition: albaAvatar.h:200
virtual int InternalInitialize()
redefined to add the Cursor actor into the selected renderer
albaAbstractTypeMacro(albaAvatar, albaInteractor)
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:150
vtkALBASmartPointer< vtkProp3D > m_Actor3D
3D representation of the avatar
Definition: albaAvatar.h:197
virtual void HideCursor2D()
Hide the Avatar's 2D cursor actor, i.e.
vtkALBASmartPointer< vtkActor2D > m_Actor2D
2D representation of the avatar
Definition: albaAvatar.h:198
virtual void Hide()
Hide all the Avatar's graphics actors, i.e.
void SetModeTo3D()
Set Avatar modality to MODE_3D.
Definition: albaAvatar.h:153
virtual void HideCursor3D()
Hide the Avatar's 3D cursor actor, i.e.
vtkProp3D * GetActor3D()
Return the prop3D used for this avatar.
Definition: albaAvatar.h:85
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.
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
Abstract class for ALBA interactors This class provides base interface and features of ALBA continuou...
albaMatrix - Time stamped 4x4 Matrix.
Definition: albaMatrix.h:44
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:79
ALBA_ID_DEC(AVATAR_SCREEN_PLANE_SETTINGS)
/**
ALBA_ID_DEC(AVATAR_WORKING_BOX_SETTINGS)
Issued to update all the avatar with the same working box.