ALBA
albaView.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: ALBA (Agile Library for Biomedical Applications)
4 Module: albaView
5 Authors: Silvano Imboden - Paolo Quadrani
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 __albaView_H__
17#define __albaView_H__
18//----------------------------------------------------------------------------
19// Include:
20//----------------------------------------------------------------------------
21#include "albaObserver.h"
22#include "albaServiceClient.h"
23#include "albaAbsLogicManager.h"
24
25//----------------------------------------------------------------------------
26// forward references :
27//----------------------------------------------------------------------------
28class albaPipe;
29class albaSceneGraph;
30class albaVME;
31class albaGUI;
32class albaGUIHolder;
34class albaDevice;
35class albaInteractor;
36
37class albaRWIBase;
38class vtkCellPicker;
39class vtkALBARayCast3DPicker;
40class vtkAssemblyPath;
41class vtkProp3D;
42
43//----------------------------------------------------------------------------
44// const :
45//----------------------------------------------------------------------------
48{
54};
57{
61};
62
63//----------------------------------------------------------------------------
64// albaView :
65//----------------------------------------------------------------------------
78class ALBA_EXPORT albaView: public albaObserver, public albaServiceClient, public albaObject
79{
80public:
81 albaView(const wxString &label = "View");
82 virtual ~albaView();
83
85
86 virtual void SetListener(albaObserver *Listener) {m_Listener = Listener;};
87 virtual void OnEvent(albaEventBase *alba_event);
88 virtual albaView* Copy(albaObserver *Listener, bool lightCopyEnabled = false) {m_LightCopyEnabled = lightCopyEnabled; return NULL;};
89 virtual void Create() {};
90
91 virtual void VmeAdd(albaVME *vme) {};
92 virtual void VmeRemove(albaVME *vme) {};
93 virtual void VmeSelect(albaVME *vme, bool select) {};
94 virtual void VmeShow(albaVME *vme, bool show) {};
95 virtual void VmeUpdateProperty(albaVME *vme, bool fromTag = false) {};
96 virtual bool IsVmeShowed(albaVME *vme) { return GetNodePipe(vme) != NULL; };
97
98 virtual void VmeCreatePipe(albaVME *vme) {};
99 virtual void VmeDeletePipe(albaVME *vme) {};
100
101 virtual void CameraReset(albaVME *node = NULL) {};
102 virtual void CameraUpdate() {};
103 virtual void SetMouse(albaDeviceButtonsPadMouse *mouse) {};
104 virtual albaRWIBase *GetRWI() {return NULL;};
105 virtual albaSceneGraph *GetSceneGraph() {return NULL;};
106 virtual void GetImage(wxBitmap &bmp, int magnification = 1) {};
107
109 virtual void OptionsUpdate() {};
110
115 virtual bool FindPokedVme(albaDevice *device,albaMatrix &point_pose,vtkProp3D *&picked_prop,albaVME *&picked_vme,albaInteractor *&picked_behavior) {return false;};
116
118 //having albaView::GetNodeStatus allow albaGUICheckTree to not know about albaSceneGraph
119 virtual int GetNodeStatus(albaVME *vme) {return NODE_NON_VISIBLE;};
120
122 virtual albaPipe* GetNodePipe(albaVME *vme) {return NULL;};
123
124 wxString GetLabel() {return m_Label;};
125 wxString GetName() {return m_Name;};
126 void SetLabel(wxString label) {m_Label = label;};
127 void SetName(wxString name) {m_Name = name;};
128
129 virtual wxWindow* GetWindow(){return m_Win;};
130 virtual wxFrame* GetFrame() {return m_Frame;};
131 virtual albaGUI* GetGui() {if(m_Gui == NULL) CreateGui(); assert(m_Gui); return m_Gui;};
132
134 void DeleteGui();
135
136 virtual void SetFrame(wxFrame* f) {m_Frame = f;};
137
138 virtual void OnSize(wxSizeEvent &size_event) {};
139
141 virtual void SetWindowSize(int w, int h) {};
142
144 virtual bool Pick(int x, int y);
145
147 virtual bool Pick(albaMatrix &m);
148
150 virtual void GetPickedPosition(double pos[3]);
151
153 virtual albaVME *GetPickedVme() {return m_PickedVME;};
154
156 virtual vtkProp3D *GetPickedProp() {return m_PickedProp;};
157
159 virtual int GetNumberOfVisibleVME() {return m_NumberOfVisibleVme;};
160
162 virtual void Print(std::ostream& os, const int tabs=0);// const;
163
166 {
167 ID_FIRST = MINID,
170 ID_LAST
171 };
172
174 virtual const char *GetHTMLText(){return m_HTMLText.GetCStr();};
175
177 vtkCellPicker *GetPicker2D() {return m_Picker2D;};
178
180 virtual char ** GetIcon();
181
182 virtual wxColor GetBackgroundColor() { return m_BackgroundColor; };
183 virtual void SetBackgroundColor(wxColor color) = 0;
184
185
187 bool GetCanSpin() const { return m_CanSpin; }
188
190 void SetCanSpin(bool canSpin) { m_CanSpin = canSpin; }
191
192protected:
194 wxString m_Label;
195 wxString m_Name;
196 wxWindow *m_Win;
197 wxFrame *m_Frame;
200
201 vtkCellPicker *m_Picker2D;
202 vtkALBARayCast3DPicker* m_Picker3D;
203
205 vtkProp3D *m_PickedProp;
206 double m_PickedPosition[3];
208
209 wxPrintData *m_PrintData;
211
213
216
218 bool FindPickedVme(vtkAssemblyPath *ap = NULL);
219
227 virtual albaGUI *CreateGui();
228
229
230
231public:
232 int m_Mult;
233 int m_Id;
234 bool m_Plugged; // forget it - it is used from outside
235 albaView *m_Next; // forget it - it is used from outside
236
237};
238#endif
MINID
Definition: albaDecl.h:420
VME_VISIBILITY_ID
VME visibility attribute when plugging visual pipe.
Definition: albaView.h:57
@ MUTEX
Definition: albaView.h:60
@ NON_VISIBLE
Definition: albaView.h:58
@ VISIBLE
Definition: albaView.h:59
NODE_STATUS_ID
status of a SceneNode – do not change, it is used by albaCheckTree also
Definition: albaView.h:48
@ NODE_NON_VISIBLE
Definition: albaView.h:49
@ NODE_VISIBLE_OFF
Definition: albaView.h:50
@ NODE_VISIBLE_ON
Definition: albaView.h:51
@ NODE_MUTEX_OFF
Definition: albaView.h:52
@ NODE_MUTEX_ON
Definition: albaView.h:53
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
class name: albaGUIHolder Secialized panel in which a developer can put a albaGUI.
Definition: albaGUIHolder.h:32
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
Abstract superclass for all ALBA classes implementing RTTI APIs.
Definition: albaObject.h:38
Interface implementing the Observer of the Subject/Observer design pattern.
Definition: albaObserver.h:36
albaRWIBase is a vtkRenderWindowInteractor placed on a wxWindow
Definition: albaRWIBase.h:61
albaString - performs common string operations on c-strings.
Definition: albaString.h:43
albaVME -
Definition: albaVME.h:150
albaView is the base class for Views in alba.
Definition: albaView.h:79
vtkALBARayCast3DPicker * m_Picker3D
Used to pick in a VTK Render window.
Definition: albaView.h:202
albaString m_HTMLText
Definition: albaView.h:210
albaObserver * m_Listener
Definition: albaView.h:193
virtual albaGUI * GetGui()
Definition: albaView.h:131
virtual int GetNodeStatus(albaVME *vme)
return the status of the node within this view.
Definition: albaView.h:119
virtual wxFrame * GetFrame()
Definition: albaView.h:130
bool m_CanSpin
Definition: albaView.h:215
virtual wxWindow * GetWindow()
Definition: albaView.h:129
virtual char ** GetIcon()
return an xpm-icon that can be used to represent this view
bool m_LightCopyEnabled
Definition: albaView.h:214
virtual void SetFrame(wxFrame *f)
Definition: albaView.h:136
void SetLabel(wxString label)
Definition: albaView.h:126
albaGUIHolder * m_Guih
Definition: albaView.h:199
wxString GetLabel()
Definition: albaView.h:124
virtual void Create()
Definition: albaView.h:89
virtual albaGUI * CreateGui()
Internally used to create a new instance of the GUI.
virtual wxColor GetBackgroundColor()
Definition: albaView.h:182
void SetName(wxString name)
Definition: albaView.h:127
virtual void CameraReset(albaVME *node=NULL)
Definition: albaView.h:101
wxFrame * m_Frame
Definition: albaView.h:197
wxColor m_BackgroundColor
Definition: albaView.h:212
virtual bool Pick(int x, int y)
Perform a picking according to the screen position (x,y) and return true on success.
virtual ~albaView()
virtual void SetWindowSize(int w, int h)
Set the vtk RenderWindow size.
Definition: albaView.h:141
wxWindow * m_Win
Definition: albaView.h:196
virtual void CameraUpdate()
Definition: albaView.h:102
albaView(const wxString &label="View")
virtual void OnEvent(albaEventBase *alba_event)
process the events sent by subjects
wxString GetName()
Definition: albaView.h:125
vtkCellPicker * GetPicker2D()
Return the picker used to pick the in the render window.
Definition: albaView.h:177
virtual void SetMouse(albaDeviceButtonsPadMouse *mouse)
Definition: albaView.h:103
void SetCanSpin(bool canSpin)
Sets CanSpin.
Definition: albaView.h:190
wxString m_Label
Definition: albaView.h:194
virtual void OnSize(wxSizeEvent &size_event)
Definition: albaView.h:138
virtual bool Pick(albaMatrix &m)
Perform a picking according to the absolute matrix given and return true on success.
vtkProp3D * m_PickedProp
Pointer to the picked vme Prop3D. It is initialized on picking.
Definition: albaView.h:205
virtual vtkProp3D * GetPickedProp()
Return the corresponding vtkProp3D of the picked VME.
Definition: albaView.h:156
VIEW_WIDGET_ID
IDs for the GUI.
Definition: albaView.h:166
@ ID_PRINT_INFO
Definition: albaView.h:168
@ ID_HELP
Definition: albaView.h:169
virtual void VmeAdd(albaVME *vme)
Definition: albaView.h:91
virtual void GetImage(wxBitmap &bmp, int magnification=1)
Definition: albaView.h:106
virtual void VmeDeletePipe(albaVME *vme)
Definition: albaView.h:99
virtual void VmeUpdateProperty(albaVME *vme, bool fromTag=false)
Definition: albaView.h:95
albaGUI * m_Gui
Definition: albaView.h:198
int m_Id
Used to store the view type created (e.g. view surface).
Definition: albaView.h:233
virtual albaView * Copy(albaObserver *Listener, bool lightCopyEnabled=false)
Definition: albaView.h:88
int m_NumberOfVisibleVme
perform ResetCamera only for the first vme shown into the view
Definition: albaView.h:207
virtual albaSceneGraph * GetSceneGraph()
Definition: albaView.h:105
virtual bool FindPokedVme(albaDevice *device, albaMatrix &point_pose, vtkProp3D *&picked_prop, albaVME *&picked_vme, albaInteractor *&picked_behavior)
Find the pocked VME at button down.
Definition: albaView.h:115
virtual void SetListener(albaObserver *Listener)
Definition: albaView.h:86
virtual void VmeShow(albaVME *vme, bool show)
Definition: albaView.h:94
virtual albaVME * GetPickedVme()
Return the picked VME during the Pick method.
Definition: albaView.h:153
int m_Mult
Used to store the multiplicity of the view type created (e.g. the 3rd view surface created).
Definition: albaView.h:232
virtual void OptionsUpdate()
Called to update all components that depends on Application Options.
Definition: albaView.h:109
albaView * m_Next
Definition: albaView.h:235
virtual void VmeCreatePipe(albaVME *vme)
Definition: albaView.h:98
wxPrintData * m_PrintData
Definition: albaView.h:209
bool m_Plugged
Definition: albaView.h:234
bool FindPickedVme(vtkAssemblyPath *ap=NULL)
Find the VME picked.
albaVME * m_PickedVME
Pointer to the picked vme. It is initialized on picking.
Definition: albaView.h:204
virtual void Print(std::ostream &os, const int tabs=0)
Print a dump of this object into the Log area.
virtual bool IsVmeShowed(albaVME *vme)
Definition: albaView.h:96
albaAbstractTypeMacro(albaView, albaObject)
virtual void VmeRemove(albaVME *vme)
Definition: albaView.h:92
virtual albaPipe * GetNodePipe(albaVME *vme)
return the current pipe for the specified vme (if any exist at this moment)
Definition: albaView.h:122
bool GetCanSpin() const
Returns CanSpin.
Definition: albaView.h:187
virtual void GetPickedPosition(double pos[3])
Write into the double array the position picked during Pick method.
vtkCellPicker * m_Picker2D
the picker used to pick the in the render window
Definition: albaView.h:201
wxString m_Name
Definition: albaView.h:195
virtual void VmeSelect(albaVME *vme, bool select)
Definition: albaView.h:93
virtual int GetNumberOfVisibleVME()
Return the number of visible VMEs.
Definition: albaView.h:159
virtual void SetBackgroundColor(wxColor color)=0
virtual const char * GetHTMLText()
Retrieve html information.
Definition: albaView.h:174
void DeleteGui()
destroy the Gui
virtual albaRWIBase * GetRWI()
Definition: albaView.h:104