wxVtkBaseView_SceneManager.h

Go to the documentation of this file.
00001 #ifndef __wxVtkBaseView_SceneManager_h_INCLUDED_H__
00002 #define __wxVtkBaseView_SceneManager_h_INCLUDED_H__
00003 
00004 
00005 // -----------------------------------------------------------------------------------------------------------
00006 // WX headers inclusion.
00007 // For compilers that support precompilation, includes <wx/wx.h>.
00008 // -----------------------------------------------------------------------------------------------------------
00009 
00010 #include <wx/wxprec.h>
00011 #ifdef __BORLANDC__
00012 #pragma hdrstop
00013 #endif
00014 #ifndef WX_PRECOMP
00015 #include <wx/wx.h>
00016 #endif
00017 
00018 
00019 //------------------------------------------------------------------------------------------------------------
00020 // Includes
00021 //------------------------------------------------------------------------------------------------------------
00022 
00023 #include "ContourWrap_ViewControl.h"
00024 #include "wxVtkBaseView.h"
00025 #include <iostream>
00026 #include <map>
00027 #include "manualContourModel.h"
00028 #include "manualRoiControler.h"
00029 #include "manualContourBaseControler.h"
00030 #include "manualCircleControler.h"
00031 #include "manualLineControler.h"
00032 #include "manualViewBaseContour.h"
00033 #include "manualViewBullEye.h"
00034 #include "manualViewCircle.h"
00035 #include "manualViewLine.h"
00036 #include "manualViewPoints.h"
00037 #include "manualViewRoi.h"
00038 #include <wx/event.h>
00039 
00040 //------------------------------------------------------------------------------------------------------------
00041 // Events declaration
00042 //------------------------------------------------------------------------------------------------------------
00043 BEGIN_DECLARE_EVENT_TYPES()
00044         DECLARE_EVENT_TYPE( wxEVT_START_CREATE_MULT_ROI, -1 )   
00045         DECLARE_EVENT_TYPE( wxEVT_STOP_CREATE_MULT_ROI, -1 )    
00046         DECLARE_EVENT_TYPE( wxEVT_SELECTED_MULT_ROI, -1 )       
00047         DECLARE_EVENT_TYPE( wxEVT_START_CREATE_ROI, -1 )
00048         DECLARE_EVENT_TYPE( wxEVT_STOP_CREATE_ROI, -1)
00049         DECLARE_EVENT_TYPE( wxEVT_DELETE_ROI, -1 )
00050         DECLARE_EVENT_TYPE( wxEVT_SELECTED_ROI, -1 )    
00051         DECLARE_EVENT_TYPE( wxEVT_UNSLECTED_ROI, -1 )   
00052         DECLARE_EVENT_TYPE( wxEVT_MANUAL_HIDED_ROI, -1 )        
00053         DECLARE_EVENT_TYPE( wxEVT_MANUAL_SHOWED_ROI, -1 )
00054         DECLARE_EVENT_TYPE( wxEVT_EDITING_ROI, -1 )     
00055         DECLARE_EVENT_TYPE( wxEVT_MOVING_ROI, -1 )      
00056         DECLARE_EVENT_TYPE( wxEVT_MOVING_ROI_POINT, -1 )        
00057         DECLARE_EVENT_TYPE( wxEVT_SELECTED_ROI_POINT, -1 )      
00058         DECLARE_EVENT_TYPE( wxEVT_UNSELECTED_ROI_POINT, -1 )                    
00059         DECLARE_EVENT_TYPE( wxEVT_CHANGED_DEEP, -1 )
00060 END_DECLARE_EVENT_TYPES()
00061 
00065 //------------------------------------------------------------------------------------------------------------
00066 // Class definition
00067 //------------------------------------------------------------------------------------------------------------
00068 class wxVtkBaseView_SceneManager : public InteractorStyleMaracas {
00069 
00070         public:
00071 
00072         //------------------------------------------------------------------------------------------------------------
00073         // Constructors & Destructors
00074         //------------------------------------------------------------------------------------------------------------
00075 
00076         wxVtkBaseView_SceneManager( wxVtkBaseView * theWxBaseViewToManage, wxEvtHandler * theEventHandler, double * spc );
00077         ~wxVtkBaseView_SceneManager();
00078 
00079         //------------------------------------------------------------------------------------------------------------
00080         // Methods for capturing events
00081         //------------------------------------------------------------------------------------------------------------
00082         
00083                 
00084         //------------------------------------------------------------------------------------------------------------
00085         //  Methods for sending events
00086         //------------------------------------------------------------------------------------------------------------
00087         void sendEnvent( WXTYPE theEventType, std::string text );
00088 
00089         //------------------------------------------------------------------------------------------------------------
00090         //  Attributes getters and setters
00091         //------------------------------------------------------------------------------------------------------------
00092         
00093         void setWxVtkViewBase( wxVtkBaseView * theBaseView );
00094         void setWxEventHandler( wxEvtHandler * theEventHandler );
00095         wxVtkBaseView * getWxVtkViewBase();
00096 
00097         //
00098         // Method which creates and associates view and controller to the contour model type pointed in parameter.
00099         // The possible contour types are:
00100         // 0-spline
00101         // 1-spline
00102         // 2-rectangle
00103         // 3-circle
00104         // 4-BullEye
00105         // 5-BullEyeSector
00106         // 6-Line
00107         // 7-Points
00108         // NOTE: The model is created in the KernelManagerContour class, factoryManualContourModel method
00109         // @param typeContour - int
00110         // @param theKeyName - string
00111         // @param manContourControl - manualBaseModel
00112         // @param spc - double*  3-pos Array 
00113         void configureViewControlTo( std::string theKeyName, manualBaseModel * manContourControl, double * spc ,int typeContour);
00114 
00115         void configureSelectionROI( double * spc );
00116         ContourWrap_ViewControl * insertWrap( std::string theKeyName, manualContourBaseControler * manContourControl, manualViewBaseContour  * manViewerContour ); 
00117         void desconfigureViewControlOf( std::string theKeyName );
00118         void removeWrap( std::string theKeyName );
00119         ContourWrap_ViewControl * getContourWrap_ViewControlOf ( std::string theName );
00120         ContourWrap_ViewControl * getContourWrap_ViewControlOf ( std::string theName, std::map<std::string, ContourWrap_ViewControl *> * theMap );
00121         manualContourBaseControler * getControlerOf( std::string theName );
00122         manualViewBaseContour * getViewerOf( std::string theName );
00123         void set_creatingMULT_ROI( bool condition );
00124         void set_editingROI( bool condition );
00125         void set_toIncludeAtInteractionGroup( bool condition );
00126         void set_waiting( bool condition );
00127         bool get_creatingMULT_ROI(  );
00128         bool get_editingROI(  );
00129         bool get_toIncludeAtInteractionGroup(  );
00130         bool get_waiting(  );
00131         bool get_creatingROI();
00132         void set_creatingROI( bool theCondition );
00133 
00134         //------------------------------------------------------------------------------------------------------------
00135         //  Other functional methods
00136         //------------------------------------------------------------------------------------------------------------
00137 
00138         void createCopyContourOf( std::string anExistingKName, std::string cloneName, manualBaseModel * manualModel, bool append = false );
00139         void removeFromScene( ContourWrap_ViewControl * contourWRP, bool visualization = true, bool control = true );
00140         void removeFromScene( std::string theKeyName, bool visualization = true, bool control = true );
00141         void removeSceneContours( );
00142         void removeAllOutlines();
00143         void addToScene( std::string theKeyName, bool append = true, bool visualization = true, bool control = true, bool ifActive = true, bool ifShowCtrlPoints = true );
00144         void addToScene( std::string theKeyName, ContourWrap_ViewControl * contourWRP, bool append = true, bool visualization = true, bool control = true, bool ifActive = true, bool ifShowCtrlPoints = true );
00145         void removeFromScene( std::vector< std::string> theKeyNameVector, bool visualization = true, bool control = true );
00146         void addToScene( std::vector< std::string> theKeyNameVector, bool append = true, bool visualization = true, bool control = true, bool ifActive = true, bool ifShowCtrlPoints = true );
00147         void setControlActiveStateOfALL( bool stateCondition );
00148         void setControlActiveStateOf( std::string theKeyName, bool stateCondition );
00149         void setControlActiveStateOf( ContourWrap_ViewControl * contourWRP, bool stateCondition );
00150         void setVisibleStateOf( std::string theKeyName, bool stateCondition );
00151 
00152         std::vector< std::string >  getSelectedObjects();
00153         void selectObjects( std::vector< std::string > theExistingObjectsToSelect );
00154         void selectObjects( std::map<std::string, ContourWrap_ViewControl *> * theMap );
00155         void setControlActiveStateOf( std::vector< std::string> &theKeyNameVector, bool controlCondition = false );
00156         void setControlActiveStateOf( std::map<std::string, ContourWrap_ViewControl *> * theMap, bool controlCondition = false );
00157         void drawSelectionROI();
00158         void setSelection2DROIInternalOutlines( );
00159         void writeCoords( std::string method );
00160 
00161    // EED
00162         void SaveThingName(FILE *ff, std::string nameThing);
00163         void GetPointsOfActualContour( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ );       
00164         vtkImageData *GetImageData();
00165         std::vector<std::string> GetlstContoursNameActualSlice();
00166 
00167         //------------------------------------------------------------------------------------------------------------
00168         // Inherited Methods
00169         //------------------------------------------------------------------------------------------------------------
00170 
00171         virtual bool  OnChar();
00172         virtual bool  OnMouseMove();
00173         virtual bool  OnLeftButtonDown(); 
00174         virtual bool  OnLeftButtonUp();
00175         virtual bool  OnMiddleButtonDown(); 
00176         virtual bool  OnMiddleButtonUp();
00177         virtual bool  OnRightButtonDown();
00178         virtual bool  OnRightButtonUp();
00179 
00180         virtual bool  OnLeftDClick();
00181         virtual bool  OnRightDClick();   
00182         virtual bool  OnMiddleDClick();  
00183         virtual bool  OnMouseWheel(); 
00184 
00185         int                       GetImageDataSizeZ();
00186         void              GetImageDataRange( double *range );
00187         void                    SetWidthContour(double width);
00188 
00189 //JCP 21 - 09 - 08
00190         bool isEditableCControler(std::string theKeyName);
00191         void deleteCViewerCControler(std::string theKeyName);
00192         bool isCtrlPressed();
00193         bool isShiftPressed();
00194         char getLastKeyCode();
00195 private:
00196         //------------------------------------------------------------------------------------------------------------
00197         //  Private methods
00198         //------------------------------------------------------------------------------------------------------------
00199 
00200         
00201         //------------------------------------------------------------------------------------------------------------
00202         // Creational and initialization methods
00203         //------------------------------------------------------------------------------------------------------------
00204 
00205                 
00206         //------------------------------------------------------------------------------------------------------------
00207         // Attributtes
00208         //------------------------------------------------------------------------------------------------------------
00209         
00210         std::map<std::string, ContourWrap_ViewControl *> * _contours_ViewControl;
00211         std::map<std::string, ContourWrap_ViewControl *> * _sceneContours_ViewControl;
00212         wxVtkBaseView                           *_wxVtk_BaseView;
00213         wxEvtHandler                            *_eventHandler;
00214         ContourWrap_ViewControl                 *_lastInteraction;
00215         std::string                             _lastInteractionName;
00216         std::map<std::string, ContourWrap_ViewControl *> * _workingGroup;
00217         bool                                    _creatingMULT_ROI;
00218         bool                                    _editingROI;
00219         bool                                    _toIncludeAtInteractionGroup;
00220         bool                                    _waiting;
00221         bool                                    _creatingROI;
00222         int                                     _enventID;
00223         int                                     _leftClickCount;
00224         int                                     _rigthClickCount;
00225         int                                     clickX;
00226         int                                     clickY;
00227         char                                    _lastKeyCode;
00228         long int                                onCharCallBackTimeEnd;
00229         long int                                onCharNeeded;
00230         bool                                    _drawingSelectionROI;
00231         manualRoiControler                      *_controlerSelectionROI;
00232         manualViewRoi                           *_viewerSelectionROI;
00233         manualBaseModel                         *_modelSelectionROI;
00234         double                                  _widthOfContour;
00235         double                                  _widthOfControlPoint;
00236 
00237         bool _ctrlKey;
00238         bool _shiftKey;
00239 };
00240 #endif // __wxVtkBaseView_SceneManager_HEADER_FILE__
00241 

Generated on Wed Jun 27 23:28:32 2012 for creaContours_lib by  doxygen 1.5.7.1