1 #ifndef __wxVtkBaseView_SceneManager_h_INCLUDED_H__
2 #define __wxVtkBaseView_SceneManager_h_INCLUDED_H__
5 // -----------------------------------------------------------------------------------------------------------
6 // WX headers inclusion.
7 // For compilers that support precompilation, includes <wx/wx.h>.
8 // -----------------------------------------------------------------------------------------------------------
10 #include <wx/wxprec.h>
19 //------------------------------------------------------------------------------------------------------------
21 //------------------------------------------------------------------------------------------------------------
23 #include "ContourWrap_ViewControl.h"
24 #include "wxVtkBaseView.h"
27 #include "manualContourModel.h"
28 #include "manualRoiControler.h"
29 #include "manualContourBaseControler.h"
30 #include "manualCircleControler.h"
31 #include "manualLineControler.h"
32 #include "manualViewBaseContour.h"
33 #include "manualViewBullEye.h"
34 #include "manualViewCircle.h"
35 #include "manualViewLine.h"
36 #include "manualViewRoi.h"
39 //------------------------------------------------------------------------------------------------------------
41 //------------------------------------------------------------------------------------------------------------
42 BEGIN_DECLARE_EVENT_TYPES()
43 DECLARE_EVENT_TYPE( wxEVT_START_CREATE_MULT_ROI, -1 )
44 DECLARE_EVENT_TYPE( wxEVT_STOP_CREATE_MULT_ROI, -1 )
45 DECLARE_EVENT_TYPE( wxEVT_SELECTED_MULT_ROI, -1 )
46 DECLARE_EVENT_TYPE( wxEVT_START_CREATE_ROI, -1 )
47 DECLARE_EVENT_TYPE( wxEVT_STOP_CREATE_ROI, -1)
48 DECLARE_EVENT_TYPE( wxEVT_DELETE_ROI, -1 )
49 DECLARE_EVENT_TYPE( wxEVT_SELECTED_ROI, -1 )
50 DECLARE_EVENT_TYPE( wxEVT_UNSLECTED_ROI, -1 )
51 DECLARE_EVENT_TYPE( wxEVT_MANUAL_HIDED_ROI, -1 )
52 DECLARE_EVENT_TYPE( wxEVT_MANUAL_SHOWED_ROI, -1 )
53 DECLARE_EVENT_TYPE( wxEVT_EDITING_ROI, -1 )
54 DECLARE_EVENT_TYPE( wxEVT_MOVING_ROI, -1 )
55 DECLARE_EVENT_TYPE( wxEVT_MOVING_ROI_POINT, -1 )
56 DECLARE_EVENT_TYPE( wxEVT_SELECTED_ROI_POINT, -1 )
57 DECLARE_EVENT_TYPE( wxEVT_UNSELECTED_ROI_POINT, -1 )
58 DECLARE_EVENT_TYPE( wxEVT_CHANGED_DEEP, -1 )
59 END_DECLARE_EVENT_TYPES()
61 /** file wxVtkBaseView_SceneManager.h */
64 //------------------------------------------------------------------------------------------------------------
66 //------------------------------------------------------------------------------------------------------------
67 class wxVtkBaseView_SceneManager : public InteractorStyleMaracas {
71 //------------------------------------------------------------------------------------------------------------
72 // Constructors & Destructors
73 //------------------------------------------------------------------------------------------------------------
75 wxVtkBaseView_SceneManager( wxVtkBaseView * theWxBaseViewToManage, wxEvtHandler * theEventHandler, double * spc );
76 ~wxVtkBaseView_SceneManager();
78 //------------------------------------------------------------------------------------------------------------
79 // Methods for capturing events
80 //------------------------------------------------------------------------------------------------------------
83 //------------------------------------------------------------------------------------------------------------
84 // Methods for sending events
85 //------------------------------------------------------------------------------------------------------------
86 void sendEnvent( WXTYPE theEventType, std::string text );
88 //------------------------------------------------------------------------------------------------------------
89 // Attributes getters and setters
90 //------------------------------------------------------------------------------------------------------------
92 void setWxVtkViewBase( wxVtkBaseView * theBaseView );
93 void setWxEventHandler( wxEvtHandler * theEventHandler );
94 wxVtkBaseView * getWxVtkViewBase();
95 void configureViewControlTo( std::string theKeyName, manualContourModel * manContourControl, double * spc ,int typeContour);
96 void configureSelectionROI( double * spc );
97 ContourWrap_ViewControl * insertWrap( std::string theKeyName, manualContourBaseControler * manContourControl, manualViewBaseContour * manViewerContour );
98 void desconfigureViewControlOf( std::string theKeyName );
99 void removeWrap( std::string theKeyName );
100 ContourWrap_ViewControl * getContourWrap_ViewControlOf ( std::string theName );
101 ContourWrap_ViewControl * getContourWrap_ViewControlOf ( std::string theName, std::map<std::string, ContourWrap_ViewControl *> * theMap );
102 manualContourBaseControler * getControlerOf( std::string theName );
103 manualViewBaseContour * getViewerOf( std::string theName );
104 void set_creatingMULT_ROI( bool condition );
105 void set_editingROI( bool condition );
106 void set_toIncludeAtInteractionGroup( bool condition );
107 void set_waiting( bool condition );
108 bool get_creatingMULT_ROI( );
109 bool get_editingROI( );
110 bool get_toIncludeAtInteractionGroup( );
112 bool get_creatingROI();
113 void set_creatingROI( bool theCondition );
115 //------------------------------------------------------------------------------------------------------------
116 // Other functional methods
117 //------------------------------------------------------------------------------------------------------------
119 void createCopyContourOf( std::string anExistingKName, std::string cloneName, manualContourModel * manualModel, bool append = false );
120 void removeFromScene( ContourWrap_ViewControl * contourWRP, bool visualization = true, bool control = true );
121 void removeFromScene( std::string theKeyName, bool visualization = true, bool control = true );
122 void removeSceneContours( );
123 void removeAllOutlines();
124 void addToScene( std::string theKeyName, bool append = true, bool visualization = true, bool control = true, bool ifActive = true, bool ifShowCtrlPoints = true );
125 void addToScene( std::string theKeyName, ContourWrap_ViewControl * contourWRP, bool append = true, bool visualization = true, bool control = true, bool ifActive = true, bool ifShowCtrlPoints = true );
126 void removeFromScene( std::vector< std::string> theKeyNameVector, bool visualization = true, bool control = true );
127 void addToScene( std::vector< std::string> theKeyNameVector, bool append = true, bool visualization = true, bool control = true, bool ifActive = true, bool ifShowCtrlPoints = true );
128 void setControlActiveStateOfALL( bool stateCondition );
129 void setControlActiveStateOf( std::string theKeyName, bool stateCondition );
130 void setControlActiveStateOf( ContourWrap_ViewControl * contourWRP, bool stateCondition );
131 void setVisibleStateOf( std::string theKeyName, bool stateCondition );
133 std::vector< std::string > getSelectedObjects();
134 void selectObjects( std::vector< std::string > theExistingObjectsToSelect );
135 void selectObjects( std::map<std::string, ContourWrap_ViewControl *> * theMap );
136 void setControlActiveStateOf( std::vector< std::string> &theKeyNameVector, bool controlCondition = false );
137 void setControlActiveStateOf( std::map<std::string, ContourWrap_ViewControl *> * theMap, bool controlCondition = false );
138 void drawSelectionROI();
139 void setSelection2DROIInternalOutlines( );
140 void writeCoords( std::string method );
143 void SaveThingName(FILE *ff, std::string nameThing);
144 void GetPointsOfActualContour( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ );
145 vtkImageData *GetImageData();
146 std::vector<std::string> GetlstContoursNameActualSlice();
148 //------------------------------------------------------------------------------------------------------------
150 //------------------------------------------------------------------------------------------------------------
152 virtual bool OnChar();
153 virtual bool OnMouseMove();
154 virtual bool OnLeftButtonDown();
155 virtual bool OnLeftButtonUp();
156 virtual bool OnMiddleButtonDown();
157 virtual bool OnMiddleButtonUp();
158 virtual bool OnRightButtonDown();
159 virtual bool OnRightButtonUp();
161 virtual bool OnLeftDClick();
162 virtual bool OnRightDClick();
163 virtual bool OnMiddleDClick();
164 virtual bool OnMouseWheel();
166 int GetImageDataSizeZ();
167 void GetImageDataRange( double *range );
168 void SetWidthContour(double width);
171 bool isEditableCControler(std::string theKeyName);
172 void deleteCViewerCControler(std::string theKeyName);
173 bool isCtrlPressed();
174 bool isShiftPressed();
175 char getLastKeyCode();
177 //------------------------------------------------------------------------------------------------------------
179 //------------------------------------------------------------------------------------------------------------
182 //------------------------------------------------------------------------------------------------------------
183 // Creational and initialization methods
184 //------------------------------------------------------------------------------------------------------------
187 //------------------------------------------------------------------------------------------------------------
189 //------------------------------------------------------------------------------------------------------------
191 std::map<std::string, ContourWrap_ViewControl *> * _contours_ViewControl;
192 std::map<std::string, ContourWrap_ViewControl *> * _sceneContours_ViewControl;
193 wxVtkBaseView *_wxVtk_BaseView;
194 wxEvtHandler *_eventHandler;
195 ContourWrap_ViewControl *_lastInteraction;
196 std::string _lastInteractionName;
197 std::map<std::string, ContourWrap_ViewControl *> * _workingGroup;
198 bool _creatingMULT_ROI;
200 bool _toIncludeAtInteractionGroup;
205 int _rigthClickCount;
209 long int onCharCallBackTimeEnd;
210 long int onCharNeeded;
211 bool _drawingSelectionROI;
212 manualRoiControler *_controlerSelectionROI;
213 manualViewRoi *_viewerSelectionROI;
214 manualContourModel *_modelSelectionROI;
215 double _widthOfContour;
220 #endif // __wxVtkBaseView_SceneManager_HEADER_FILE__