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;
34
35class albaRWIBase;
36class vtkRenderer;
37class vtkCellPicker;
38class vtkAssemblyPath;
39
40//----------------------------------------------------------------------------
41// const :
42//----------------------------------------------------------------------------
45{
51};
54{
58};
59
60//----------------------------------------------------------------------------
61// albaView :
62//----------------------------------------------------------------------------
75class ALBA_EXPORT albaView: public albaObserver, public albaServiceClient, public albaObject
76{
77public:
78 albaView(const wxString &label = "View");
79 virtual ~albaView();
80
82
83 virtual void SetListener(albaObserver *Listener) {m_Listener = Listener;};
84 virtual void OnEvent(albaEventBase *alba_event);
85 virtual albaView* Copy(albaObserver *Listener, bool lightCopyEnabled = false) {m_LightCopyEnabled = lightCopyEnabled; return NULL;};
86 virtual void Create() {};
87
88 virtual void VmeAdd(albaVME *vme) {};
89 virtual void VmeRemove(albaVME *vme) {};
90 virtual void VmeSelect(albaVME *vme, bool select) {};
91 virtual void VmeShow(albaVME *vme, bool show) {};
92 virtual void VmeUpdateProperty(albaVME *vme, bool fromTag = false) {};
93 virtual bool IsVmeShowed(albaVME *vme) { return GetNodePipe(vme) != NULL; };
94
96 virtual bool IsSliceView() { return false; }
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 albaRWIBase *GetRWI() {return NULL;};
104 virtual vtkRenderer *GetFrontRenderer() {return NULL;};
105 virtual albaSceneGraph *GetSceneGraph() {return NULL;};
106 virtual void GetImage(wxBitmap &bmp, int magnification = 1) {};
107
109 virtual void OptionsUpdate() {};
110
111
113 //having albaView::GetNodeStatus allow albaGUIVMETree to not know about albaSceneGraph
114 virtual int GetNodeStatus(albaVME *vme) {return NODE_NON_VISIBLE;};
115
117 virtual albaPipe* GetNodePipe(albaVME *vme) {return NULL;};
118
119 wxString GetLabel() {return m_Label;};
120 wxString GetName() {return m_Name;};
121 void SetLabel(wxString label) {m_Label = label;};
122 void SetName(wxString name) {m_Name = name;};
123
124 virtual wxWindow* GetWindow(){return m_Win;};
126 virtual wxWindow* GetFrame() {return m_Frame;};
127 virtual albaGUI* GetGui() {if(m_Gui == NULL) CreateGui(); assert(m_Gui); return m_Gui;};
128
130 void DeleteGui();
131
132 virtual void SetFrame(wxWindow* f) {m_Frame = f;};
133
134 virtual void OnSize(wxSizeEvent &size_event) {};
135
137 virtual void SetWindowSize(int w, int h) {};
138
140 virtual bool Pick(int x, int y);
141
143 virtual void GetPickedPosition(double pos[3]);
144
146 virtual albaVME *GetPickedVme() {return m_PickedVME;};
147
149 virtual int GetNumberOfVisibleVME() {return m_NumberOfVisibleVme;};
150
152 virtual void Print(std::ostream& os, const int tabs=0);// const;
153
156 {
157 ID_FIRST = MINID,
160 ID_LAST
161 };
162
164 virtual const char *GetHTMLText(){return m_HTMLText.GetCStr();};
165
167 vtkCellPicker *GetPicker2D() {return m_Picker2D;};
168
170 virtual char ** GetIcon();
171
172 virtual wxColor GetBackgroundColor() { return m_BackgroundColor; };
173 virtual void SetBackgroundColor(wxColor color) = 0;
174
175
177 bool GetCanSpin() const { return m_CanSpin; }
178
180 void SetCanSpin(bool canSpin) { m_CanSpin = canSpin; }
181
182protected:
184 wxString m_Label;
185 wxString m_Name;
186 wxWindow *m_Win;
187 wxWindow *m_Frame;
190
191 vtkCellPicker *m_Picker2D;
192
194 double m_PickedPosition[3];
196
197 wxPrintData *m_PrintData;
199
201
204
206 bool FindPickedVme(vtkAssemblyPath *ap = NULL);
207
215 virtual albaGUI *CreateGui();
216
217
218
219public:
220 int m_Mult;
221 int m_Id;
222 bool m_Plugged; // forget it - it is used from outside
223 albaView *m_Next; // forget it - it is used from outside
224
225};
226#endif
MINID
Definition: albaDecl.h:251
VME_VISIBILITY_ID
VME visibility attribute when plugging visual pipe.
Definition: albaView.h:54
@ MUTEX
Definition: albaView.h:57
@ NON_VISIBLE
Definition: albaView.h:55
@ VISIBLE
Definition: albaView.h:56
NODE_STATUS_ID
status of a SceneNode – do not change, it is used by albaGUIVMETree also
Definition: albaView.h:45
@ NODE_NON_VISIBLE
Definition: albaView.h:46
@ NODE_VISIBLE_OFF
Definition: albaView.h:47
@ NODE_VISIBLE_ON
Definition: albaView.h:48
@ NODE_MUTEX_OFF
Definition: albaView.h:49
@ NODE_MUTEX_ON
Definition: albaView.h:50
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
Base class of the behaviors: a behavior is the interaction tool of a VME.
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:62
albaString - performs common string operations on c-strings.
Definition: albaString.h:43
albaVME -
Definition: albaVME.h:151
albaView is the base class for Views in alba.
Definition: albaView.h:76
albaString m_HTMLText
Definition: albaView.h:198
albaObserver * m_Listener
Definition: albaView.h:183
virtual albaGUI * GetGui()
Definition: albaView.h:127
virtual int GetNodeStatus(albaVME *vme)
return the status of the node within this view.
Definition: albaView.h:114
bool m_CanSpin
Definition: albaView.h:203
virtual wxWindow * GetWindow()
Definition: albaView.h:124
virtual char ** GetIcon()
return an xpm-icon that can be used to represent this view
bool m_LightCopyEnabled
Definition: albaView.h:202
void SetLabel(wxString label)
Definition: albaView.h:121
albaGUIHolder * m_Guih
Definition: albaView.h:189
wxString GetLabel()
Definition: albaView.h:119
virtual void Create()
Definition: albaView.h:86
virtual albaGUI * CreateGui()
Internally used to create a new instance of the GUI.
virtual wxColor GetBackgroundColor()
Definition: albaView.h:172
void SetName(wxString name)
Definition: albaView.h:122
virtual void CameraReset(albaVME *node=NULL)
Definition: albaView.h:101
wxColor m_BackgroundColor
Definition: albaView.h:200
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:137
wxWindow * m_Win
Definition: albaView.h:186
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:120
virtual void SetFrame(wxWindow *f)
Definition: albaView.h:132
vtkCellPicker * GetPicker2D()
Return the picker used to pick the in the render window.
Definition: albaView.h:167
void SetCanSpin(bool canSpin)
Sets CanSpin.
Definition: albaView.h:180
wxString m_Label
Definition: albaView.h:184
virtual void OnSize(wxSizeEvent &size_event)
Definition: albaView.h:134
wxWindow * m_Frame
Definition: albaView.h:187
VIEW_WIDGET_ID
IDs for the GUI.
Definition: albaView.h:156
@ ID_PRINT_INFO
Definition: albaView.h:158
@ ID_HELP
Definition: albaView.h:159
virtual void VmeAdd(albaVME *vme)
Definition: albaView.h:88
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:92
virtual bool IsSliceView()
Return true if the view shows a slice with a parallel camera; the slice views override it.
Definition: albaView.h:96
albaGUI * m_Gui
Definition: albaView.h:188
int m_Id
Used to store the view type created (e.g. view surface).
Definition: albaView.h:221
virtual albaView * Copy(albaObserver *Listener, bool lightCopyEnabled=false)
Definition: albaView.h:85
int m_NumberOfVisibleVme
perform ResetCamera only for the first vme shown into the view
Definition: albaView.h:195
virtual albaSceneGraph * GetSceneGraph()
Definition: albaView.h:105
virtual vtkRenderer * GetFrontRenderer()
Definition: albaView.h:104
virtual void SetListener(albaObserver *Listener)
Definition: albaView.h:83
virtual void VmeShow(albaVME *vme, bool show)
Definition: albaView.h:91
virtual albaVME * GetPickedVme()
Return the picked VME during the Pick method.
Definition: albaView.h:146
int m_Mult
Used to store the multiplicity of the view type created (e.g. the 3rd view surface created).
Definition: albaView.h:220
virtual void OptionsUpdate()
Called to update all components that depends on Application Options.
Definition: albaView.h:109
virtual wxWindow * GetFrame()
Return the page that shows the view in the view area (albaGUIViewPage)
Definition: albaView.h:126
albaView * m_Next
Definition: albaView.h:223
virtual void VmeCreatePipe(albaVME *vme)
Definition: albaView.h:98
wxPrintData * m_PrintData
Definition: albaView.h:197
bool m_Plugged
Definition: albaView.h:222
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:193
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:93
albaAbstractTypeMacro(albaView, albaObject)
virtual void VmeRemove(albaVME *vme)
Definition: albaView.h:89
virtual albaPipe * GetNodePipe(albaVME *vme)
return the current pipe for the specified vme (if any exist at this moment)
Definition: albaView.h:117
bool GetCanSpin() const
Returns CanSpin.
Definition: albaView.h:177
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:191
wxString m_Name
Definition: albaView.h:185
virtual void VmeSelect(albaVME *vme, bool select)
Definition: albaView.h:90
virtual int GetNumberOfVisibleVME()
Return the number of visible VMEs.
Definition: albaView.h:149
virtual void SetBackgroundColor(wxColor color)=0
virtual const char * GetHTMLText()
Retrieve html information.
Definition: albaView.h:164
void DeleteGui()
destroy the Gui
virtual albaRWIBase * GetRWI()
Definition: albaView.h:103