]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.h
Support #1768 CREATIS Licence insertion
[creaMaracasVisu.git] / lib / maracasVisuLib / src / CutModule / interface / CutModelMainPanel.h
1 /*# ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 #                        pour la Sant�)
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
8 #
9 #  This software is governed by the CeCILL-B license under French law and
10 #  abiding by the rules of distribution of free software. You can  use,
11 #  modify and/ or redistribute the software under the terms of the CeCILL-B
12 #  license as circulated by CEA, CNRS and INRIA at the following URL
13 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 #  or in the file LICENSE.txt.
15 #
16 #  As a counterpart to the access to the source code and  rights to copy,
17 #  modify and redistribute granted by the license, users are provided only
18 #  with a limited warranty  and the software's author,  the holder of the
19 #  economic rights,  and the successive licensors  have only  limited
20 #  liability.
21 #
22 #  The fact that you are presently reading this means that you have had
23 #  knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
25
26 /*=========================================================================
27
28 Program:   wxMaracas
29 Module:    $RCSfile: CutModelMainPanel.h,v $
30 Language:  C++
31 Date:      $Date: 2012/11/15 14:16:20 $
32 Version:   $Revision: 1.6 $
33
34 Copyright: (c) 2002, 2003
35 License:
36
37 This software is distributed WITHOUT ANY WARRANTY; without even
38 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
39 PURPOSE.  See the above copyright notice for more information.
40
41 =========================================================================*/
42
43 #ifndef __CutModelMainPanelPanelH__
44 #define __CutModelMainPanelPanelH__
45
46 #include <vector>
47 #include <wx/wx.h>
48 #include <wx/treebook.h>
49 #include "wx/aui/aui.h"
50 #include <wx/toolbar.h>
51
52 #include <iostream>
53 #include "marTypes.h"
54
55
56 #include "CutModelManager.h"
57 #include "CutModelException.h"
58 #include "CutModelView.h"
59
60 #include "vtkImageData.h"
61 #include "vtkRenderWindowInteractor.h"
62
63 //RaC 02-2010 Add tabs
64 #include <wx/aui/auibook.h>
65 #include <wx/panel.h>
66 #include <wx/checkbox.h>
67 #include <wx/button.h>
68 #include <wx/sizer.h>
69 #include <wx/stattext.h>
70 #include <wx/radiobox.h>
71
72
73
74 class  creaMaracasVisu_EXPORT  CutModelMainPanel : public wxPanel
75 {
76
77 public:
78
79         ~CutModelMainPanel( );
80
81         static CutModelMainPanel* getInstance(wxWindow* parent=NULL, std::string path ="");
82
83         //static CutModelMainPanel* getInstance();
84
85         void setImageData(vtkImageData* img);
86
87         void setInteractor(vtkRenderWindowInteractor* interactor);
88
89         void setRenderer(vtkRenderer* renderer);
90
91         void initialize(std::string path);
92
93         //RaC PolygonCutter changes
94         void onCheckChanged();
95         void onExecuteCutPolygon();
96         void UpdatePolygon(bool isChecked);
97         void UpdatePolygon();
98
99         void onAddCutModel();
100
101         void onUndo();
102
103         void onRedo();
104
105         void changeOpacity(int id,int opacity);
106
107         void ShowViewBox(int id,bool check);
108
109         void ChangeShape(int id,int selection);
110
111         void changeColor(int id,double r,double g,double b);
112
113         void updateActorDirection(int id);
114
115         void RemoveActor(int id);
116
117         void ExecuteCut(int id, double* range, bool isinside);
118
119         void ExecuteAll();
120
121         vtkImageData* GetResultImage();
122
123         void ShowCurrentPanel(int id);
124
125         void ShowPopUpMenu(int id);
126
127         void ShowStatistics(int id);
128
129         void SetType(int type);
130
131         int GetType();
132
133
134 private:
135
136         CutModelMainPanel( wxWindow* parent, std::string path);
137
138         static CutModelMainPanel* instance;
139
140         CutModelManager* cutmanager;    
141
142         void checkInvariant() throw( CutModelException);
143
144         void showErrorDialog(std::string str);
145
146         void SaveCutModelData(std::string filename);
147
148         void LoadCutModelData(std::string filename);
149
150         std::vector<CutModelView*> viewpanels;
151
152         wxAuiManager* _wxauimanager;
153
154         int addNewViewPanel()throw( CutModelException);
155
156         CutModelView* getModelView(int id)throw( CutModelException);
157
158         int _panelid;
159
160         int _type;
161
162         //RaC 02-2010 Add tabs
163         wxAuiNotebook* _notebook;
164
165         //RaC Adds Tab to cut a prism with the polygon as the base
166         void addPolygonCutterTab();
167
168         bool _isCheck;
169
170         bool _isFirstTime;
171
172         wxButton *btnExecutePolygonCut;
173         wxStaticText* lblMessagePolygon;
174         wxRadioBox* _radioinsideout;
175
176 };
177
178
179 class ToolBarEventHandlerCutModel : public wxEvtHandler{
180
181 public:
182         ToolBarEventHandlerCutModel();
183         ~ToolBarEventHandlerCutModel();
184
185         void onAdd(wxCommandEvent& event);
186
187         void onUndo(wxCommandEvent& event);
188
189         void onRedo(wxCommandEvent& event);
190
191         void onExecuteAll(wxCommandEvent& event);
192
193 private:
194
195         DECLARE_EVENT_TABLE()
196 };
197
198 class PolygonCutterEventHandlerCutModel : public wxEvtHandler{
199 public:
200
201         PolygonCutterEventHandlerCutModel(): wxEvtHandler(){};
202         ~PolygonCutterEventHandlerCutModel(){};
203
204         void onCheckChanged(wxCommandEvent& event);
205         void onExecuteCutPolygon(wxCommandEvent& event);
206
207 };
208
209
210 class ToolBarCutModel : public wxToolBar{
211
212
213 public:
214         ToolBarCutModel(wxWindow * parent);
215         ~ToolBarCutModel(void);
216
217
218 private:
219
220         ToolBarEventHandlerCutModel* _evthand;
221
222 };
223
224 #endif
225