]> Creatis software - creaContours.git/blob - lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.h
32362276d2ff19f94e4bce6686bc5793af6ccd22
[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 <manualContour.h>
28 #include <wx/event.h>
29
30 //------------------------------------------------------------------------------------------------------------
31 // Events declaration
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()
51
52 /** file wxVtkBaseView_SceneManager.h */
53
54
55 //------------------------------------------------------------------------------------------------------------
56 // Class definition
57 //------------------------------------------------------------------------------------------------------------
58 class wxVtkBaseView_SceneManager : public InteractorStyleMaracas {
59
60         public:
61
62         //------------------------------------------------------------------------------------------------------------
63         // Constructors & Destructors
64         //------------------------------------------------------------------------------------------------------------
65
66         wxVtkBaseView_SceneManager( wxVtkBaseView * theWxBaseViewToManage, wxEvtHandler * theEventHandler, double * spc );
67         ~wxVtkBaseView_SceneManager();
68
69         //------------------------------------------------------------------------------------------------------------
70         // Methods for capturing events
71         //------------------------------------------------------------------------------------------------------------
72         
73                 
74         //------------------------------------------------------------------------------------------------------------
75         //  Methods for sending events
76         //------------------------------------------------------------------------------------------------------------
77         void sendEnvent( WXTYPE theEventType, std::string text );
78
79         //------------------------------------------------------------------------------------------------------------
80         //  Attributes getters and setters
81         //------------------------------------------------------------------------------------------------------------
82         
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(  );
102         bool get_waiting(  );
103         bool get_creatingROI();
104         void set_creatingROI( bool theCondition );
105
106         //------------------------------------------------------------------------------------------------------------
107         //  Other functional methods
108         //------------------------------------------------------------------------------------------------------------
109
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 );
123
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 );
132
133    // EED
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();
138
139         //------------------------------------------------------------------------------------------------------------
140         // Inherited Methods
141         //------------------------------------------------------------------------------------------------------------
142
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();
151
152         virtual bool  OnLeftDClick();
153         virtual bool  OnRightDClick();   
154         virtual bool  OnMiddleDClick();  
155         virtual bool  OnMouseWheel(); 
156
157         int                       GetImageDataSizeZ();
158         void              GetImageDataRange( double *range );
159         void                    SetWidthContour(double width);
160
161 //JCP 21 - 09 - 08
162         bool isEditableCControler(std::string theKeyName);
163         void deleteCViewerCControler(std::string theKeyName);
164         bool isCtrlPressed();
165         bool isShiftPressed();
166         char getLastKeyCode();
167 private:
168         //------------------------------------------------------------------------------------------------------------
169         //  Private methods
170         //------------------------------------------------------------------------------------------------------------
171
172         
173         //------------------------------------------------------------------------------------------------------------
174         // Creational and initialization methods
175         //------------------------------------------------------------------------------------------------------------
176
177                 
178         //------------------------------------------------------------------------------------------------------------
179         // Attributtes
180         //------------------------------------------------------------------------------------------------------------
181         
182         std::map<std::string, ContourWrap_ViewControl *> * _contours_ViewControl;
183         std::map<std::string, ContourWrap_ViewControl *> * _sceneContours_ViewControl;
184         wxVtkBaseView                   *_wxVtk_BaseView;
185         wxEvtHandler                    *_eventHandler;
186         ContourWrap_ViewControl *_lastInteraction;
187         std::string                             _lastInteractionName;
188         std::map<std::string, ContourWrap_ViewControl *> * _workingGroup;
189         bool                                    _creatingMULT_ROI;
190         bool                                    _editingROI;
191         bool                                    _toIncludeAtInteractionGroup;
192         bool                                    _waiting;
193         bool                                    _creatingROI;
194         int                                             _enventID;
195         int                                             _leftClickCount;
196         int                                             _rigthClickCount;
197         int                                             clickX;
198         int                                             clickY;
199         char                                    _lastKeyCode;
200         long int                                onCharCallBackTimeEnd;
201         long int                                onCharNeeded;
202         bool                                    _drawingSelectionROI;
203         manualRoiControler              *_controlerSelectionROI;
204         manualViewRoi                   *_viewerSelectionROI;
205         manualContourModel              *_modelSelectionROI;
206         double                                  _widthOfContour;
207
208         bool _ctrlKey;
209         bool _shiftKey;
210 };
211 #endif // __wxVtkBaseView_SceneManager_HEADER_FILE__
212