ALBA
albaLogicWithManagers.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: ALBA (Agile Library for Biomedical Applications)
4 Module: albaLogicWithManagers
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 __albaLogicWithManagers_H__
17#define __albaLogicWithManagers_H__
18
19
20//----------------------------------------------------------------------------
21// includes :
22#include "albaGUIPanel.h"
23#include "albaDecl.h"
24#include "albaEvent.h"
25#include "albaVMEManager.h"
26#include "albaGUIMDIFrame.h"
27#include "albaSideBar.h"
28#include "albaAbsLogicManager.h"
29
30
31//----------------------------------------------------------------------------
32// forward reference
33class albaViewManager;
34class albaOpManager;
36class albaVME;
37class albaVMELandmark;
38class albaVMELandmarkCloud;
45class albaGUISettings;
46class albaUser;
48class albaWizard;
49class albaGUITimeBar;
50class albaWXLog;
51class albaVTKLog;
54class albaHelpManager;
58
59typedef int(*eventfilterFunc)(wxEvent& event);
60
61//----------------------------------------------------------------------------
62// albaLogicWithManagers :
63//----------------------------------------------------------------------------
111class ALBA_EXPORT albaLogicWithManagers : public albaObserver, public albaAbsLogicManager
112{
113public:
114
117
119 virtual void OnEvent(albaEventBase *alba_event);
120
122 virtual void Plug(albaView* view, bool visibleInMenu = true);
123
124
127 virtual void Plug(albaOp *op, wxString menuPath = "", bool canUndo = true, albaGUISettings *setting = NULL);
128
132 virtual void Configure();
133
136
138 virtual void Init(int argc, char **argv);
139
141 void PlugVMEManager(bool b) { m_UseVMEManager = b; };
142
144 void PlugViewManager(bool b) { m_UseViewManager = b; };
145
147 void PlugOpManager(bool b) { m_UseOpManager = b; };
148
150 void PlugInteractionManger(bool b) { m_UseInteractionManager = b; }
151
153 void PlugWizardManager(bool b) { m_UseWizardManager = b; };
154
156 void PlugSnapshotManager(bool b) { m_UseSnapshotManager = b; };
157
158 /* Initialize Prosthesis DB Manager*/
159 void PlugProsthesisDBManager(albaString passPhrase = "");
160
162 virtual void Plug(albaWizard *wizard, wxString menuPath = "");
163
165 virtual void Show();
166
168 void FillMenus();
169
171 albaUser *GetUser() { return m_User; };
172
177
179 virtual void HandleException();
180
182 int AppEventFilter(wxEvent& event);
183
184
186 void ALBAExpertModeOn() { (*GetALBAExpertMode()) = true; };
187 void ALBAExpertModeOff() { (*GetALBAExpertMode()) = false; };
188 void SetALBAExpertMode(int value) { (*GetALBAExpertMode()) = value; };
189
191 void SetFileExtension(albaString &extension) { m_Extension = extension; };
192
194 virtual albaGUIMDIFrame *GetTopWin() { return m_Win; };
195
197 void PlugToolbar(bool plug) { m_PlugToolbar = plug; };
199 void PlugSidebar(bool plug) { m_PlugControlPanel = plug; };
201 void PlugTimebar(bool plug) { m_PlugTimebar = plug; };
203 void PlugLogbar(bool plug) { m_PlugLogPanel = plug; };
204
205
208 virtual void ShowSplashScreen(wxBitmap &splashImage, wxString message ="", int pos=2, wxColour color = *wxBLACK);
209
210 static void ShowWebSite(wxString url);
211
213 bool IsOperationRunning() { return m_RunningOperation; }
214
215 // VME
216 virtual const char* GetMsfFileExtension() { return m_Extension.GetCStr(); }
217
218 /* Return the Operation Manager */
219 virtual albaOpManager * GetOpManager() const { return m_OpManager; }
220
221 virtual albaViewManager *GetViewManager() { return m_ViewManager; }
222
223 virtual void PrintImage(albaVMEImage *img);
224
225 eventfilterFunc GetEventFilterFunc() const { return m_EventFilterFunc; }
226
227 void SetEventFilterFunc(eventfilterFunc val) { m_EventFilterFunc = val;}
228
230 mmaApplicationLayout* GetLayout() { return m_AppLayout; };
231
232 // Inherited via albaAbsLogicManager
234
237
240
242 albaString GetAboutImage() const { return m_AboutImage; }
243
245 void SetAboutImage(albaString aboutImage) { m_AboutImage = aboutImage; }
246
248 virtual bool IsVMEExpanded(albaVME *vme);
249
251 virtual void CollapseVME(albaVME *vme);
252
254 virtual void ExpandVME(albaVME *vme);
255
256
258 virtual const char* GetAppBuildNum();
260 virtual void SetAppBuildNum(char* buildNum);
262 virtual const char* GetAlbaBuildNum();
264 virtual void SetAlbaBuildNum(char* buildNum);
266 const char *GetCitationPaper() { return m_CitationPaper.GetCStr(); }
268 void SetCitationPaper(char *link) { m_CitationPaper = link; }
269
270 void RegisterForKeyEvents(albaObserver *listener) override;
271
272
273 void UnRegisterForKeyEvents(albaObserver *listener) override;
274
275protected:
276 //---------------------------------------------------------
277 // Description:
278 // Method to update the time bounds when
279 // the tree representation change by adding or deleting a vme.
280 virtual void UpdateTimeBounds();
281
282 // Description:
283 // Set the time to update the time bar.
284 virtual void TimeSet(double t);
285 //---------------------------------------------------------
286
288 virtual void CreateMenu();
290 virtual void CreateStorage(albaEvent *e);
291
293 virtual void CreateAndPlugToolbar();
294
296 virtual void CreateToolbar();
297
299 virtual void CreateControlPanel();
301 virtual void CreateTimeBar();
303 virtual void CreateLogPanel();
306
307
309 void EnableItem(int item, bool enable);
310
313
315 virtual void RestoreLayout();
316
317 // EVENT HANDLERS
318
320 virtual void OnFileNew();
324 virtual void OnFileOpen(const char *file_to_open = NULL);
326 virtual void OnFileHistory(int menuId);
328 virtual void OnFileSave();
330 virtual void OnFileSaveAs(bool legacy = false);
331
333 virtual void OnQuit();
334
337 virtual void ImportExternalFile(albaString &filename);
338
340 virtual void VmeSelect(albaVME *vme);
342 virtual void VmeSelected(albaVME *vme);
343
345 void SelectLandmark(albaVMELandmark *lm, bool select);
346
348 virtual void VmeDoubleClicked(albaEvent &e);
350 virtual void VmeShow(albaVME *vme, bool visibility);
351
353 void ShowLandmarkCloud(albaVMELandmarkCloud * lmc, bool visibility);
354
356 void ShowInSideBar(albaVME * vme, bool visibility);
357
358 /* Called from VmeShow to show landmarks*/
359 void ShowLandmark(albaVMELandmark * lm, bool visibility);
360
362 virtual void VmeModified(albaVME *vme);
363
365 virtual void VmeAdd(albaVME *vme);
367 virtual void VmeAdded(albaVME *vme);
369 virtual void VmeRemove(albaVME *vme);
371 virtual void VmeRemoving(albaVME *vme);
373 virtual void VmeRemoved();
374
375 virtual void VmeVisualModeChanged(albaVME * vme);
376
378 virtual void VmeChooseMaterial(albaVME *vme, bool updateProperty);
379
380 //Update Vme Visual Properties
381 virtual void VmeUpdateProperties(albaVME *vme, bool updatePropertyFromTag);
382
384 virtual void OpRunStarting();
386 virtual void OpRunTerminated(int runOk);
388 virtual void OpShowGui(bool push_gui, albaGUIPanel *panel);
390 virtual void OpHideGui(bool view_closed);
391
394
396 virtual void ViewContextualMenu(bool vme_menu);
397
399 virtual void ViewCreate(int viewId);
401 virtual void ViewCreated(albaView *v);
403 virtual void ViewSelect();
404
405 virtual void CameraUpdate();
406
407 virtual void CameraReset();
408
411
414
417
419 virtual void EnableMenuAndToolbar();
420
422 virtual void UpdateFrameTitle();
423
424 //-------------------
425
426
429
431 virtual void WizardRunStarting();
432
434 virtual void WizardRunTerminated();
435
437 virtual void CreateWizardToolbar();
438
439
440
448 albaVMELandmark *m_SelectedLandmark;
450
451
454
456
458
462 wxMenu *m_OpMenu;
463 wxMenu *m_ViewMenu;
464
471
473
476
481
483
489 wxStaticText* m_WizardLabel;
493
496 wxToolBar *m_ToolBar;
497 wxMenuBar *m_MenuBar;
500 wxString m_AppTitle;
502
506
508
511
512 std::vector<albaObserver *> m_KeyEventListeners;
513
525private:
526
527};
528#endif
ALBA_EXPORT int * GetALBAExpertMode()
int(* eventfilterFunc)(wxEvent &event)
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
class name: albaGUIAboutDialog.
Class Name: albaGUIApplicationSettings.
Class Name: albaGUIMDIFrame.
albaMaterialChooser let the user Choose one of the predefined materials, but also edit material setti...
class name: albaGUIPanel Inherits directly from wxPanel and adds the pointer to the next panel
Definition: albaGUIPanel.h:27
class name: albaGUISettingsDialog.
class name: albaGUISettingsTimeBar Gui class for handling time bar properties inside application sett...
class name: albaGUISettings base class for more complex specified classes regarding the setting of ap...
albaGUITimeBar is a wxPanel with a set of widget to handle time.
Class Name: albaHelpManager.
This class takes care of mastering the interaction inside views.
albaLogicWithManagers provide:
void PlugVMEManager(bool b)
Must be called before Configure.
virtual void Show()
Set the application stamp to the VMEManager and Shows the application.
void PlugToolbar(bool plug)
Sets the flag to know if Toolbar should be built.
virtual void OnFileHistory(int menuId)
FILE HISTORY evt.
virtual void VmeAdded(albaVME *vme)
Respond to a VME_ADDED evt.
void UpdateMeasureUnit()
Called when user change the measure unit from menù Options.
virtual void OnFileOpen(const char *file_to_open=NULL)
FILE OPEN evt.
void ALBAExpertModeOn()
Set ALBA Expert Mode.
virtual void SetAlbaBuildNum(char *buildNum)
Get Alba Build Number.
bool m_ShowInteractionSettings
Flag to show storage setting default is false.
virtual void WizardRunTerminated()
Called when an wizard stops.
void SelectLandmark(albaVMELandmark *lm, bool select)
Called from VmeSelect to select a LM.
virtual void DisableCameraUpdateSkip()
exit the Camera Update Skip Modality
albaProsthesesDBManager * m_ProsthesisDBManager
eventfilterFunc m_EventFilterFunc
albaGUIAboutDialog * m_AboutDialog
void RegisterForKeyEvents(albaObserver *listener) override
virtual void CreateToolbar()
This method creates the toolbar, override this method for specific app toolbars.
bool IsOperationRunning()
Returns true if there is a Running Operation.
virtual void OpRunTerminated(int runOk)
Called when an operation stops.
void SetApplicationStamp(albaString &app_stamp)
Set the application stamp for the application, if set to OPEN_ALL_DATA let's the application to open ...
virtual void VmeRemoving(albaVME *vme)
Respond to a VME_REMOVING evt.
void PlugWizardManager(bool b)
Must be called before Configure.
void CreateToolBarsAndPanels()
Creates menu and tool bars.
virtual void HandleException()
Manage application exception and allow to save at least the tree.
virtual void OpShowGui(bool push_gui, albaGUIPanel *panel)
Show the gui of the running operation or the settings of the selected view.
virtual const char * GetMsfFileExtension()
void PlugStandardOperations()
Plugs a list of standard operations, importer and exporters included.
virtual void OpRunStarting()
Called when an operation starts.
virtual void VmeRemoved()
called from VME after removing
virtual void CollapseVME(albaVME *vme)
Collapse the VME on the Tree.
virtual void ShowSplashScreen(wxBitmap &splashImage, wxString message="", int pos=2, wxColour color= *wxBLACK)
Used to give a splash screen image directly from the bitmap without converting it in xpm.
albaUser * GetUser()
Return the applications' user.
albaLogicWithManagers(albaGUIMDIFrame *mdiFrame=NULL)
void PlugSidebar(bool plug)
Sets the flag to know if Side bar should be built.
albaWizardManager * m_WizardManager
virtual void OnQuit()
Called on Quit event.
virtual void ImportExternalFile(albaString &filename)
Called when a user drag a non msf or zmsf file over the application.
virtual void WizardRunStarting()
Called when an wizard starts.
albaString GetAboutImage() const
Returns AboutImage.
virtual void CreateLogPanel()
Virtual method to create the log bar.
virtual void VmeSelected(albaVME *vme)
Respond to a VME_SELECTED evt.
virtual void ExpandVME(albaVME *vme)
Expand the VME on the Tree
virtual bool IsVMEExpanded(albaVME *vme)
Return True if the VME is Expanded on Tree.
std::vector< albaObserver * > m_KeyEventListeners
List of the observers that are registered to receive key events.
virtual const char * GetAppBuildNum()
Get the App Build Number.
void SetCitationPaper(char *link)
Set the link to the citation Paper.
mmaApplicationLayout * GetLayout()
Get application layout.
virtual void VmeChooseMaterial(albaVME *vme, bool updateProperty)
Build a dialog to show all available materials.
albaInteractionManager * m_InteractionManager
virtual void UpdateFrameTitle()
Called after FileOpen or Save operation.
virtual void Plug(albaView *view, bool visibleInMenu=true)
Plug a new view.
int AppEventFilter(wxEvent &event)
Manage application Events.
virtual void CameraUpdate()
void PlugProsthesisDBManager(albaString passPhrase="")
virtual void Init(int argc, char **argv)
Program Initialization.
void PlugViewManager(bool b)
Must be called before Configure.
void CreateNullLog()
Create a null logger.
virtual void CreateMenu()
Redefined to add View,Op,Import,Export menu.
virtual albaProsthesesDBManager * GetProsthesesDBManager()
virtual void Plug(albaWizard *wizard, wxString menuPath="")
Plug a new wizard.
virtual void VmeVisualModeChanged(albaVME *vme)
static void ShowWebSite(wxString url)
virtual void OnFileSave()
FILE SAVE evt.
void SetEventFilterFunc(eventfilterFunc val)
void ShowLandmark(albaVMELandmark *lm, bool visibility)
albaDeviceButtonsPadMouse * m_Mouse
mmaApplicationLayout * m_AppLayout
virtual void CreateAndPlugToolbar()
This method creates and add the Toolbar, for specific app toolbar override the CreateToolBar method.
bool m_PlugTimebar
Flag to plug or not the Time-bar into the application. Default is true.
virtual void PrintImage(albaVMEImage *img)
void PlugInteractionManger(bool b)
Must be called before Configure.
void SetALBAExpertMode(int value)
virtual const char * GetAlbaBuildNum()
Set Alba Build Number.
virtual void VmeUpdateProperties(albaVME *vme, bool updatePropertyFromTag)
virtual void TreeContextualMenu(albaEvent &e)
Show contextual menu for tree when right mouse click arrives.
virtual void Configure()
Configure the application.
virtual void VmeShow(albaVME *vme, bool visibility)
Show/Hide the vme.
void PlugTimebar(bool plug)
Sets the flag to know if Time bar should be built.
virtual void CreateWizardToolbar()
Redefined to add Print buttons.
virtual void CreateTimeBar()
Virtual method to create the time bar.
void EnableItem(int item, bool enable)
Enable/disable a Toolbar or Menu Item.
void PlugOpManager(bool b)
Must be called before Configure.
bool m_PlugToolbar
Flag to plug or not the Toolbar into the application. Default is true.
albaSnapshotManager * m_SnapshotManager
virtual void OnFileSaveAs(bool legacy=false)
FILE SAVEAS evt.
virtual albaOpManager * GetOpManager() const
virtual void TimeSet(double t)
virtual ~albaLogicWithManagers()
virtual void VmeDoubleClicked(albaEvent &e)
Respond to a VME_DCLICKED evt.
virtual void OnEvent(albaEventBase *alba_event)
Events management.
virtual void SetAppBuildNum(char *buildNum)
Set the App Build Number.
virtual void OnFileNew()
FILE NEW evt.
virtual void ViewContextualMenu(bool vme_menu)
Show contextual menu for views when right mouse click arrives.
albaUser * m_User
Applications' user.
virtual void EnableCameraUpdateSkip()
enter in Camera Update Skip Modality, useful to avoid flickering or incomplete visualizations
virtual void ViewCreate(int viewId)
Create a new view.
void PlugStandardViews()
Plugs a list of standard operations, importer and exporters included.
virtual albaGUIMDIFrame * GetTopWin()
Returns the pointer to the main panel of the application.
albaHelpManager * m_HelpManager
bool m_PlugLogPanel
Flag to plug or not the Log area into the application. Default is true.
bool m_PlugControlPanel
Flag to plug or not the Side-bar into the application. Default is true.
void ShowInSideBar(albaVME *vme, bool visibility)
Show VME in the side bar.
void StoreLayout()
Stores application layout.
virtual void ViewCreated(albaView *v)
A new View has Been Created - Logic must create the View Frame.
virtual void ConfigureWizardManager()
to be added
virtual void RestoreLayout()
Restores application layout.
albaGUISettingsTimeBar * m_TimeBarSettings
void PlugLogbar(bool plug)
Sets the flag to know if Log bar should be built.
void ShowLandmarkCloud(albaVMELandmarkCloud *lmc, bool visibility)
Called from VmeShow to show a LM cloud.
virtual void UpdateTimeBounds()
albaPrintManager * m_PrintSupport
eventfilterFunc GetEventFilterFunc() const
albaGUISettingsDialog * m_SettingsDialog
virtual void VmeSelect(albaVME *vme)
Respond to a VME_SELECT evt.
albaVMELandmark * m_SelectedLandmark
albaGUIApplicationSettings * m_ApplicationSettings
virtual void CreateStorage(albaEvent *e)
create a new storage object
virtual albaViewManager * GetViewManager()
long m_SidebarStyle
Store the style of the sidebar. Old style (ALBA 1.x): SINGLE_NOTEBOOK or new style (ALBA 2....
const char * GetCitationPaper()
Get the link to the citation Paper.
virtual void VmeAdd(albaVME *vme)
Add a new vme to the tree.
albaGUISplashScreen * m_SplashScreen
albaViewManager * m_ViewManager
virtual void CameraReset()
albaGUIMaterialChooser * m_MaterialChooser
virtual void VmeRemove(albaVME *vme)
Remove a vme from the tree.
void PlugSnapshotManager(bool b)
Must be called before Configure.
virtual void ViewSelect()
Select a view and update the display list for the tree.
virtual void CreateControlPanel()
Virtual method to create the side bar.
bool m_ShowStorageSettings
Flag to show storage setting default is false.
virtual void VmeModified(albaVME *vme)
Respond to a vme Modified evt.
void UnRegisterForKeyEvents(albaObserver *listener) override
virtual void OpHideGui(bool view_closed)
Hide the setting's gui when a view is destroyed.
bool m_Quitting
Variable that allows to determine if the application is Quitting or not.
void FillMenus()
Fill the View and operation menu's
virtual void EnableMenuAndToolbar()
Enable/Disable menu items when an operation start/end running.
virtual void Plug(albaOp *op, wxString menuPath="", bool canUndo=true, albaGUISettings *setting=NULL)
Plug a new operation and its undo flag: if the operation does not support undo the undo flag has no e...
bool m_PlugMenu
Flag to plug or not the Menu into the application. Default is true.
void SetFileExtension(albaString &extension)
Set the file extension.
void SetAboutImage(albaString aboutImage)
Sets AboutImage.
Interface implementing the Observer of the Subject/Observer design pattern.
Definition: albaObserver.h:36
Definition: albaOp.h:50
Class Name: albaProsthesesDBManager.
Class Name: albaSnapshotManager.
albaString - performs common string operations on c-strings.
Definition: albaString.h:43
albaUser - Used to manage username and password; store them and give basic function to check user's c...
Definition: albaUser.h:33
albaVMEManager : Class managing VMEs inside a ALBA application.
albaVME -
Definition: albaVME.h:150
An implementation of albaViewManager with [D]ynamic view [C]reation feature.
albaView is the base class for Views in alba.
Definition: albaView.h:79
Class Name: albaWizardManager.
Class Name: albaWizard.
Definition: albaWizard.h:46