]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.h
Changements dans la class CutModuleMainPanel et CutModuleManager pour ajouter la...
[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: 2010/02/24 13:56:06 $
7 Version:   $Revision: 1.5 $
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
27 #include <iostream>
28 #include "marTypes.h"
29
30
31 #include "CutModelManager.h"
32 #include "CutModelException.h"
33 #include "CutModelView.h"
34
35 #include "vtkImageData.h"
36 #include "vtkRenderWindowInteractor.h"
37
38 //RaC 02-2010 Add tabs
39 #include <wx/aui/auibook.h>
40 #include <wx/panel.h>
41 #include <wx/checkbox.h>
42 #include <wx/button.h>
43 #include <wx/sizer.h>
44 #include <wx/stattext.h>
45 #include <wx/radiobox.h>
46
47
48
49 class  creaMaracasVisu_EXPORT  CutModelMainPanel : public wxPanel
50 {
51
52 public:
53
54         ~CutModelMainPanel( );
55
56         static CutModelMainPanel* getInstance(wxWindow* parent=NULL, std::string path ="");
57
58         //static CutModelMainPanel* getInstance();
59
60         void setImageData(vtkImageData* img);
61
62         void setInteractor(vtkRenderWindowInteractor* interactor);
63
64         void setRenderer(vtkRenderer* renderer);
65
66         void initialize(std::string path);
67
68         //RaC PolygonCutter changes
69         void onCheckChanged();
70         void onExecuteCutPolygon();
71         void UpdatePolygon(bool isChecked);
72         void UpdatePolygon();
73
74         void onAddCutModel();
75
76         void onUndo();
77
78         void onRedo();
79
80         void changeOpacity(int id,int opacity);
81
82         void ShowViewBox(int id,bool check);
83
84         void ChangeShape(int id,int selection);
85
86         void changeColor(int id,double r,double g,double b);
87
88         void updateActorDirection(int id);
89
90         void RemoveActor(int id);
91
92         void ExecuteCut(int id, double* range, bool isinside);
93
94         void ExecuteAll();
95
96         vtkImageData* GetResultImage();
97
98         void ShowCurrentPanel(int id);
99
100         void ShowPopUpMenu(int id);
101
102         void ShowStatistics(int id);
103
104         void SetType(int type);
105
106         int GetType();
107
108
109 private:
110
111         CutModelMainPanel( wxWindow* parent, std::string path);
112
113         static CutModelMainPanel* instance;
114
115         CutModelManager* cutmanager;    
116
117         void checkInvariant() throw( CutModelException);
118
119         void showErrorDialog(std::string str);
120
121         void SaveCutModelData(std::string filename);
122
123         void LoadCutModelData(std::string filename);
124
125         std::vector<CutModelView*> viewpanels;
126
127         wxAuiManager* _wxauimanager;
128
129         int addNewViewPanel()throw( CutModelException);
130
131         CutModelView* getModelView(int id)throw( CutModelException);
132
133         int _panelid;
134
135         int _type;
136
137         //RaC 02-2010 Add tabs
138         wxAuiNotebook* _notebook;
139
140         //RaC Adds Tab to cut a prism with the polygon as the base
141         void addPolygonCutterTab();
142
143         bool _isCheck;
144
145         bool _isFirstTime;
146
147         wxButton *btnExecutePolygonCut;
148         wxStaticText* lblMessagePolygon;
149         wxRadioBox* _radioinsideout;
150
151 };
152
153
154 class ToolBarEventHandlerCutModel : public wxEvtHandler{
155
156 public:
157         ToolBarEventHandlerCutModel();
158         ~ToolBarEventHandlerCutModel();
159
160         void onAdd(wxCommandEvent& event);
161
162         void onUndo(wxCommandEvent& event);
163
164         void onRedo(wxCommandEvent& event);
165
166         void onExecuteAll(wxCommandEvent& event);
167
168 private:
169
170         DECLARE_EVENT_TABLE()
171 };
172
173 class PolygonCutterEventHandlerCutModel : public wxEvtHandler{
174 public:
175
176         PolygonCutterEventHandlerCutModel(): wxEvtHandler(){};
177         ~PolygonCutterEventHandlerCutModel(){};
178
179         void onCheckChanged(wxCommandEvent& event);
180         void onExecuteCutPolygon(wxCommandEvent& event);
181
182 };
183
184
185 class ToolBarCutModel : public wxToolBar{
186
187
188 public:
189         ToolBarCutModel(wxWindow * parent);
190         ~ToolBarCutModel(void);
191
192
193 private:
194
195         ToolBarEventHandlerCutModel* _evthand;
196
197 };
198
199 #endif
200