]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.h
*** empty log message ***
[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/12/08 13:42:48 $
7   Version:   $Revision: 1.4 $
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         
43     ~CutModelMainPanel( );
44
45         static CutModelMainPanel* getInstance(wxWindow* parent=NULL, std::string path ="");
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(std::string path);
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
87         void SetType(int type);
88
89         int GetType();
90
91         
92 private:
93
94         CutModelMainPanel( wxWindow* parent, std::string path);
95
96         static CutModelMainPanel* instance;
97
98         CutModelManager* cutmanager;    
99
100         void checkInvariant() throw( CutModelException);
101
102         void showErrorDialog(std::string str);
103
104         void SaveCutModelData(std::string filename);
105
106         void LoadCutModelData(std::string filename);
107
108         std::vector<CutModelView*> viewpanels;
109
110         wxAuiManager* _wxauimanager;
111
112
113          int addNewViewPanel()throw( CutModelException);
114
115          CutModelView* getModelView(int id)throw( CutModelException);
116
117          int _panelid;
118
119          int _type;
120 };
121
122
123 class ToolBarEventHandlerCutModel : public wxEvtHandler{
124
125         public:
126                 ToolBarEventHandlerCutModel();
127                 ~ToolBarEventHandlerCutModel();
128
129                 void onAdd(wxCommandEvent& event);
130
131                 void onUndo(wxCommandEvent& event);
132
133                 void onRedo(wxCommandEvent& event);
134
135                 void onExecuteAll(wxCommandEvent& event);
136
137         private:
138
139                 DECLARE_EVENT_TABLE()
140         };
141
142 class ToolBarCutModel : public wxToolBar{
143
144         
145 public:
146         ToolBarCutModel(wxWindow * parent);
147         ~ToolBarCutModel(void);
148
149
150 private:
151
152         ToolBarEventHandlerCutModel* _evthand;
153
154 };
155
156 #endif
157