]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.h
5caaa706488b4e819b7cef20853df1c30b9bc6c8
[creaMaracasVisu.git] / lib / maracasVisuLib / src / CutModule / interface / CutModelMainPanel.h
1 /*=========================================================================
2
3   Program:   wxMaracas
4   Module:    $RCSfile: CutModelMainPanel.h,v $
5   Language:  C++
6   Date:      $Date: 2009/09/01 14:01:35 $
7   Version:   $Revision: 1.2 $
8
9   Copyright: (c) 2002, 2003
10   License:
11
12      This software is distributed WITHOUT ANY WARRANTY; without even
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14      PURPOSE.  See the above copyright notice for more information.
15
16 =========================================================================*/
17
18 #ifndef __CutModelMainPanelPanelH__
19 #define __CutModelMainPanelPanelH__
20
21 #include <vector>
22 #include <wx/wx.h>
23 #include <wx/treebook.h>
24 #include "wx/aui/aui.h"
25 #include <wx/toolbar.h>
26 #include <iostream>
27 #include "marTypes.h"
28
29
30 #include "CutModelManager.h"
31 #include "CutModelException.h"
32 #include "CutModelView.h"
33
34 #include "vtkImageData.h"
35 #include "vtkRenderWindowInteractor.h"
36
37
38 class  creaMaracasVisu_EXPORT  CutModelMainPanel : public wxPanel
39 {
40
41 public:
42         CutModelMainPanel( wxWindow* parent);
43     ~CutModelMainPanel( );
44
45         static CutModelMainPanel* getInstance(wxWindow* parent);
46
47         static CutModelMainPanel* getInstance();
48
49         void setImageData(vtkImageData* img);
50
51         void setInteractor(vtkRenderWindowInteractor* interactor);
52
53         void setRenderer(vtkRenderer* renderer);
54
55         void initialize();
56
57         void onAddCutModel();
58
59         void onUndo();
60
61         void onRedo();
62
63         void changeOpacity(int id,int opacity);
64
65         void ShowViewBox(int id,bool check);
66
67         void ChangeShape(int id,int selection);
68         
69         void changeColor(int id,double r,double g,double b);
70
71         void updateActorDirection(int id);
72
73         void RemoveActor(int id);
74
75         void ExecuteCut(int id, double* range, bool isinside);
76
77         void ExecuteAll();
78
79         vtkImageData* GetResultImage();
80
81         void ShowCurrentPanel(int id);
82
83         void ShowPopUpMenu(int id);
84
85         void ShowStatistics(int id);
86 private:
87         static CutModelMainPanel* instance;
88
89         CutModelManager* cutmanager;    
90
91         void checkInvariant() throw( CutModelException);
92
93         void showErrorDialog(std::string str);
94
95         std::vector<CutModelView*> viewpanels;
96
97         wxAuiManager* _wxauimanager;
98
99
100          int addNewViewPanel()throw( CutModelException);
101
102          CutModelView* getModelView(int id)throw( CutModelException);
103
104          int _panelid;
105 };
106
107
108 class ToolBarEventHandlerCutModel : public wxEvtHandler{
109
110         public:
111                 ToolBarEventHandlerCutModel();
112                 ~ToolBarEventHandlerCutModel();
113
114                 void onAdd(wxCommandEvent& event);
115
116                 void onUndo(wxCommandEvent& event);
117
118                 void onRedo(wxCommandEvent& event);
119
120                 void onExecuteAll(wxCommandEvent& event);
121
122         private:
123
124                 DECLARE_EVENT_TABLE()
125         };
126
127 class ToolBarCutModel : public wxToolBar{
128
129         
130 public:
131         ToolBarCutModel(wxWindow * parent);
132         ~ToolBarCutModel(void);
133
134
135 private:
136
137         ToolBarEventHandlerCutModel* _evthand;
138
139 };
140
141 #endif
142