CutModelMainPanel.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __CutModelMainPanelPanelH__
00019 #define __CutModelMainPanelPanelH__
00020
00021 #include <vector>
00022 #include <wx/wx.h>
00023 #include <wx/treebook.h>
00024 #include "wx/aui/aui.h"
00025 #include <wx/toolbar.h>
00026
00027 #include <iostream>
00028 #include "marTypes.h"
00029
00030
00031 #include "CutModelManager.h"
00032 #include "CutModelException.h"
00033 #include "CutModelView.h"
00034
00035 #include "vtkImageData.h"
00036 #include "vtkRenderWindowInteractor.h"
00037
00038
00039 #include <wx/aui/auibook.h>
00040 #include <wx/panel.h>
00041 #include <wx/checkbox.h>
00042 #include <wx/button.h>
00043 #include <wx/sizer.h>
00044 #include <wx/stattext.h>
00045 #include <wx/radiobox.h>
00046
00047
00048
00049 class creaMaracasVisu_EXPORT CutModelMainPanel : public wxPanel
00050 {
00051
00052 public:
00053
00054 ~CutModelMainPanel( );
00055
00056 static CutModelMainPanel* getInstance(wxWindow* parent=NULL, std::string path ="");
00057
00058
00059
00060 void setImageData(vtkImageData* img);
00061
00062 void setInteractor(vtkRenderWindowInteractor* interactor);
00063
00064 void setRenderer(vtkRenderer* renderer);
00065
00066 void initialize(std::string path);
00067
00068
00069 void onCheckChanged();
00070 void onExecuteCutPolygon();
00071 void UpdatePolygon(bool isChecked);
00072 void UpdatePolygon();
00073
00074 void onAddCutModel();
00075
00076 void onUndo();
00077
00078 void onRedo();
00079
00080 void changeOpacity(int id,int opacity);
00081
00082 void ShowViewBox(int id,bool check);
00083
00084 void ChangeShape(int id,int selection);
00085
00086 void changeColor(int id,double r,double g,double b);
00087
00088 void updateActorDirection(int id);
00089
00090 void RemoveActor(int id);
00091
00092 void ExecuteCut(int id, double* range, bool isinside);
00093
00094 void ExecuteAll();
00095
00096 vtkImageData* GetResultImage();
00097
00098 void ShowCurrentPanel(int id);
00099
00100 void ShowPopUpMenu(int id);
00101
00102 void ShowStatistics(int id);
00103
00104 void SetType(int type);
00105
00106 int GetType();
00107
00108
00109 private:
00110
00111 CutModelMainPanel( wxWindow* parent, std::string path);
00112
00113 static CutModelMainPanel* instance;
00114
00115 CutModelManager* cutmanager;
00116
00117 void checkInvariant() throw( CutModelException);
00118
00119 void showErrorDialog(std::string str);
00120
00121 void SaveCutModelData(std::string filename);
00122
00123 void LoadCutModelData(std::string filename);
00124
00125 std::vector<CutModelView*> viewpanels;
00126
00127 wxAuiManager* _wxauimanager;
00128
00129 int addNewViewPanel()throw( CutModelException);
00130
00131 CutModelView* getModelView(int id)throw( CutModelException);
00132
00133 int _panelid;
00134
00135 int _type;
00136
00137
00138 wxAuiNotebook* _notebook;
00139
00140
00141 void addPolygonCutterTab();
00142
00143 bool _isCheck;
00144
00145 bool _isFirstTime;
00146
00147 wxButton *btnExecutePolygonCut;
00148 wxStaticText* lblMessagePolygon;
00149 wxRadioBox* _radioinsideout;
00150
00151 };
00152
00153
00154 class ToolBarEventHandlerCutModel : public wxEvtHandler{
00155
00156 public:
00157 ToolBarEventHandlerCutModel();
00158 ~ToolBarEventHandlerCutModel();
00159
00160 void onAdd(wxCommandEvent& event);
00161
00162 void onUndo(wxCommandEvent& event);
00163
00164 void onRedo(wxCommandEvent& event);
00165
00166 void onExecuteAll(wxCommandEvent& event);
00167
00168 private:
00169
00170 DECLARE_EVENT_TABLE()
00171 };
00172
00173 class PolygonCutterEventHandlerCutModel : public wxEvtHandler{
00174 public:
00175
00176 PolygonCutterEventHandlerCutModel(): wxEvtHandler(){};
00177 ~PolygonCutterEventHandlerCutModel(){};
00178
00179 void onCheckChanged(wxCommandEvent& event);
00180 void onExecuteCutPolygon(wxCommandEvent& event);
00181
00182 };
00183
00184
00185 class ToolBarCutModel : public wxToolBar{
00186
00187
00188 public:
00189 ToolBarCutModel(wxWindow * parent);
00190 ~ToolBarCutModel(void);
00191
00192
00193 private:
00194
00195 ToolBarEventHandlerCutModel* _evthand;
00196
00197 };
00198
00199 #endif
00200