]> Creatis software - creaContours.git/blobdiff - lib/Interface_ManagerContour_NDimensions/wxContourViewPanel.cxx
Changes with manualBaseModel. It improves the functionality with the new
[creaContours.git] / lib / Interface_ManagerContour_NDimensions / wxContourViewPanel.cxx
index c2b2b2be969d6d537dc81880df61b8afa1f59f1d..a3611aaffffff8bb25f559dbcdfff15324e53003 100644 (file)
@@ -8,7 +8,7 @@
 //----------------------------------------------------------------------------------------------------------------
 // Other includes
 //----------------------------------------------------------------------------------------------------------------
-#include "ConceptDataWrap.h"
+//#include "ConceptDataWrap.h"
 
 //this should be eliminated at some point
 //#include "wxContourEventHandler.h"
@@ -91,7 +91,6 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
        :wxPanel(parent, -1, pos, size, style)          
        {               
                theShowingImage->GetSpacing(last_spacing);
-               
                showingVID = theShowingImage;
                int gapH = 20;
                int gapV = 10;
@@ -137,7 +136,7 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
                Connect(_verticalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onMovedBar_Vertical );
                
                
-               SetSizer( outSizer );
+               this->SetSizer( outSizer );
                this->SetAutoLayout( true );
                this->Layout();
 
@@ -148,13 +147,12 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
                //outSizer->Fit( this );        
 
                initializeScenceManager();
-
        }
        
 
        wxContourViewPanel :: ~wxContourViewPanel()
        {
-               
+               delete _sceneManager;
        }
 
        void wxContourViewPanel::initializeScenceManager(){
@@ -212,17 +210,18 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
        }
        //------------------------------------------------------------------------------------------------------------
 
-       void wxContourViewPanel :: createViewPanel()
+       void wxContourViewPanel::createViewPanel()
        {               
                std::vector<int> * numViews = new std::vector<int> ();
-               numViews->push_back(2);
-               theViewPanel                                    = new wxMaracas_N_ViewersWidget( this, showingVID, numViews );
+               numViews->push_back(0);
+               theViewPanel = new wxMaracas_N_ViewersWidget( this, showingVID, numViews );
                SetVisibleAxis(false);
 
                theViewPanel->SetBackgroundColour(wxColour(0,0,0));
 
                theViewPanel->SetSize(800,600);
-               theViewPanel->GetWindow(1)->SetSize(800,600);   
+               theViewPanel->GetWindow(1)->SetSize(800,600);
+               
        }
        //------------------------------------------------------------------------------------------------------------
 
@@ -305,35 +304,35 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
 
                //}
                //JCP 26 - 11 - 08
-       }
+       } 
        /**
        * Handles the event wxEVT_TSBAR_START from the horizontal bar   
        */
        void wxContourViewPanel :: onStartChange_Bar_Horizontal(wxCommandEvent& event)
        {
-               int nxStart_h = getStartHorizontal();
+//             int nxStart_h = getStartHorizontal();
        }
        /**
        * Handles the event wxEVT_TSBAR_END from the horizontal bar     
        */
        void wxContourViewPanel :: onEndChange_Bar_Horizontal(wxCommandEvent& event)
        {
-               int nxEnd_h = getEndHorizontal();
+//             int nxEnd_h = getEndHorizontal();
        }
        /**
        * Handles the event wxEVT_SELECTION_END from the horizontal bar 
        */
        void wxContourViewPanel :: onSelectionEnd_Horizontal(wxCommandEvent& event)
        {
-               
+        
        }
        /**
        * Handles the event wxEVT_TSBAR_MOVED from the horizontal bar   
        */
        void wxContourViewPanel :: onMovedBar_Horizontal(wxCommandEvent& event)
        {
-               int nxStart_h = getStartHorizontal();
-               int nxEnd_h = getEndHorizontal();
+//             int nxStart_h = getStartHorizontal();
+//             int nxEnd_h = getEndHorizontal();
        }
 
 
@@ -379,14 +378,14 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
        */
        void wxContourViewPanel :: onStartChange_Bar_Vertical(wxCommandEvent& event)
        {
-               int nxStart_v = getStartVertical();
+//             int nxStart_v = getStartVertical();
        }
        /**
        * Handles the event wxEVT_TSBAR_END from the vertical bar       
        */
        void wxContourViewPanel :: onEndChange_Bar_Vertical(wxCommandEvent& event)
        {
-               int nxEnd_v = getEndVertical();
+//             int nxEnd_v = getEndVertical();
        }
        /**
        * Handles the event wxEVT_SELECTION_END from the vertical bar   
@@ -400,8 +399,8 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
        */
        void wxContourViewPanel :: onMovedBar_Vertical(wxCommandEvent& event)
        {
-               int nxStart_v = getStartVertical();
-               int nxEnd_v = getEndVertical();
+//             int nxStart_v = getStartVertical();
+//             int nxEnd_v = getEndVertical();
        }       
 
 
@@ -672,6 +671,7 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
                }       
                wxContourMainFrame::getInstance()->changeInstant();
        }
+
        void wxContourViewPanel::onCreateMultipleROI (wxCommandEvent& event){
        }
        void wxContourViewPanel::onCreateROI (wxCommandEvent& event){
@@ -680,13 +680,53 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
        }
        void wxContourViewPanel::onChangedDeep (wxCommandEvent& event){
                double val = getCurrentDeep();
-               setActualVertical( (int)val );
+               //setActualVertical( (int)val );
                wxContourMainFrame::getInstance()->onChangeDeep((int)val);
                //_instantPanel->setConceptValue( "Axe Depth", (int)val );
                
 //             changeInstant();
        }
+       void wxContourViewPanel::changeDeep(){
+               double val = getCurrentDeep();
+               setActualVertical( (int)val );
+       }
        void wxContourViewPanel::onActionButtonPressed(wxCommandEvent& event){
+
+               
+               std::vector<std::string> currentSelection = _sceneManager->getSelectedObjects();
+//             int elementsSelected = currentSelection.size();
+               bool ctrlKey = _sceneManager->isCtrlPressed();
+               char toolCommand = _sceneManager->getLastKeyCode();
+
+
+               if ( toolCommand == 3 && ctrlKey ) //'C' || 'c' 
+               {
+                       wxContourMainFrame::getInstance()->onCopy();
+               }
+               else if(  toolCommand == 22 && ctrlKey ) //'V' || 'v' 
+               {
+                       wxContourMainFrame::getInstance()->onPaste();
+               }
+               else if(  toolCommand == 8 || (toolCommand==127) ) // backspace Delete 
+               {
+                       wxContourMainFrame::getInstance()->onDeleteContour();
+               }
+               else if(  toolCommand == 14 && ctrlKey ) //'N' || 'n' 
+               {
+                       //toolCommand = &(CREATE_CONTOUR_KEY);
+               }
+               else if(  toolCommand == 15 && ctrlKey ) //'O' || 'o' 
+               {
+                       wxContourMainFrame::getInstance()->onLoad();
+               }
+               else if(  toolCommand == 19 && ctrlKey ) //'S' || 's' 
+               {
+                       wxContourMainFrame::getInstance()->saveFileWithContoursAutomatique();
+               }else if( toolCommand == 26 ){
+                       wxContourMainFrame::getInstance()->onUndo();
+               }else if( toolCommand == 25 ){
+                       wxContourMainFrame::getInstance()->onRedo();
+               }
        }
 
        void wxContourViewPanel::removeSceneContours(){
@@ -713,7 +753,7 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
                return _sceneManager->GetImageData();
        }
 
-       void wxContourViewPanel::configureViewControlTo(std::string theName,manualContourModel* manModelContour,double* spc,int typeofcontour){
+       void wxContourViewPanel::configureViewControlTo(std::string theName,manualBaseModel* manModelContour,double* spc,int typeofcontour){
                _sceneManager->configureViewControlTo(theName, manModelContour, spc, typeofcontour);
        }
 
@@ -746,8 +786,8 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
        void wxContourViewPanel::onBrigthnessColorWindowLevel(int colorwindow,int windowlevel){
                wxVtk2DBaseView *wxvtk2dbaseview = (wxVtk2DBaseView*)getWxVtkBaseView();
                vtkImageViewer2 *imageviewer = wxvtk2dbaseview->_imageViewer2XYZ->GetVtkImageViewer2();
-               imageviewer->SetColorWindow(colorwindow);
-               imageviewer->SetColorLevel(windowlevel);        
+               //AMP//imageviewer->SetColorWindow(colorwindow);
+               //AMP//imageviewer->SetColorLevel(windowlevel); 
        }
 
        void wxContourViewPanel::onInterpolation(bool interpolate){
@@ -763,4 +803,12 @@ DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
 
        void wxContourViewPanel::GetPointsOfActualContour( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ ){
                _sceneManager->GetPointsOfActualContour(vecX, vecY, vecZ);
-       }
\ No newline at end of file
+       }
+
+       void wxContourViewPanel::setImageSlice(int z){
+               vtkInteractorStyleBaseView* stylebaseview = (vtkInteractorStyleBaseView*) _sceneManager->getWxVtkViewBase()->GetInteractorStyleBaseView();
+               wxVtk2DBaseView* baseview = (wxVtk2DBaseView*)stylebaseview->GetWxVtk2DBaseView();
+               baseview->SetActualSlice(z);
+               RefreshInterface();
+       }
+