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 "manualViewPoints.h"
37 #include "manualViewRoi.h"
40 //------------------------------------------------------------------------------------------------------------
42 //------------------------------------------------------------------------------------------------------------
43 BEGIN_DECLARE_EVENT_TYPES()
44 DECLARE_EVENT_TYPE( wxEVT_START_CREATE_MULT_ROI, -1 )
45 DECLARE_EVENT_TYPE( wxEVT_STOP_CREATE_MULT_ROI, -1 )
46 DECLARE_EVENT_TYPE( wxEVT_SELECTED_MULT_ROI, -1 )
47 DECLARE_EVENT_TYPE( wxEVT_START_CREATE_ROI, -1 )
48 DECLARE_EVENT_TYPE( wxEVT_STOP_CREATE_ROI, -1)
49 DECLARE_EVENT_TYPE( wxEVT_DELETE_ROI, -1 )
50 DECLARE_EVENT_TYPE( wxEVT_SELECTED_ROI, -1 )
51 DECLARE_EVENT_TYPE( wxEVT_UNSLECTED_ROI, -1 )
52 DECLARE_EVENT_TYPE( wxEVT_MANUAL_HIDED_ROI, -1 )
53 DECLARE_EVENT_TYPE( wxEVT_MANUAL_SHOWED_ROI, -1 )
54 DECLARE_EVENT_TYPE( wxEVT_EDITING_ROI, -1 )
55 DECLARE_EVENT_TYPE( wxEVT_MOVING_ROI, -1 )
56 DECLARE_EVENT_TYPE( wxEVT_MOVING_ROI_POINT, -1 )
57 DECLARE_EVENT_TYPE( wxEVT_SELECTED_ROI_POINT, -1 )
58 DECLARE_EVENT_TYPE( wxEVT_UNSELECTED_ROI_POINT, -1 )
59 DECLARE_EVENT_TYPE( wxEVT_CHANGED_DEEP, -1 )
60 END_DECLARE_EVENT_TYPES()
62 /** file wxVtkBaseView_SceneManager.h */
65 //------------------------------------------------------------------------------------------------------------
67 //------------------------------------------------------------------------------------------------------------
68 class wxVtkBaseView_SceneManager : public InteractorStyleMaracas {
72 //------------------------------------------------------------------------------------------------------------
73 // Constructors & Destructors
74 //------------------------------------------------------------------------------------------------------------
76 wxVtkBaseView_SceneManager( wxVtkBaseView * theWxBaseViewToManage, wxEvtHandler * theEventHandler, double * spc );
77 ~wxVtkBaseView_SceneManager();
79 //------------------------------------------------------------------------------------------------------------
80 // Methods for capturing events
81 //------------------------------------------------------------------------------------------------------------
84 //------------------------------------------------------------------------------------------------------------
85 // Methods for sending events
86 //------------------------------------------------------------------------------------------------------------
87 void sendEnvent( WXTYPE theEventType, std::string text );
89 //------------------------------------------------------------------------------------------------------------
90 // Attributes getters and setters
91 //------------------------------------------------------------------------------------------------------------
93 void setWxVtkViewBase( wxVtkBaseView * theBaseView );
94 void setWxEventHandler( wxEvtHandler * theEventHandler );
95 wxVtkBaseView * getWxVtkViewBase();
98 // Method which creates and associates view and controller to the contour model type pointed in parameter.
99 // The possible contour types are:
108 // NOTE: The model is created in the KernelManagerContour class, factoryManualContourModel method
109 // @param typeContour - int
110 // @param theKeyName - string
111 // @param manContourControl - manualBaseModel
112 // @param spc - double* 3-pos Array
113 void configureViewControlTo( std::string theKeyName, manualBaseModel * manContourControl, double * spc ,int typeContour);
115 void configureSelectionROI( double * spc );
116 ContourWrap_ViewControl * insertWrap( std::string theKeyName, manualContourBaseControler * manContourControl, manualViewBaseContour * manViewerContour );
117 void desconfigureViewControlOf( std::string theKeyName );
118 void removeWrap( std::string theKeyName );
119 ContourWrap_ViewControl * getContourWrap_ViewControlOf ( std::string theName );
120 ContourWrap_ViewControl * getContourWrap_ViewControlOf ( std::string theName, std::map<std::string, ContourWrap_ViewControl *> * theMap );
121 manualContourBaseControler * getControlerOf( std::string theName );
122 manualViewBaseContour * getViewerOf( std::string theName );
123 void set_creatingMULT_ROI( bool condition );
124 void set_editingROI( bool condition );
125 void set_toIncludeAtInteractionGroup( bool condition );
126 void set_waiting( bool condition );
127 bool get_creatingMULT_ROI( );
128 bool get_editingROI( );
129 bool get_toIncludeAtInteractionGroup( );
131 bool get_creatingROI();
132 void set_creatingROI( bool theCondition );
134 //------------------------------------------------------------------------------------------------------------
135 // Other functional methods
136 //------------------------------------------------------------------------------------------------------------
138 void createCopyContourOf( std::string anExistingKName, std::string cloneName, manualBaseModel * manualModel, bool append = false );
139 void removeFromScene( ContourWrap_ViewControl * contourWRP, bool visualization = true, bool control = true );
140 void removeFromScene( std::string theKeyName, bool visualization = true, bool control = true );
141 void removeSceneContours( );
142 void removeAllOutlines();
143 void addToScene( std::string theKeyName, bool append = true, bool visualization = true, bool control = true, bool ifActive = true, bool ifShowCtrlPoints = true );
144 void addToScene( std::string theKeyName, ContourWrap_ViewControl * contourWRP, bool append = true, bool visualization = true, bool control = true, bool ifActive = true, bool ifShowCtrlPoints = true );
145 void removeFromScene( std::vector< std::string> theKeyNameVector, bool visualization = true, bool control = true );
146 void addToScene( std::vector< std::string> theKeyNameVector, bool append = true, bool visualization = true, bool control = true, bool ifActive = true, bool ifShowCtrlPoints = true );
147 void setControlActiveStateOfALL( bool stateCondition );
148 void setControlActiveStateOf( std::string theKeyName, bool stateCondition );
149 void setControlActiveStateOf( ContourWrap_ViewControl * contourWRP, bool stateCondition );
150 void setVisibleStateOf( std::string theKeyName, bool stateCondition );
152 std::vector< std::string > getSelectedObjects();
153 void selectObjects( std::vector< std::string > theExistingObjectsToSelect );
154 void selectObjects( std::map<std::string, ContourWrap_ViewControl *> * theMap );
155 void setControlActiveStateOf( std::vector< std::string> &theKeyNameVector, bool controlCondition = false );
156 void setControlActiveStateOf( std::map<std::string, ContourWrap_ViewControl *> * theMap, bool controlCondition = false );
157 void drawSelectionROI();
158 void setSelection2DROIInternalOutlines( );
159 void writeCoords( std::string method );
162 void SaveThingName(FILE *ff, std::string nameThing);
163 void GetPointsOfActualContour( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ );
164 vtkImageData *GetImageData();
165 std::vector<std::string> GetlstContoursNameActualSlice();
167 //------------------------------------------------------------------------------------------------------------
169 //------------------------------------------------------------------------------------------------------------
171 virtual bool OnChar();
172 virtual bool OnMouseMove();
173 virtual bool OnLeftButtonDown();
174 virtual bool OnLeftButtonUp();
175 virtual bool OnMiddleButtonDown();
176 virtual bool OnMiddleButtonUp();
177 virtual bool OnRightButtonDown();
178 virtual bool OnRightButtonUp();
180 virtual bool OnLeftDClick();
181 virtual bool OnRightDClick();
182 virtual bool OnMiddleDClick();
183 virtual bool OnMouseWheel();
185 int GetImageDataSizeZ();
186 void GetImageDataRange( double *range );
187 void SetWidthContour(double width);
190 bool isEditableCControler(std::string theKeyName);
191 void deleteCViewerCControler(std::string theKeyName);
192 bool isCtrlPressed();
193 bool isShiftPressed();
194 char getLastKeyCode();
196 //------------------------------------------------------------------------------------------------------------
198 //------------------------------------------------------------------------------------------------------------
201 //------------------------------------------------------------------------------------------------------------
202 // Creational and initialization methods
203 //------------------------------------------------------------------------------------------------------------
206 //------------------------------------------------------------------------------------------------------------
208 //------------------------------------------------------------------------------------------------------------
210 std::map<std::string, ContourWrap_ViewControl *> * _contours_ViewControl;
211 std::map<std::string, ContourWrap_ViewControl *> * _sceneContours_ViewControl;
212 wxVtkBaseView *_wxVtk_BaseView;
213 wxEvtHandler *_eventHandler;
214 ContourWrap_ViewControl *_lastInteraction;
215 std::string _lastInteractionName;
216 std::map<std::string, ContourWrap_ViewControl *> * _workingGroup;
217 bool _creatingMULT_ROI;
219 bool _toIncludeAtInteractionGroup;
224 int _rigthClickCount;
228 long int onCharCallBackTimeEnd;
229 long int onCharNeeded;
230 bool _drawingSelectionROI;
231 manualRoiControler *_controlerSelectionROI;
232 manualViewRoi *_viewerSelectionROI;
233 manualBaseModel *_modelSelectionROI;
234 double _widthOfContour;
235 double _widthOfControlPoint;
240 #endif // __wxVtkBaseView_SceneManager_HEADER_FILE__