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 <manualContour.h>
30 //------------------------------------------------------------------------------------------------------------
32 //------------------------------------------------------------------------------------------------------------
33 BEGIN_DECLARE_EVENT_TYPES()
34 DECLARE_EVENT_TYPE( wxEVT_START_CREATE_MULT_ROI, -1 )
35 DECLARE_EVENT_TYPE( wxEVT_STOP_CREATE_MULT_ROI, -1 )
36 DECLARE_EVENT_TYPE( wxEVT_SELECTED_MULT_ROI, -1 )
37 DECLARE_EVENT_TYPE( wxEVT_START_CREATE_ROI, -1 )
38 DECLARE_EVENT_TYPE( wxEVT_STOP_CREATE_ROI, -1)
39 DECLARE_EVENT_TYPE( wxEVT_DELETE_ROI, -1 )
40 DECLARE_EVENT_TYPE( wxEVT_SELECTED_ROI, -1 )
41 DECLARE_EVENT_TYPE( wxEVT_UNSLECTED_ROI, -1 )
42 DECLARE_EVENT_TYPE( wxEVT_MANUAL_HIDED_ROI, -1 )
43 DECLARE_EVENT_TYPE( wxEVT_MANUAL_SHOWED_ROI, -1 )
44 DECLARE_EVENT_TYPE( wxEVT_EDITING_ROI, -1 )
45 DECLARE_EVENT_TYPE( wxEVT_MOVING_ROI, -1 )
46 DECLARE_EVENT_TYPE( wxEVT_MOVING_ROI_POINT, -1 )
47 DECLARE_EVENT_TYPE( wxEVT_SELECTED_ROI_POINT, -1 )
48 DECLARE_EVENT_TYPE( wxEVT_UNSELECTED_ROI_POINT, -1 )
49 DECLARE_EVENT_TYPE( wxEVT_CHANGED_DEEP, -1 )
50 END_DECLARE_EVENT_TYPES()
52 /** file wxVtkBaseView_SceneManager.h */
55 //------------------------------------------------------------------------------------------------------------
57 //------------------------------------------------------------------------------------------------------------
58 class wxVtkBaseView_SceneManager : public InteractorStyleMaracas {
62 //------------------------------------------------------------------------------------------------------------
63 // Constructors & Destructors
64 //------------------------------------------------------------------------------------------------------------
66 wxVtkBaseView_SceneManager( wxVtkBaseView * theWxBaseViewToManage, wxEvtHandler * theEventHandler, double * spc );
67 ~wxVtkBaseView_SceneManager();
69 //------------------------------------------------------------------------------------------------------------
70 // Methods for capturing events
71 //------------------------------------------------------------------------------------------------------------
74 //------------------------------------------------------------------------------------------------------------
75 // Methods for sending events
76 //------------------------------------------------------------------------------------------------------------
77 void sendEnvent( WXTYPE theEventType, std::string text );
79 //------------------------------------------------------------------------------------------------------------
80 // Attributes getters and setters
81 //------------------------------------------------------------------------------------------------------------
83 void setWxVtkViewBase( wxVtkBaseView * theBaseView );
84 void setWxEventHandler( wxEvtHandler * theEventHandler );
85 wxVtkBaseView * getWxVtkViewBase();
86 void configureViewControlTo( std::string theKeyName, manualContourModel * manContourControl, double * spc ,int typeContour);
87 void configureSelectionROI( double * spc );
88 ContourWrap_ViewControl * insertWrap( std::string theKeyName, manualContourBaseControler * manContourControl, manualViewBaseContour * manViewerContour );
89 void desconfigureViewControlOf( std::string theKeyName );
90 void removeWrap( std::string theKeyName );
91 ContourWrap_ViewControl * getContourWrap_ViewControlOf ( std::string theName );
92 ContourWrap_ViewControl * getContourWrap_ViewControlOf ( std::string theName, std::map<std::string, ContourWrap_ViewControl *> * theMap );
93 manualContourBaseControler * getControlerOf( std::string theName );
94 manualViewBaseContour * getViewerOf( std::string theName );
95 void set_creatingMULT_ROI( bool condition );
96 void set_editingROI( bool condition );
97 void set_toIncludeAtInteractionGroup( bool condition );
98 void set_waiting( bool condition );
99 bool get_creatingMULT_ROI( );
100 bool get_editingROI( );
101 bool get_toIncludeAtInteractionGroup( );
103 bool get_creatingROI();
104 void set_creatingROI( bool theCondition );
106 //------------------------------------------------------------------------------------------------------------
107 // Other functional methods
108 //------------------------------------------------------------------------------------------------------------
110 void createCopyContourOf( std::string anExistingKName, std::string cloneName, manualContourModel * manualModel, bool append = false );
111 void removeFromScene( ContourWrap_ViewControl * contourWRP, bool visualization = true, bool control = true );
112 void removeFromScene( std::string theKeyName, bool visualization = true, bool control = true );
113 void removeSceneContours( );
114 void removeAllOutlines();
115 void addToScene( std::string theKeyName, bool append = true, bool visualization = true, bool control = true, bool ifActive = true, bool ifShowCtrlPoints = true );
116 void addToScene( std::string theKeyName, ContourWrap_ViewControl * contourWRP, bool append = true, bool visualization = true, bool control = true, bool ifActive = true, bool ifShowCtrlPoints = true );
117 void removeFromScene( std::vector< std::string> theKeyNameVector, bool visualization = true, bool control = true );
118 void addToScene( std::vector< std::string> theKeyNameVector, bool append = true, bool visualization = true, bool control = true, bool ifActive = true, bool ifShowCtrlPoints = true );
119 void setControlActiveStateOfALL( bool stateCondition );
120 void setControlActiveStateOf( std::string theKeyName, bool stateCondition );
121 void setControlActiveStateOf( ContourWrap_ViewControl * contourWRP, bool stateCondition );
122 void setVisibleStateOf( std::string theKeyName, bool stateCondition );
124 std::vector< std::string > getSelectedObjects();
125 void selectObjects( std::vector< std::string > theExistingObjectsToSelect );
126 void selectObjects( std::map<std::string, ContourWrap_ViewControl *> * theMap );
127 void setControlActiveStateOf( std::vector< std::string> &theKeyNameVector, bool controlCondition = false );
128 void setControlActiveStateOf( std::map<std::string, ContourWrap_ViewControl *> * theMap, bool controlCondition = false );
129 void drawSelectionROI();
130 void setSelection2DROIInternalOutlines( );
131 void writeCoords( std::string method );
134 void SaveThingName(FILE *ff, std::string nameThing);
135 void GetPointsOfActualContour( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ );
136 vtkImageData *GetImageData();
137 std::vector<std::string> GetlstContoursNameActualSlice();
139 //------------------------------------------------------------------------------------------------------------
141 //------------------------------------------------------------------------------------------------------------
143 virtual bool OnChar();
144 virtual bool OnMouseMove();
145 virtual bool OnLeftButtonDown();
146 virtual bool OnLeftButtonUp();
147 virtual bool OnMiddleButtonDown();
148 virtual bool OnMiddleButtonUp();
149 virtual bool OnRightButtonDown();
150 virtual bool OnRightButtonUp();
152 virtual bool OnLeftDClick();
153 virtual bool OnRightDClick();
154 virtual bool OnMiddleDClick();
155 virtual bool OnMouseWheel();
157 int GetImageDataSizeZ();
158 void GetImageDataRange( double *range );
159 void SetWidthContour(double width);
163 //------------------------------------------------------------------------------------------------------------
165 //------------------------------------------------------------------------------------------------------------
168 //------------------------------------------------------------------------------------------------------------
169 // Creational and initialization methods
170 //------------------------------------------------------------------------------------------------------------
173 //------------------------------------------------------------------------------------------------------------
175 //------------------------------------------------------------------------------------------------------------
177 std::map<std::string, ContourWrap_ViewControl *> * _contours_ViewControl;
178 std::map<std::string, ContourWrap_ViewControl *> * _sceneContours_ViewControl;
179 wxVtkBaseView *_wxVtk_BaseView;
180 wxEvtHandler *_eventHandler;
181 ContourWrap_ViewControl *_lastInteraction;
182 std::string _lastInteractionName;
183 std::map<std::string, ContourWrap_ViewControl *> * _workingGroup;
184 bool _creatingMULT_ROI;
186 bool _toIncludeAtInteractionGroup;
191 int _rigthClickCount;
195 long int onCharCallBackTimeEnd;
196 long int onCharNeeded;
197 bool _drawingSelectionROI;
198 manualRoiControler *_controlerSelectionROI;
199 manualViewRoi *_viewerSelectionROI;
200 manualContourModel *_modelSelectionROI;
201 double _widthOfContour;
204 #endif // __wxVtkBaseView_SceneManager_HEADER_FILE__