1 /*=========================================================================
4 Module: $RCSfile: CutModelMainPanel.h,v $
6 Date: $Date: 2010/02/24 13:56:06 $
7 Version: $Revision: 1.5 $
9 Copyright: (c) 2002, 2003
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.
16 =========================================================================*/
18 #ifndef __CutModelMainPanelPanelH__
19 #define __CutModelMainPanelPanelH__
23 #include <wx/treebook.h>
24 #include "wx/aui/aui.h"
25 #include <wx/toolbar.h>
31 #include "CutModelManager.h"
32 #include "CutModelException.h"
33 #include "CutModelView.h"
35 #include "vtkImageData.h"
36 #include "vtkRenderWindowInteractor.h"
38 //RaC 02-2010 Add tabs
39 #include <wx/aui/auibook.h>
41 #include <wx/checkbox.h>
42 #include <wx/button.h>
44 #include <wx/stattext.h>
45 #include <wx/radiobox.h>
49 class creaMaracasVisu_EXPORT CutModelMainPanel : public wxPanel
54 ~CutModelMainPanel( );
56 static CutModelMainPanel* getInstance(wxWindow* parent=NULL, std::string path ="");
58 //static CutModelMainPanel* getInstance();
60 void setImageData(vtkImageData* img);
62 void setInteractor(vtkRenderWindowInteractor* interactor);
64 void setRenderer(vtkRenderer* renderer);
66 void initialize(std::string path);
68 //RaC PolygonCutter changes
69 void onCheckChanged();
70 void onExecuteCutPolygon();
71 void UpdatePolygon(bool isChecked);
80 void changeOpacity(int id,int opacity);
82 void ShowViewBox(int id,bool check);
84 void ChangeShape(int id,int selection);
86 void changeColor(int id,double r,double g,double b);
88 void updateActorDirection(int id);
90 void RemoveActor(int id);
92 void ExecuteCut(int id, double* range, bool isinside);
96 vtkImageData* GetResultImage();
98 void ShowCurrentPanel(int id);
100 void ShowPopUpMenu(int id);
102 void ShowStatistics(int id);
104 void SetType(int type);
111 CutModelMainPanel( wxWindow* parent, std::string path);
113 static CutModelMainPanel* instance;
115 CutModelManager* cutmanager;
117 void checkInvariant() throw( CutModelException);
119 void showErrorDialog(std::string str);
121 void SaveCutModelData(std::string filename);
123 void LoadCutModelData(std::string filename);
125 std::vector<CutModelView*> viewpanels;
127 wxAuiManager* _wxauimanager;
129 int addNewViewPanel()throw( CutModelException);
131 CutModelView* getModelView(int id)throw( CutModelException);
137 //RaC 02-2010 Add tabs
138 wxAuiNotebook* _notebook;
140 //RaC Adds Tab to cut a prism with the polygon as the base
141 void addPolygonCutterTab();
147 wxButton *btnExecutePolygonCut;
148 wxStaticText* lblMessagePolygon;
149 wxRadioBox* _radioinsideout;
154 class ToolBarEventHandlerCutModel : public wxEvtHandler{
157 ToolBarEventHandlerCutModel();
158 ~ToolBarEventHandlerCutModel();
160 void onAdd(wxCommandEvent& event);
162 void onUndo(wxCommandEvent& event);
164 void onRedo(wxCommandEvent& event);
166 void onExecuteAll(wxCommandEvent& event);
170 DECLARE_EVENT_TABLE()
173 class PolygonCutterEventHandlerCutModel : public wxEvtHandler{
176 PolygonCutterEventHandlerCutModel(): wxEvtHandler(){};
177 ~PolygonCutterEventHandlerCutModel(){};
179 void onCheckChanged(wxCommandEvent& event);
180 void onExecuteCutPolygon(wxCommandEvent& event);
185 class ToolBarCutModel : public wxToolBar{
189 ToolBarCutModel(wxWindow * parent);
190 ~ToolBarCutModel(void);
195 ToolBarEventHandlerCutModel* _evthand;