]> Creatis software - creaContours.git/blob - lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.h
d4f5bc26ddb0c5aa30d78e70484363fd5ce4df65
[creaContours.git] / lib / Interface_ManagerContour_NDimensions / wxVtkBaseView_SceneManager.h
1 #ifndef __wxVtkBaseView_SceneManager_h_INCLUDED_H__
2 #define __wxVtkBaseView_SceneManager_h_INCLUDED_H__
3
4
5 // -----------------------------------------------------------------------------------------------------------
6 // WX headers inclusion.
7 // For compilers that support precompilation, includes <wx/wx.h>.
8 // -----------------------------------------------------------------------------------------------------------
9
10 #include <wx/wxprec.h>
11 #ifdef __BORLANDC__
12 #pragma hdrstop
13 #endif
14 #ifndef WX_PRECOMP
15 #include <wx/wx.h>
16 #endif
17
18
19 //------------------------------------------------------------------------------------------------------------
20 // Includes
21 //------------------------------------------------------------------------------------------------------------
22
23 #include "ContourWrap_ViewControl.h"
24 #include "wxVtkBaseView.h"
25 #include <iostream>
26 #include <map>
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"
37 #include <wx/event.h>
38
39 //------------------------------------------------------------------------------------------------------------
40 // Events declaration
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()
60
61 /** file wxVtkBaseView_SceneManager.h */
62
63
64 //------------------------------------------------------------------------------------------------------------
65 // Class definition
66 //------------------------------------------------------------------------------------------------------------
67 class wxVtkBaseView_SceneManager : public InteractorStyleMaracas {
68
69         public:
70
71         //------------------------------------------------------------------------------------------------------------
72         // Constructors & Destructors
73         //------------------------------------------------------------------------------------------------------------
74
75         wxVtkBaseView_SceneManager( wxVtkBaseView * theWxBaseViewToManage, wxEvtHandler * theEventHandler, double * spc );
76         ~wxVtkBaseView_SceneManager();
77
78         //------------------------------------------------------------------------------------------------------------
79         // Methods for capturing events
80         //------------------------------------------------------------------------------------------------------------
81         
82                 
83         //------------------------------------------------------------------------------------------------------------
84         //  Methods for sending events
85         //------------------------------------------------------------------------------------------------------------
86         void sendEnvent( WXTYPE theEventType, std::string text );
87
88         //------------------------------------------------------------------------------------------------------------
89         //  Attributes getters and setters
90         //------------------------------------------------------------------------------------------------------------
91         
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(  );
111         bool get_waiting(  );
112         bool get_creatingROI();
113         void set_creatingROI( bool theCondition );
114
115         //------------------------------------------------------------------------------------------------------------
116         //  Other functional methods
117         //------------------------------------------------------------------------------------------------------------
118
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 );
132
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 );
141
142    // EED
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();
147
148         //------------------------------------------------------------------------------------------------------------
149         // Inherited Methods
150         //------------------------------------------------------------------------------------------------------------
151
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();
160
161         virtual bool  OnLeftDClick();
162         virtual bool  OnRightDClick();   
163         virtual bool  OnMiddleDClick();  
164         virtual bool  OnMouseWheel(); 
165
166         int                       GetImageDataSizeZ();
167         void              GetImageDataRange( double *range );
168         void                    SetWidthContour(double width);
169
170 //JCP 21 - 09 - 08
171         bool isEditableCControler(std::string theKeyName);
172         void deleteCViewerCControler(std::string theKeyName);
173         bool isCtrlPressed();
174         bool isShiftPressed();
175         char getLastKeyCode();
176 private:
177         //------------------------------------------------------------------------------------------------------------
178         //  Private methods
179         //------------------------------------------------------------------------------------------------------------
180
181         
182         //------------------------------------------------------------------------------------------------------------
183         // Creational and initialization methods
184         //------------------------------------------------------------------------------------------------------------
185
186                 
187         //------------------------------------------------------------------------------------------------------------
188         // Attributtes
189         //------------------------------------------------------------------------------------------------------------
190         
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;
199         bool                                    _editingROI;
200         bool                                    _toIncludeAtInteractionGroup;
201         bool                                    _waiting;
202         bool                                    _creatingROI;
203         int                                             _enventID;
204         int                                             _leftClickCount;
205         int                                             _rigthClickCount;
206         int                                             clickX;
207         int                                             clickY;
208         char                                    _lastKeyCode;
209         long int                                onCharCallBackTimeEnd;
210         long int                                onCharNeeded;
211         bool                                    _drawingSelectionROI;
212         manualRoiControler              *_controlerSelectionROI;
213         manualViewRoi                   *_viewerSelectionROI;
214         manualContourModel              *_modelSelectionROI;
215         double                                  _widthOfContour;
216
217         bool _ctrlKey;
218         bool _shiftKey;
219 };
220 #endif // __wxVtkBaseView_SceneManager_HEADER_FILE__
221