]> Creatis software - creaContours.git/blobdiff - lib/Interface_ManagerContour_NDimensions/wxVtkBaseView_SceneManager.cxx
*** empty log message ***
[creaContours.git] / lib / Interface_ManagerContour_NDimensions / wxVtkBaseView_SceneManager.cxx
index dbebb4eccebef8dc1a8742d21580fa26334381e1..589ed818c27d62172a0be7784de50ae982482e21 100644 (file)
@@ -13,7 +13,7 @@
 //------------------------------------------------------------------------------------------------------------
 // Includes
 //------------------------------------------------------------------------------------------------------------
-#include "wxContour_ActionCommnadsID.h"
+#include "wxContour_ActionCommandsID.h"
 
 //------------------------------------------------------------------------------------------------------------
 // Generated events declaration and definition
@@ -57,6 +57,7 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP )
                _creatingROI                                    = false;
                _drawingSelectionROI                    = false;
 
+               
                _wxVtk_BaseView = theWxBaseViewToManage;
                if( _wxVtk_BaseView!=NULL )
                {
@@ -164,6 +165,12 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP )
                        manViewerContour        = new manualViewBullEye();
                }
 
+               if (typeContour==6)
+               {
+                       manContourControl       = new manualLineControler();
+                       manViewerContour        = new manualViewLine();
+               }
+
 
 //EED Borrame
 //FILE *ff = fopen("c:/temp/wxVtkBaseView_SceneManagerStadistics.txt","a+");
@@ -250,6 +257,7 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP )
                std::map<std::string, ContourWrap_ViewControl *> :: iterator iter;
                iter = _contours_ViewControl->find( theName );
                return iter->second;
+               //return iter->first;
        }
        //------------------------------------------------------------------------------------------------------------
        ContourWrap_ViewControl * wxVtkBaseView_SceneManager :: getContourWrap_ViewControlOf ( std::string theName, std::map<std::string, ContourWrap_ViewControl *> * theMap )
@@ -406,7 +414,8 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP )
 
                std::map<std::string, ContourWrap_ViewControl *> :: iterator iter;
                iter = _sceneContours_ViewControl->find( theKeyName );
-               if (iter != _sceneContours_ViewControl->end()){
+               if (iter != _sceneContours_ViewControl->end())
+               {
                        ContourWrap_ViewControl * contourWRP =   iter->second;
                        removeFromScene( contourWRP );  
 //EED Borrame
@@ -659,51 +668,67 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP )
        // Inherited Methods
        //------------------------------------------------------------------------------------------------------------
 
+       bool  wxVtkBaseView_SceneManager :: isCtrlPressed()
+       { 
+               return _ctrlKey;
+       }
+       bool  wxVtkBaseView_SceneManager :: isShiftPressed()
+       { 
+               return _shiftKey;
+       }
+       char  wxVtkBaseView_SceneManager :: getLastKeyCode()
+       { 
+               return _lastKeyCode;
+       }
        bool  wxVtkBaseView_SceneManager :: OnChar()
        { 
 
-               bool ctrlKey = _vtkInteractorStyleBaseView->GetInteractor()->GetControlKey() == 1;
-               bool shiftKey = _vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey() == 1;
+               _ctrlKey = _vtkInteractorStyleBaseView->GetInteractor()->GetControlKey() == 1;
+               _shiftKey = _vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey() == 1;
 
                _lastKeyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode();
+
+               wxCommandEvent cevent( wxEVT_COMMAND_BUTTON_CLICKED );
+               _eventHandler->ProcessEvent( cevent );
                
-               
-               if( _eventHandler!=NULL )
+                               
+               /*if( _eventHandler!=NULL )
                {
-                       const char * toolCommand = NULL;
+                       char * toolCommand = NULL;
 
                        if ( _lastKeyCode == 3 && ctrlKey ) //'C' || 'c' 
                        {
-                               toolCommand = &(wxContour_ActionCommnadsID::COPY_TOOL);
+                               toolCommand = &(COPY_TOOL);
                        }
                        else if(  _lastKeyCode == 22 && ctrlKey ) //'V' || 'v' 
                        {
-                               toolCommand = &(wxContour_ActionCommnadsID::PASTE_TOOL);
+                               toolCommand = &(PASTE_TOOL);
                        }
                        else if(  _lastKeyCode == 8 || (_lastKeyCode==127) ) // Delete 
                        {
-                               toolCommand = &(wxContour_ActionCommnadsID::DELETE_KEY);
+                               toolCommand = &(DELETE_KEY);
                        }
                        else if(  _lastKeyCode == 14 && ctrlKey ) //'N' || 'n' 
                        {
-                               toolCommand = &(wxContour_ActionCommnadsID::CREATE_CONTOUR_KEY);
+                               toolCommand = &(CREATE_CONTOUR_KEY);
                        }
                        else if(  _lastKeyCode == 15 && ctrlKey ) //'O' || 'o' 
                        {
-                               toolCommand = &(wxContour_ActionCommnadsID::OPEN_TOOL);
+                               toolCommand = &(OPEN_TOOL);
                        }
                        else if(  _lastKeyCode == 19 && ctrlKey ) //'S' || 's' 
                        {
-                               toolCommand = &(wxContour_ActionCommnadsID::SAVE_KEY);
+                               toolCommand = &(SAVE_KEY);
                        }
 
                        if ( toolCommand!=NULL )
                        {
+                               currentkey = toolCommand;
                                wxCommandEvent cevent( wxEVT_COMMAND_BUTTON_CLICKED );
                                cevent.SetClientData( (void *) toolCommand);
                                _eventHandler->ProcessEvent( cevent );
                        }                               
-               }
+               }*/
                
        
        //      long int endtime = clock();             
@@ -820,7 +845,7 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP )
                                                _lastInteractionName    = iter->first;
 
                                                viewer->UpdateColorActor();
-                                               control->SetPosibleToMove( true );                                              
+                                               control->SetPosibleToMove( true );
                                                // viewer->AddCompleteContourActor();
                                        }
                                        iter++;
@@ -1100,7 +1125,7 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP )
                int tmpPx,tmpPy;
                wxVTKRenderWindowInteractor *wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
                wxVTKiren->GetEventPosition( tmpPx , tmpPy );
-               fprintf(ff,"::%s (x,y) = (%i, %i) t(sg): \n  \n",method, tmpPx, tmpPy, sg);
+               fprintf(ff,"::%s (x,y) = (%i, %i) t(sg): \n  \n",method.c_str(), tmpPx, tmpPy, sg);
                fclose(ff);
        }
 
@@ -1201,3 +1226,31 @@ DEFINE_EVENT_TYPE( wxEVT_CHANGED_DEEP )
                        cViewer->SetWidthLine(_widthOfContour);
                }
        }
+
+       bool wxVtkBaseView_SceneManager::isEditableCControler(std::string theKeyName){
+               
+               ContourWrap_ViewControl* ccon = getContourWrap_ViewControlOf(theKeyName);
+               if(ccon != NULL ){
+                       manualContourBaseControler* cControler = ccon->getControler();
+                       if(cControler != NULL && cControler->IsEditable() == false){
+                               return true;
+                       }
+               }
+               return false;
+       }
+
+       void wxVtkBaseView_SceneManager::deleteCViewerCControler(std::string theKeyName){
+               
+
+               ContourWrap_ViewControl* ccon = getContourWrap_ViewControlOf(theKeyName);
+
+               manualViewBaseContour                   * cViewer = ccon->getViewer();
+               manualContourBaseControler      * cControler = ccon->getControler();
+
+               removeFromScene(theKeyName);
+               removeWrap(theKeyName);
+
+               delete cViewer;         
+               delete cControler;
+       }
+               
\ No newline at end of file