//=========================================================================
- void wxVtkSceneManager::createGBlackBox(int x, int y, std::string packageName, std::string boxName)
+ void wxVtkSceneManager::createGBlackBox(int x, int y, std::string packageName, std::string boxType)
{
int windowWidth=_baseView->GetRenWin()->GetSize()[0];
vtkGObjectView *view = GObjectsMVCFactory::getInstance()->createGObjectView(type);
GObjectController* controller = GObjectsMVCFactory::getInstance()->createGObjectController(type);
- BlackBoxDescriptor::Pointer descriptor = GObjectsMVCFactory::getInstance()->getBlackBoxDescriptor(packageName, boxName);
+ BlackBoxDescriptor::Pointer descriptor = GObjectsMVCFactory::getInstance()->getBlackBoxDescriptor(packageName, boxType);
//Prepares the initial model
//The coordinates obtained are the following. Top-Left:x=0,y=0 Bottom-Right:x=width,y=height
std::string arraystring = stream.str();
model->setBBTKName(arraystring);
- model->setBBTKType(boxName);
+ model->setBBTKType(boxType);
model->setBBTKPackage(packageName);
model->addObserver(view);
void wxVtkSceneManager::createGInputPort(int portType, int posinBox,GBlackBoxModel *blackBox, BlackBoxInputDescriptor *desc)
{
- createGPort(portType,posinBox,blackBox);
+ createGPort(portType,desc->GetName(),desc->GetTypeName(),posinBox,blackBox);
}
//=========================================================================
void wxVtkSceneManager::createGOutputPort(int portType, int posinBox,GBlackBoxModel *blackBox, BlackBoxOutputDescriptor *desc)
{
- createGPort(portType,posinBox,blackBox);
+ createGPort(portType,desc->GetName(),desc->GetTypeName(),posinBox,blackBox);
}
//=========================================================================
- void wxVtkSceneManager::createGPort(int portType, int posInBox,GBlackBoxModel *blackBox)
+ void wxVtkSceneManager::createGPort(int portType,std::string bbtkName, std::string bbtkType, int posInBox,GBlackBoxModel *blackBox)
{
int type = GPORT;
model->registerInBox(blackBox,portType, posInBox);
blackBox->addOutputPort(model);
+ model->setBBTKType(bbtkType);
+ model->setBBTKName(bbtkName);
+
model->addObserver(view);
model->addObserver(this);
}
//=========================================================================
- bool wxVtkSceneManager::OnMouseMove()
- {
- int X,Y;
- wxVTKRenderWindowInteractor *wxVTKiren;
- wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
- wxVTKiren->GetEventPosition(X,Y);
-
- if(_worldState == DRAG_OBJECTS)
- {
- for (int i=0; i<_selectedObjects.size(); i++)
- {
- int id = _selectedObjects[i];
- GObjectController* cont = _controllers[id];
- if(_startDragging)
- {
- cont->getView()->setStartDragging(true);
- }
- cont->getView()->moveObject(X,Y);
- cont->getView()->setState(DRAG);
- cont->getModel()->notifyObservers(_idManager);
- }
-
- std::map<int, GObjectController*>::iterator it;
-
- for(it = _controllers.begin(); it != _controllers.end(); ++it)
- {
- GObjectController *desc = it->second;
- if(desc->getGObjectType()==GCONNECTOR)
- {
- GConnectorView* vconn = (GConnectorView*)desc->getView();
- vconn->updateStartEndPoints();
- }
- }
-
- _startDragging=false;
-
- }
- else if(_worldState == NOTHING_HAPPENS)
- {
- std::map<int, GObjectController*>::iterator it;
-
- for(it = _controllers.begin(); it != _controllers.end(); ++it)
- {
- GObjectController *desc = it->second;
- if(desc->getGObjectType()==GBLACKBOX && desc->getView()->getState() == HIGHLIGHTED)
- {
- GBlackBoxModel *mod = (GBlackBoxModel*)desc->getModel();
- _parent->displayBlackBoxInfo(mod->getBBTKPackage(),mod->getBBTKType());
- }
- }
- }
-
-
- return true;
- }
-
- //=========================================================================
-
void wxVtkSceneManager::update(int idController,int command)
{
if(command != NO_COMMAND)
//=========================================================================
+ bool wxVtkSceneManager::OnMouseMove()
+ {
+ int X,Y;
+ wxVTKRenderWindowInteractor *wxVTKiren;
+ wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetWxVTKRenderWindowInteractor();
+ wxVTKiren->GetEventPosition(X,Y);
+
+
+ if(_worldState == DRAG_OBJECTS)
+ {
+ for (int i=0; i<_selectedObjects.size(); i++)
+ {
+ int id = _selectedObjects[i];
+ GObjectController* cont = _controllers[id];
+ if(_startDragging)
+ {
+ cont->getView()->setStartDragging(true);
+ }
+ cont->getView()->moveObject(X,Y);
+ cont->getView()->setState(DRAG);
+ cont->getModel()->notifyObservers(_idManager);
+ }
+
+ std::map<int, GObjectController*>::iterator it;
+
+ for(it = _controllers.begin(); it != _controllers.end(); ++it)
+ {
+ GObjectController *desc = it->second;
+ if(desc->getGObjectType()==GCONNECTOR)
+ {
+ GConnectorView* vconn = (GConnectorView*)desc->getView();
+ vconn->updateStartEndPoints();
+ }
+ }
+
+ _startDragging=false;
+
+ }
+ else if(_worldState == NOTHING_HAPPENS || _worldState == INIT_CREATION_CONTOUR)
+ {
+ std::map<int, GObjectController*>::iterator it;
+
+ for(it = _controllers.begin(); it != _controllers.end(); ++it)
+ {
+ GObjectController *desc = it->second;
+ int type = desc->getGObjectType();
+ int state = desc->getView()->getState();
+
+ if(state == HIGHLIGHTED){
+
+ updateStatusBar(desc->getStatusText());
+ if(type==GBLACKBOX)
+ {
+ GBlackBoxModel *mod = (GBlackBoxModel*)desc->getModel();
+ _parent->displayBlackBoxInfo(mod->getBBTKPackage(),mod->getBBTKType());
+ }
+ }
+ }
+ }
+
+
+
+
+ return true;
+ }
+
+ //=========================================================================
bool wxVtkSceneManager::OnLeftButtonDown()
{
_parent->displayBlackBoxInfo(packageName,boxName);
}
+ //=========================================================================
+
+ void wxVtkSceneManager::updateStatusBar(std::string textStatus)
+ {
+ _parent->updateStatusBar(textStatus);
+ }
+
+ //=========================================================================
+
} // EO namespace bbtk
// EOF