]> Creatis software - bbtkGEditor.git/blobdiff - lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx
#1372
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsWxGUIEditorGraphic / wxVtkSceneManager.cxx
index 2acf1d709ca53852a197acf389dc3f1fcd381439..dc5545af9ba4652599f22fd17aa1b2209c125b68 100644 (file)
@@ -61,7 +61,6 @@ 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__
                _baseView->GetWxVTKRenderWindowInteractor()->SetDropTarget((wxDropTarget*)parent);
 //#endif
@@ -115,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();
@@ -254,7 +252,9 @@ int wxVtkSceneManager::createGBlackBox(int x, int y, std::string packageName,
        BlackBoxDescriptor::Pointer descriptor =
                        GObjectsMVCFactory::getInstance()->getBlackBoxDescriptor(
                                        packageName, boxType);
-
+       if (descriptor == NULL){
+                       printf("SCP: ERROR in wxVtkSceneManager::createGBlackBox, box %s probably does not exist.\n",  boxType.c_str());
+               }
        //Prepares the initial model
        //The coordinates obtained are the following. Top-Left:x=0,y=0 Bottom-Right:x=width,y=height
 
@@ -545,7 +545,6 @@ int wxVtkSceneManager::createGConnector(GPortModel* startPort) {
 
        manContourControl->CreateNewManualContour();
 
-       manContourView->RefreshContour();
 
        double x, y, z;
        connectorModel->getInicPoint(x, y, z);
@@ -561,8 +560,7 @@ int wxVtkSceneManager::createGConnector(GPortModel* startPort) {
 
        int bak = manContourControl->GetNumberOfPointsManualContour() - 1;
        manContourControl->_bakIdPoint = bak;
-       manContourView->Refresh();
-
+       
        manContourControl->SetMoving(false);
 
        connectorcontroller->setModelAndView(connectorModel, connectorView);
@@ -578,6 +576,7 @@ int wxVtkSceneManager::createGConnector(GPortModel* startPort) {
        connectorModel->addObserver(connectorView);
        connectorModel->addObserver(this);
 
+        manContourView->Refresh();
        return newId;
 }
 
@@ -750,7 +749,7 @@ void wxVtkSceneManager::update(int idController, int command) {
                                 }
                                 // EO JGRR CM                                
                     
-                                _parent->saveTempDiagram();
+                                                               _parent->saveTempandUpdate("create connection");
                        }
 
                        manualConnectorContourController
@@ -759,8 +758,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) {
@@ -771,10 +769,11 @@ void wxVtkSceneManager::update(int idController, int command) {
                                }
                                cont->SetActive(true);
                        }
+                        connView->Refresh();          
                }
 
        }
-
+        
 }
 
 //=========================================================================
@@ -1027,6 +1026,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();
 }
@@ -1214,7 +1214,7 @@ void wxVtkSceneManager::deleteObject(int id) {
                        _controllers.erase(it);
                }//if
        }// for
-       _parent->saveTempDiagram();
+       _parent->saveTempandUpdate("delete object");
 }
 
 //=========================================================================
@@ -1631,7 +1631,6 @@ void wxVtkSceneManager::deleteAllBoxes() {
        }
        _selectedObjects.clear();
        _controllers.clear();
-       refreshScene();
 }
 
 //=========================================================================
@@ -1654,8 +1653,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();
-
 }
 
 //=========================================================================
@@ -2102,7 +2099,6 @@ void wxVtkSceneManager::loadDiagram(stringstream &inputStream) {
 
        } // start
 
-       refresh();
 }
 //=========================================================================
 
@@ -2177,11 +2173,17 @@ int wxVtkSceneManager::configGConnetion(std::string nameStartBox,
        boxModel = findGBox(nameStartBox);
        if (boxModel != NULL) {
                startP = boxModel->getOutputPort(nameStartPort);
+               if(startP == NULL){
+                       printf("SCP: ERROR in wxVtkSceneManager::configGConnetion start port %s is null. Port name is probably wrong.\n", nameStartPort.c_str());
+               }
        }
 
        boxModel = findGBox(nameEndBox);
        if (boxModel != NULL) {
                endP = boxModel->getInputPort(nameEndPort);
+               if(endP == NULL){
+                       printf("SCP: ERROR in wxVtkSceneManager::configGConnetion end port %s is null. Port name is probably wrong\n", nameStartPort.c_str(), nameEndPort.c_str());
+               }
        }
 
        //ups2
@@ -2387,7 +2389,6 @@ void wxVtkSceneManager::DuplicateObjects(std::map<int, GObjectController*> objec
             cont->getModel()->notifyObservers(_idManager);
 
         }
-        refreshScene();
     }