X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FEditorGraphicBBS%2FbbsWxGUIEditorGraphic%2FwxVtkSceneManager.cxx;fp=lib%2FEditorGraphicBBS%2FbbsWxGUIEditorGraphic%2FwxVtkSceneManager.cxx;h=731585d7ac15b80496e0cc030a37f53f072113f2;hb=511369e67cf26244fc8768a727a03f42ff42865f;hp=002e5895014dc0ed85cfa6f5b4c7862632469d4d;hpb=d108e756e1f5444e19b63ec457033b7518ba060e;p=bbtkGEditor.git diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx index 002e589..731585d 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx @@ -116,7 +116,6 @@ wxVtkSceneManager::wxVtkSceneManager(wxGEditorTabPanel *parent, wxVtk3DBaseView void wxVtkSceneManager::disconnectDrop() { - printf("EED %p ~wxVtkSceneManager::disconnectDrop()\n", this); //EED02JUIN2010 _baseView->GetWxVTKRenderWindowInteractor()->SetDropTarget(NULL); // _baseView->GetWxVTKRenderWindowInteractor()->SetDropTarget( new tmpClasswxTextDropTarget() ); } @@ -126,10 +125,8 @@ void wxVtkSceneManager::disconnectDrop() wxVtkSceneManager::~wxVtkSceneManager() { //FCY memory leaks - printf("EED %p ~wxVtkSceneManager() START\n", this); disconnectDrop(); delete _baseView; - printf("EED %p ~wxVtkSceneManager() END\n", this); } //========================================================================= @@ -329,14 +326,28 @@ int wxVtkSceneManager::createGBlackBox(int x, int y, std::string packageName,std model->addObserver(view); model->addObserver(this); + +//EED2017 change order + //Associates the view with the correspondent renderer and the model. + //(NOTE: Refresh is only made by the view) + view->setModel(model); + view->setBaseView(_baseView); + + //Associates the controller with the correspondent model and view + controller->setModelAndView(model, view); + + //Iterate and create the input ports std::map descriptorInMap = descriptor->GetInputDescriptorMap(); std::map::iterator itInput; int i = 0; - for (itInput = descriptorInMap.begin(); itInput != descriptorInMap.end(); ++itInput) { + for (itInput = descriptorInMap.begin(); itInput != descriptorInMap.end(); ++itInput) + { BlackBoxInputDescriptor *desc = itInput->second; - createGInputPort(GINPUTPORT, i, model, desc); +//EED2017-04-07 +// createGInputPort(GINPUTPORT, i, model, desc); + createGInputPort(GINPUTPORT, i, controller, desc); i++; } @@ -345,26 +356,20 @@ int wxVtkSceneManager::createGBlackBox(int x, int y, std::string packageName,std descriptor->GetOutputDescriptorMap(); std::map::iterator itOutput; i = 0; - for (itOutput = descriptorOutMap.begin(); itOutput - != descriptorOutMap.end(); ++itOutput) { + for (itOutput = descriptorOutMap.begin(); itOutput!= descriptorOutMap.end(); ++itOutput) + { BlackBoxOutputDescriptor *desc = itOutput->second; - createGOutputPort(GOUTPUTPORT, i, model, desc); +//EED2017-04-07 +// createGOutputPort(GOUTPUTPORT, i, model, desc); + createGOutputPort(GOUTPUTPORT, i, controller, desc); i++; } - //Associates the view with the correspondent renderer and the model. - //(NOTE: Refresh is only made by the view) - view->setModel(model); - view->setBaseView(_baseView); - +//EED2017 change order view->initVtkObjects(); - //Associates the controller with the correspondent model and view - controller->setModelAndView(model, view); - //Resgiter change to the observers of the actual model model->notifyObservers(_idManager); - int newId = addObjectController(controller); return newId; @@ -479,21 +484,35 @@ int wxVtkSceneManager::createGComplexBoxOutputPort(std::string outputName) { //========================================================================= -int wxVtkSceneManager::createGInputPort(int portType, int posinBox, GBoxModel *blackBox, BlackBoxInputDescriptor *desc) +//EED2017-04-08 +//int wxVtkSceneManager::createGInputPort(int portType, int posinBox, GBoxModel *blackBox, BlackBoxInputDescriptor *desc) +int wxVtkSceneManager::createGInputPort(int portType, int posinBox, GObjectController *gBoxControler, BlackBoxInputDescriptor *desc) { + GBoxModel *blackBox=(GBoxModel*)gBoxControler->getModel(); GPortController* portController = createGPort(portType, desc->GetName(), desc->GetTypeName(), desc->GetDescription(), posinBox, blackBox); - blackBox->addInputPort((GPortModel*) portController->getModel()); + blackBox->addInputPort( (GPortModel*)portController->getModel() ); + + vtkGBoxView *vtkgboxView=(vtkGBoxView*)gBoxControler->getView(); + vtkgboxView->addInputPort( (vtkGPortView*)portController->getView() ); + return portController->getId(); } //========================================================================= -int wxVtkSceneManager::createGOutputPort(int portType, int posinBox,GBoxModel *blackBox, BlackBoxOutputDescriptor *desc) +//EED2017-04-08 +//int wxVtkSceneManager::createGOutputPort(int portType, int posinBox,GBoxModel *blackBox, BlackBoxOutputDescriptor *desc) +int wxVtkSceneManager::createGOutputPort(int portType, int posinBox,GObjectController *gBoxControler, BlackBoxOutputDescriptor *desc) { + GBoxModel *blackBox=(GBoxModel*)gBoxControler->getModel(); GPortController* portController = createGPort(portType, desc->GetName(), desc->GetTypeName(),desc->GetDescription(), posinBox, blackBox); blackBox->addOutputPort((GPortModel*) portController->getModel()); + + vtkGBoxView *vtkgboxView=(vtkGBoxView*)gBoxControler->getView(); + vtkgboxView->addOutputPort( (vtkGPortView*)portController->getView() ); + return portController->getId(); } @@ -504,43 +523,28 @@ GPortController* wxVtkSceneManager::createGPort(int portType,std::string bbtkNam int type = GPORT; //Create the MVC Objects - GPortModel - *model = - (GPortModel*) GObjectsMVCFactory::getInstance()->createGObjectModel( - type); - vtkGObjectView *view = - GObjectsMVCFactory::getInstance()->createGObjectView(type); - GObjectController* controller = - GObjectsMVCFactory::getInstance()->createGObjectController(type); - + GPortModel *model = (GPortModel*) GObjectsMVCFactory::getInstance()->createGObjectModel(type); + vtkGObjectView *view = GObjectsMVCFactory::getInstance()->createGObjectView(type); + GObjectController *controller = GObjectsMVCFactory::getInstance()->createGObjectController(type); model->registerInBox(blackBox, portType, posInBox); - model->setBBTKType(bbtkType); model->setBBTKName(bbtkName); model->setBBTKDescription(bbtkDescription); - model->addObserver(view); model->addObserver(this); - //Associates the view with the correspondent renderer and the model. //(NOTE: Refresh is only made by the view) view->setModel(model); view->setBaseView(_baseView); - //EED017 view->initVtkObjects(); view->createVtkObjects(); // view->addVtkActors(); - //Associates the controller with the correspondent model and view controller->setModelAndView(model, view); - model->notifyObservers(_idManager); - addObjectController(controller); - return (GPortController*) controller; - } //========================================================================= @@ -711,10 +715,10 @@ void wxVtkSceneManager::update(int idController, int command) { // Highliht element obc->getView( )->setState( POSSIBLE_CONNECTION ) ; //obc->getView( )->setState( HIGHLIGHTED ) ; - } - } - } - } + } // if obc_type + } // for c_it + } // if + } // if iter // EO JGRR & CM WH @@ -776,7 +780,6 @@ void wxVtkSceneManager::update(int idController, int command) { if ((obc_type == GPORT) && (obc_state == SELECTED_POSSIBLE_CONNECTION)) { // Change element to connected state obc->getView()->setState(HIGHLIGHTED); - } }