+
+ void wxVtkSceneManager::update(int idController,int command)
+ {
+ if(command != NO_COMMAND)
+ {
+ if(command == ADD_TO_SELECTED)
+ {
+ GObjectController* cont = _controllers[idController];
+
+ bool foundID=false;
+ for (int i=0; i<_selectedObjects.size() && foundID==false; i++)
+ {
+ int id = _selectedObjects[i];
+ if(id==idController)
+ {
+ foundID = true;
+ }
+ }
+ if(!foundID)
+ {
+ int id = idController;
+ _selectedObjects.push_back(id);
+ }
+
+ }
+ else if(command == INIT_CREATION_CONTOUR)
+ {
+ _worldState = INIT_CREATION_CONTOUR;
+ GObjectController* cont = _controllers[idController];
+ GPortModel* startOutputPort = (GPortModel*)cont->getModel();
+
+
+ // The last one is the controller of the connector
+ for(int i=0;i<_controllers.size();i++)
+ {
+ GObjectController* cont = _controllers[i];
+ if(cont->getGObjectType() == GPORT )
+ {
+ GPortModel* port = (GPortModel*)cont->getModel();
+ if(port->getPortType()==GINPUTPORT)
+ {
+ cont->SetActive(true);
+ }
+ else
+ {
+ cont->getView()->setState(NOTHING_HAPPENS);
+ cont->getModel()->notifyObservers(_idManager);
+ cont->SetActive(false);
+ }
+ }
+ else
+ {
+ cont->getView()->setState(NOTHING_HAPPENS);
+ cont->getModel()->notifyObservers(_idManager);
+ cont->SetActive(false);
+ }
+ }
+
+ _selectedObjects.clear();
+
+ createGConnector(startOutputPort);
+
+ }
+ else if(command == FIN_CREATION_CONTOUR && _worldState == INIT_CREATION_CONTOUR)
+ {
+ _worldState = NOTHING_HAPPENS;
+ int id = _controllers.size()-1;
+ GObjectController* cont = _controllers[id];
+ GConnectorModel* modelContour = (GConnectorModel*)cont->getModel();
+
+ GObjectController* finPort = _controllers[idController];
+ if(finPort->getGObjectType() == GPORT)
+ {
+ GPortModel* modelPort = (GPortModel*)finPort->getModel();
+ modelContour->setEndPort(modelPort);
+ }
+
+ manualConnectorContourController* manCont = ((GConnectorController*)cont)->getManualContourController();
+ manualConnectorContourView* connView = (manualConnectorContourView*)manCont->GetManualViewBaseContour();
+ connView->Refresh();
+
+ for(int i=0;i<_controllers.size();i++)
+ {
+ GObjectController* cont = _controllers[i];
+ if(cont->getView()!=NULL)
+ {
+ cont->getView()->setState(NOTHING_HAPPENS);
+ cont->getModel()->notifyObservers(_idManager);
+ }
+ cont->SetActive(true);
+ }
+ }
+ }
+ }
+
+ //=========================================================================
+