//=========================================================================
+ std::vector<GPortModel*> GBlackBoxModel::getInputPorts()
+ {
+ return _inputs;
+ }
+
+ //=========================================================================
+
+ std::vector<GPortModel*> GBlackBoxModel::getOutputPorts()
+ {
+ return _outputs;
+ }
+
+ //=========================================================================
+
+
} // EO namespace bbtk
bool isExecutable();
void setExecutable(bool executable);
+ std::vector<GPortModel*> getInputPorts();
+ std::vector<GPortModel*> getOutputPorts();
+
private:
//Private Attributes
//=========================================================================
+ int GObjectModel::getObjectId()
+ {
+ return _objectId;
+ }
+
+ //=========================================================================
+
+ void GObjectModel::setObjectId(int id)
+ {
+ _objectId=id;
+ }
+
} // EO namespace bbtk
std::string getBBTKName();
void setBBTKName(std::string obname);
+ int getObjectId();
+ void setObjectId(int id);
+
virtual std::string getStatusText();
private:
double _zFin;
int _gObjectType;
+ int _objectId;
std::string _bbtkType;
std::string _bbtkName;
//The coordinates obtained are the following. Top-Left:x=0,y=0 Bottom-Right:x=width,y=height
double xx = x;
- double yy = windowHeight-y;
+ double yy = windowHeight-y;
//z value is not important yet, because it is only used a parallel projection
double zz = 900;
//=========================================================================
+ void wxVtkSceneManager::unregisterController(InteractorStyleMaracas *param)
+ {
+ vtkInteractorStyleBaseView* baseViewControlManager = (vtkInteractorStyleBaseView*)_baseView->GetInteractorStyleBaseView();
+ baseViewControlManager->RemoveInteractorStyleMaracas( param );
+ }
+
+ //=========================================================================
+
vtkRenderer* wxVtkSceneManager::getRenderer()
{
return _baseView->GetRenderer();
//=========================================================================
+ bool wxVtkSceneManager::OnChar()
+ {
+ char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode();
+
+ // KeyCode 127 : Delete Key
+ // KeyCode 8 : Backspace Key
+ if(keyCode == 8 || keyCode == 127)
+ {
+ if(_selectedObjects.size()>0)
+ {
+ for(int i=0;i<_selectedObjects.size();i++)
+ {
+ int id = _selectedObjects[i];
+ removeObject(id);
+ }
+ _selectedObjects.clear();
+ }
+ }
+
+ return true;
+ }
+
+ //=========================================================================
+
+ void wxVtkSceneManager::removeObject(int id)
+ {
+ GObjectController *control = _controllers[id];
+ std::vector<int> controllersToRemove;
+
+ if(control->getGObjectType()==GBLACKBOX)
+ {
+ GBlackBoxModel *bbmod = (GBlackBoxModel*)control->getModel();
+ std::vector<GPortModel*>inputs = bbmod->getInputPorts();
+
+ for(int i = 0;i<inputs.size();i++)
+ {
+ controllersToRemove.push_back(inputs[i]->getObjectId());
+ }
+
+ std::vector<GPortModel*>outputs = bbmod->getOutputPorts();
+
+ for(int i = 0;i<outputs.size();i++)
+ {
+ controllersToRemove.push_back(outputs[i]->getObjectId());
+ }
+
+ controllersToRemove.push_back(control->getId());
+ }
+
+ for(int i = 0;i<controllersToRemove.size();i++)
+ {
+ int id = controllersToRemove[i];
+ GObjectController *cont = _controllers[id];
+ cont->removeFromScene();
+ unregisterController((InteractorStyleMaracas*)cont);
+ _controllers.erase(id);
+ }
+
+
+ }
+
+ //=========================================================================
+
void wxVtkSceneManager::displayBlackBoxInfo(std::string packageName, std::string boxName)
{
_parent->displayBlackBoxInfo(packageName,boxName);
void createGConnector(GPortModel* startPort);
void registerController(InteractorStyleMaracas *param);
+ void unregisterController(InteractorStyleMaracas *param);
vtkRenderWindow* getRenderWindow();
vtkRenderer* getRenderer();
void disconnectDrop();
+ virtual bool OnChar();
virtual bool OnMouseMove();
virtual bool OnLeftButtonDown();
virtual bool OnLeftButtonUp();
void displayBlackBoxInfo(std::string packageName, std::string boxName);
void updateStatusBar(std::string textStatus);
std::string getDiagramScript();
+ void removeObject(int id);
private:
}
}
- _model->notifyObservers(_id);
+ _model->notifyObservers(getId());
}
return true;
{
_isLeftClickDown=true;
_view->setState(SELECTED);
- _model->notifyObservers(_id,ADD_TO_SELECTED);
+ _model->notifyObservers(getId(),ADD_TO_SELECTED);
}
return true;
{
// It is supposed that I'm always inside even if the box is in drag
_view->setState(SELECTED);
- _model->notifyObservers(_id);
+ _model->notifyObservers(getId());
}
}
return true;
GBlackBoxModel *bbmodel = (GBlackBoxModel*)_model;
_view->setState(HIGHLIGHTED);
bbmodel->setExecutable(true);
- bbmodel->notifyObservers(_id);
+ bbmodel->notifyObservers(getId());
}
return true;
}
}
- _model->notifyObservers(_id);
+ _model->notifyObservers(getId());
return true;
{
_isLeftClickDown=true;
_view->setState(SELECTED);
- //_model->notifyObservers(_id,
}
return true;
}
int GObjectController::getId()
{
- return _id;
+ return _model->getObjectId();
}
//=========================================================================
void GObjectController::setId(int id)
{
- _id = id;
+ _model->setObjectId(id);
}
//=========================================================================
//=========================================================================
+ void GObjectController::removeFromScene()
+ {
+ _view->removeFromScene();
+ }
+
+ //=========================================================================
+
} // EO namespace bbtk
// EOF
int getId();
void setId(int id);
+
+ void removeFromScene();
private:
//Protected Attributes
GObjectModel* _model;
vtkGObjectView* _view;
- int _id;
bool _isLeftClickDown;
//Protected Methods
//Evaluate new state
if(portType==GOUTPUTPORT)
{
- _model->notifyObservers(_id,INIT_CREATION_CONTOUR);
+ _model->notifyObservers(getId(),INIT_CREATION_CONTOUR);
}
else if (portType==GINPUTPORT)
{
- _model->notifyObservers(_id,FIN_CREATION_CONTOUR);
+ _model->notifyObservers(getId(),FIN_CREATION_CONTOUR);
}
}
else
{
_manContModel->MovePoint(0,start[0],start[1],start[2]);
_manContModel->MovePoint(_manContModel->GetSizeLstPoints()-1,end[0],end[1],end[2]);
-
+
Refresh();
}
//=========================================================================
+ void manualConnectorContourView::AddControlPoints()
+ {
+ vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
+ SetIfViewControlPoints( true );
+ if( _viewControlPoints )
+ {
+ int i,size=_lstViewPoints.size();
+ for (i=1;i<size-1; i++)
+ {
+ vtkActor * pointActor = _lstViewPoints[i]->GetVtkActor();
+ theRenderer->AddActor( pointActor );
+ }
+ }
+ }
+ //=========================================================================
+
} // EO namespace bbtk
//Public methods
virtual void TransfromCoordViewWorld(double &X, double &Y, double &Z, int type=2);
void updateStartAndEnd(double* start , double* end);
+ virtual void AddControlPoints();
private:
//=========================================================================
+ void vtkGBlackBoxView::removeVtkActors()//virtual
+ {
+ _baseView->GetRenderer()->RemoveActor(_nameActor);
+ _baseView->GetRenderer()->RemoveActor(_typeActor);
+ vtkGObjectView::removeVtkActors();
+ }
+
+ //=========================================================================
+
void vtkGBlackBoxView::updatePositionTextActors(double xInic, double yInic, double zInic)
{
_nameActor->SetPosition(xInic+4,yInic-5,zInic);
//Protected Methods
virtual void addVtkActors();
+ virtual void removeVtkActors();
virtual void createVtkObjects();
virtual void update(int idController,int command);
virtual void updateColors();
//=========================================================================
+ void vtkGObjectView::removeVtkActors()//virtual
+ {
+ _baseView->GetRenderer()->RemoveActor(_borderObjectActor);
+ _baseView->GetRenderer()->RemoveActor(_fillObjectActor);
+ _baseView->GetRenderer()->Render();
+ }
+
+ //=========================================================================
+
bool vtkGObjectView::isPointInside(int X,int Y) //virtual
{
// RaC In the actual version, always z=900
}
//=========================================================================
+
+ void vtkGObjectView::removeFromScene()
+ {
+ removeVtkActors();
+ setRefreshWaiting();
+ }
+
+ //=========================================================================
} // EO namespace bbtk
int getState();
void setRefreshWaiting();
+ virtual void removeFromScene();
+
private:
//Private Attributes
//Protected Methods
virtual void createVtkObjects();
virtual void addVtkActors();
+ virtual void removeVtkActors();
virtual void updateColors();
};