]> Creatis software - bbtkGEditor.git/blobdiff - lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx
Feature #1380
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsWxGUIEditorGraphic / wxVtkSceneManager.cxx
index 192100b24a4544e00a3a20f38618f956fa461a25..6de30402b985bce8502bfbb80e2fdc5cb7e3a249 100644 (file)
@@ -61,9 +61,9 @@ wxVtkSceneManager::wxVtkSceneManager(wxGEditorTabPanel *parent,
                printf(
                                "RaC-EED 21-06-2010 %p wxVtkSceneManager::wxVtkSceneManager If you comment this line, the drag and drop functionnality is not initialized.\n",
                                this);
-#ifdef __APPLE__
+//#ifdef __APPLE__
                _baseView->GetWxVTKRenderWindowInteractor()->SetDropTarget((wxDropTarget*)parent);
-#endif
+//#endif
 
                configureBaseView();
                _worldState = NOTHING_HAPPENS;
@@ -87,9 +87,10 @@ void wxVtkSceneManager::disconnectDrop() {
 
 wxVtkSceneManager::~wxVtkSceneManager() {
        //FCY memory leaks
-       printf("EED %p ~wxVtkSceneManager()\n", this);
+       printf("EED %p ~wxVtkSceneManager() START\n", this);
        disconnectDrop();
        delete _baseView;
+       printf("EED %p ~wxVtkSceneManager() END\n", this);
 }
 
 //=========================================================================
@@ -113,7 +114,6 @@ void wxVtkSceneManager::configureBaseView() {
 
        _baseView->GetRenderer()->SetBackground(0.9, 0.9, 0.9);
        _baseView->GetRenderer()->GradientBackgroundOn();
-       _baseView->Refresh();
 
        // Actos Port_Text
        _textActor = vtkTextActor3D::New();
@@ -543,7 +543,6 @@ int wxVtkSceneManager::createGConnector(GPortModel* startPort) {
 
        manContourControl->CreateNewManualContour();
 
-       manContourView->RefreshContour();
 
        double x, y, z;
        connectorModel->getInicPoint(x, y, z);
@@ -559,8 +558,7 @@ int wxVtkSceneManager::createGConnector(GPortModel* startPort) {
 
        int bak = manContourControl->GetNumberOfPointsManualContour() - 1;
        manContourControl->_bakIdPoint = bak;
-       manContourView->Refresh();
-
+       
        manContourControl->SetMoving(false);
 
        connectorcontroller->setModelAndView(connectorModel, connectorView);
@@ -576,6 +574,7 @@ int wxVtkSceneManager::createGConnector(GPortModel* startPort) {
        connectorModel->addObserver(connectorView);
        connectorModel->addObserver(this);
 
+        manContourView->Refresh();
        return newId;
 }
 
@@ -748,7 +747,7 @@ void wxVtkSceneManager::update(int idController, int command) {
                                 }
                                 // EO JGRR CM                                
                     
-                                _parent->saveTempDiagram();
+                                                               _parent->saveTempandUpdate("create connection");
                        }
 
                        manualConnectorContourController
@@ -757,8 +756,7 @@ void wxVtkSceneManager::update(int idController, int command) {
                        manualConnectorContourView
                                        * connView =
                                                        (manualConnectorContourView*) manCont->GetManualViewBaseContour();
-                       connView->Refresh();
-
+                                     
                        std::map<int, GObjectController*>::iterator it2;
 
                        for (it2 = _controllers.begin(); it2 != _controllers.end(); ++it2) {
@@ -769,10 +767,11 @@ void wxVtkSceneManager::update(int idController, int command) {
                                }
                                cont->SetActive(true);
                        }
+                        connView->Refresh();          
                }
 
        }
-
+        
 }
 
 //=========================================================================
@@ -1025,6 +1024,7 @@ void wxVtkSceneManager::UnSelectBlackBoxes() {
                int id = _selectedObjects[i];
                GObjectController* control = _controllers[id];
                control->getView()->setState(NOTHING_HAPPENS);
+               control->getModel()->notifyObservers(_idManager);
        }// for _selectedObjects
        _selectedObjects.clear();
 }
@@ -1212,7 +1212,7 @@ void wxVtkSceneManager::deleteObject(int id) {
                        _controllers.erase(it);
                }//if
        }// for
-       _parent->saveTempDiagram();
+       _parent->saveTempandUpdate("delete object");
 }
 
 //=========================================================================
@@ -1629,7 +1629,6 @@ void wxVtkSceneManager::deleteAllBoxes() {
        }
        _selectedObjects.clear();
        _controllers.clear();
-       refreshScene();
 }
 
 //=========================================================================
@@ -1652,8 +1651,6 @@ void wxVtkSceneManager::centerView() {
        _baseView->GetRenderer()->GetActiveCamera()->SetFocalPoint(0, 0, temp[2]);
        _baseView->GetRenderer()->GetActiveCamera()->GetPosition(temp);
        _baseView->GetRenderer()->GetActiveCamera()->SetPosition(0, 0, temp[2]);
-       _baseView->RefreshView();
-
 }
 
 //=========================================================================
@@ -2100,7 +2097,6 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream) {
 
        } // start
 
-       refresh();
 }
 //=========================================================================
 
@@ -2385,7 +2381,6 @@ void wxVtkSceneManager::DuplicateObjects(std::map<int, GObjectController*> objec
             cont->getModel()->notifyObservers(_idManager);
 
         }
-        refreshScene();
     }