int type = GBLACKBOX;
//Create the MVC Objects
- GObjectModel *model = GObjectsMVCFactory::getInstance()->createGObjectModel(type);
+ GBlackBoxModel *model = (GBlackBoxModel*)GObjectsMVCFactory::getInstance()->createGObjectModel(type);
vtkGObjectView *view = GObjectsMVCFactory::getInstance()->createGObjectView(type);
GObjectController* controller = GObjectsMVCFactory::getInstance()->createGObjectController(type);
double zz = 0;
_baseView->TransCoordScreenToWorld(xx,yy,zz);
model->setInicPoint(xx,yy,zz);
- model->updateBlackBox(descriptor);
+ //model->addObserver(view);
+
+ //Iterate and create the input ports
+ std::map<std::string, BlackBoxInputDescriptor*> descriptorMap = descriptor->GetInputDescriptorMap();
+ std::map<std::string, BlackBoxInputDescriptor*>::iterator it;
+
+ //ERASE
+ cantTemp=0;
+
+ for(it = descriptorMap.begin(); it != descriptorMap.end(); ++it)
+ {
+ BlackBoxInputDescriptor *desc = it->second;
+ createGInputPort(desc,model);
+
+ //ERASE
+ cantTemp+=2;
+ }
//Associates the view with the correspondent renderer and the model.
//=========================================================================
+ void wxVtkSceneManager::createGInputPort(BlackBoxInputDescriptor *desc,GBlackBoxModel *blackBox)
+ {
+ 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);
+
+ model->registerInBox(blackBox);
+ blackBox->addInputPort(model);
+
+
+ //Prepares the initial model
+ double xx = 0;
+ double yy = 0;
+ double zz = 0;
+ blackBox->getInicPoint(xx,yy,zz);
+
+ xx++;
+ yy+=cantTemp;
+ model->setInicPoint(xx,yy,zz);
+
+ //Associates the view with the correspondent renderer and the model.
+ //(NOTE: Refresh is only made by the view)
+ view->setModel(model);
+ view->setBaseView(_baseView);
+ view->initVtkObjects();
+
+ //Associates the controller with the correspondent model and view
+ controller->setModelAndView(model,view);
+ }
+
+ //=========================================================================
+
+ void wxVtkSceneManager::createGOutputPort(BlackBoxOutputDescriptor *desc,GBlackBoxModel *blackBox)
+ {
+ 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);
+
+ model->registerInBox(blackBox);
+ blackBox->addOutputPort(model);
+ }
+
+ //=========================================================================
+
void wxVtkSceneManager::registerController(InteractorStyleMaracas *param)
{
vtkInteractorStyleBaseView* baseViewControlManager = (vtkInteractorStyleBaseView*)_baseView->GetInteractorStyleBaseView();