]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/CutModule/interface/CutModel2MainPanel.h
*** empty log message ***
[creaMaracasVisu.git] / lib / maracasVisuLib / src / CutModule / interface / CutModel2MainPanel.h
1 /*=========================================================================
2
3   Program:   wxMaracas
4   Module:    $RCSfile: CutModel2MainPanel.h,v $
5   Language:  C++
6   Date:      $Date: 2009/11/19 15:00:32 $
7   Version:   $Revision: 1.1 $
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 __CutModel2MainPanelPanelH__
19 #define __CutModel2MainPanelPanelH__
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 "CutModel2Manager.h"
31 #include "CutModel2Exception.h"
32 #include "CutModel2View.h"
33
34 #include "vtkImageData.h"
35 #include "vtkRenderWindowInteractor.h"
36
37
38 class  creaMaracasVisu_EXPORT  CutModel2MainPanel : public wxPanel
39 {
40
41 public:
42         
43     ~CutModel2MainPanel( );
44
45         static CutModel2MainPanel* getInstance(wxWindow* parent=NULL, std::string path ="");
46
47         //static CutModel2MainPanel* 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 onAddCutModel2();
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         
88 private:
89
90         CutModel2MainPanel( wxWindow* parent, std::string path);
91
92         static CutModel2MainPanel* instance;
93
94         CutModel2Manager* cutmanager;   
95
96         void checkInvariant() throw( CutModel2Exception);
97
98         void showErrorDialog(std::string str);
99
100         void SaveCutModel2Data(std::string filename);
101
102         void LoadCutModel2Data(std::string filename);
103
104         std::vector<CutModel2View*> viewpanels;
105
106         wxAuiManager* _wxauimanager;
107
108
109          int addNewViewPanel()throw( CutModel2Exception);
110
111          CutModel2View* getModelView(int id)throw( CutModel2Exception);
112
113          int _panelid;
114 };
115
116
117 class ToolBarEventHandlerCutModel2 : public wxEvtHandler{
118
119         public:
120                 ToolBarEventHandlerCutModel2();
121                 ~ToolBarEventHandlerCutModel2();
122
123                 void onAdd(wxCommandEvent& event);
124
125                 void onUndo(wxCommandEvent& event);
126
127                 void onRedo(wxCommandEvent& event);
128
129                 void onExecuteAll(wxCommandEvent& event);
130
131         private:
132
133                 DECLARE_EVENT_TABLE()
134         };
135
136 class ToolBarCutModel2 : public wxToolBar{
137
138         
139 public:
140         ToolBarCutModel2(wxWindow * parent);
141         ~ToolBarCutModel2(void);
142
143
144 private:
145
146         ToolBarEventHandlerCutModel2* _evthand;
147
148 };
149
150 #endif
151