void GBoxModel::setInicPoint(double& x, double& y, double& z)
{
GObjectModel::setInicPoint(x,y,z);
-
double xFin=x+BOX_WIDTH,yFin=y-BOX_HEIGHT;
setFinalPoint(xFin,yFin,z);
}
updatePorts();
+
+// update position for one Actor that represents all InputPorts
+ GPortModel *portModel;
+ GBoxModel *boxModel =(GBoxModel*)_model;
+ int numberOfTriangles = boxModel->getNumInputPorts();
+ for (int i=0;i<numberOfTriangles;i++)
+ {
+ portModel= boxModel->getInputPort(i);
+ portModel->getInicPoint( xInic , yInic , zInic ) ;
+ portModel->getFinalPoint( xFin , yFin , zFin ) ;
+ // RaC In the actual version, zInic=zFin=GPOSITION_Z
+ _TrianglesInputsPts->SetPoint(i*3+0, xInic , yInic , zInic );
+ _TrianglesInputsPts->SetPoint(i*3+1, ( xInic + xFin ) / 2 , yFin , zInic );
+ _TrianglesInputsPts->SetPoint(i*3+2, xFin , yInic , zFin );
+ }
+ _TrianglesInputsPolyMapper->Modified( ) ;
+
+// update position for one Actor that represents all OutputPorts
+ numberOfTriangles = boxModel->getNumOutputPorts();
+ for (int i=0;i<numberOfTriangles;i++)
+ {
+ portModel= boxModel->getOutputPort(i);
+ portModel->getInicPoint( xInic , yInic , zInic ) ;
+ portModel->getFinalPoint( xFin , yFin , zFin ) ;
+ // RaC In the actual version, zInic=zFin=GPOSITION_Z
+ _TrianglesOutputsPts->SetPoint(i*3+0, xInic , yInic , zInic );
+ _TrianglesOutputsPts->SetPoint(i*3+1, ( xInic + xFin ) / 2 , yFin , zInic );
+ _TrianglesOutputsPts->SetPoint(i*3+2, xFin , yInic , zFin );
+ }
+ _TrianglesOutputsPolyMapper->Modified( ) ;
+
+
+
+// update position for one Actor that represents all OutputPorts
+
+
_borderPolyMapper->Modified();
_fillPolyMapper->Modified();
//-----------
///************************* FILL *************************
-
vtkCellArray *strip = vtkCellArray::New();
vtkPolyData *pdFill = vtkPolyData::New();
_fillPolyMapper = vtkPolyDataMapper::New();
_fillObjectActor = vtkActor::New();
-
// RaC In the actual version, zInic=zFin=GPOSITION_Z
-
strip->InsertNextCell(5);
strip->InsertCellPoint(0);
strip->InsertCellPoint(1);
strip->InsertCellPoint(2);
strip->InsertCellPoint(0);
strip->InsertCellPoint(3);
-
pdFill->SetPoints( _pts );
pdFill->SetStrips( strip );
-
_fillPolyMapper->SetInput(pdFill);
_fillObjectActor->SetMapper(_fillPolyMapper);
_fillPolyMapper->Modified();
-
///************************* FILL *************************
+
+//EED2017
+ ///************************* Inputs Fill (triangles) *************************
+ GBoxModel* boxModel =(GBoxModel*)_model;
+ int numberOfTriangles = boxModel->getNumInputPorts();
+ _TrianglesInputsPts = vtkPoints::New();
+ _TrianglesInputsPts->SetNumberOfPoints( 3*numberOfTriangles );
+ vtkCellArray *stripTrianglesInputs = vtkCellArray::New();
+ vtkPolyData *pdTrianglesInputs = vtkPolyData::New();
+ _TrianglesInputsPolyMapper = vtkPolyDataMapper::New();
+ _TrianglesInputsActor = vtkActor::New();
+ // RaC In the actual version, zInic=zFin=GPOSITION_Z
+ for (int i=0 ; i<numberOfTriangles; i++)
+ {
+ stripTrianglesInputs->InsertNextCell( 3 );
+ stripTrianglesInputs->InsertCellPoint(i*3+0);
+ stripTrianglesInputs->InsertCellPoint(i*3+1);
+ stripTrianglesInputs->InsertCellPoint(i*3+2);
+ }
+ pdTrianglesInputs->SetPoints( _TrianglesInputsPts );
+ pdTrianglesInputs->SetStrips( stripTrianglesInputs );
+ _TrianglesInputsPolyMapper->SetInput( pdTrianglesInputs );
+ _TrianglesInputsActor->SetMapper(_TrianglesInputsPolyMapper);
+ _TrianglesInputsPolyMapper->Modified();
+ ///************************* Inputs Fill (triangles) *************************
+
+ ///************************* Outputs Fill (triangles) *************************
+// GBoxModel* boxModel =(GBoxModel*)_model;
+ numberOfTriangles = boxModel->getNumOutputPorts();
+ _TrianglesOutputsPts = vtkPoints::New();
+ _TrianglesOutputsPts->SetNumberOfPoints( 3*numberOfTriangles );
+ vtkCellArray *stripTrianglesOutputs = vtkCellArray::New();
+ vtkPolyData *pdTrianglesOutputs = vtkPolyData::New();
+ _TrianglesOutputsPolyMapper = vtkPolyDataMapper::New();
+ _TrianglesOutputsActor = vtkActor::New();
+ // RaC In the actual version, zInic=zFin=GPOSITION_Z
+ for (int i=0 ; i<numberOfTriangles; i++)
+ {
+ stripTrianglesOutputs->InsertNextCell( 3 );
+ stripTrianglesOutputs->InsertCellPoint(i*3+0);
+ stripTrianglesOutputs->InsertCellPoint(i*3+1);
+ stripTrianglesOutputs->InsertCellPoint(i*3+2);
+ }
+ pdTrianglesOutputs->SetPoints( _TrianglesOutputsPts );
+ pdTrianglesOutputs->SetStrips( stripTrianglesOutputs );
+ _TrianglesOutputsPolyMapper->SetInput( pdTrianglesOutputs );
+ _TrianglesOutputsActor->SetMapper(_TrianglesOutputsPolyMapper);
+ _TrianglesOutputsPolyMapper->Modified();
+ ///************************* Inputs Fill (triangles) *************************
+
+
+
//------------
- _boxTextActor = vtkTextActor3D::New();
- vtkTextProperty *prop = vtkTextProperty::New();
+ _boxTextActor = vtkTextActor3D::New();
+ vtkTextProperty *prop = vtkTextProperty::New();
prop->BoldOn();
prop->SetFontFamilyToArial();
_boxTextActor->GetTextProperty()->BoldOn();
_baseView->GetRenderer()->AddActor(_borderObjectActor);
vtkGObjectView::addVtkActors();
_baseView->GetRenderer()->AddActor(_boxTextActor);
+
+ _baseView->GetRenderer()->AddActor(_TrianglesInputsActor);
+ _baseView->GetRenderer()->AddActor(_TrianglesOutputsActor);
+
+
}
//=========================================================================
void vtkGBlackBoxView::removeVtkActors()//virtual
{
- _baseView->GetRenderer()->RemoveActor(_borderObjectActor);
_baseView->GetRenderer()->RemoveActor(_boxTextActor);
+ _baseView->GetRenderer()->RemoveActor(_borderObjectActor);
+ _baseView->GetRenderer()->RemoveActor(_TrianglesInputsActor);
+ _baseView->GetRenderer()->RemoveActor(_TrianglesOutputsActor);
vtkGObjectView::removeVtkActors();
}
private:
//Private Attributes
- vtkTextActor3D* _boxTextActor;
+ vtkTextActor3D *_boxTextActor;
+
+ // Input Triangles
+ vtkPoints *_TrianglesInputsPts;
+ vtkPolyDataMapper *_TrianglesInputsPolyMapper;
+ vtkActor *_TrianglesInputsActor;
+
+ // Output Triangles
+ vtkPoints *_TrianglesOutputsPts;
+ vtkPolyDataMapper *_TrianglesOutputsPolyMapper;
+ vtkActor *_TrianglesOutputsActor;
+
//Private Methods
void updatePositionTextActor(double xInic, double yInic, double zInic);
void vtkGObjectView::addVtkActors()//virtual
{
_baseView->GetRenderer()->AddActor(_fillObjectActor);
- _baseView->GetRenderer()->Render();
+//EED2017 _baseView->GetRenderer()->Render();
}
//=========================================================================
void vtkGObjectView::removeVtkActors()//virtual
{
_baseView->GetRenderer()->RemoveActor(_fillObjectActor);
- _baseView->GetRenderer()->Render();
+//EED2017 _baseView->GetRenderer()->Render();
}
//=========================================================================
virtual void removeFromScene();
virtual void update(int idController,int command);
+
+//protected
+ virtual void createVtkObjects();
+ virtual void addVtkActors();
+
private:
int _state;
//Protected Methods
- virtual void createVtkObjects();
- virtual void addVtkActors();
virtual void removeVtkActors();
virtual void updateColors();
};
//=========================================================================
- void vtkGPortView::update( int idController , int command ) {
-
+ void vtkGPortView::update( int idController , int command )
+{
updateColors( ) ;
double xInic , yInic , zInic , xFin , yFin , zFin ;
-
_model->getInicPoint( xInic , yInic , zInic ) ;
_model->getFinalPoint( xFin , yFin , zFin ) ;
-
// RaC In the actual version, zInic=zFin=GPOSITION_Z
-
double mid = ( xInic + xFin ) / 2 ;
-
_pts->SetPoint( 0 , xInic , yInic , zInic ) ;
_pts->SetPoint( 1 , mid , yFin , zInic ) ;
_pts->SetPoint( 2 , xFin , yInic , zFin ) ;
-
_fillPolyMapper->Modified( ) ;
-
//-----------
setRefreshWaiting( ) ;
}
void vtkGPortView::createVtkObjects( ) //virtual
{
- _pts = vtkPoints::New( ) ;
- _pts->SetNumberOfPoints( 3 ) ;
double xInic , yInic , zInic , xFin , yFin , zFin ;
//EED _pts->SetPoint(1, mid, yFin, zInic );
//EED _pts->SetPoint(2, xFin, yInic, zFin );
+ _pts = vtkPoints::New( ) ;
+ _pts->SetNumberOfPoints( 3 ) ;
+
_pts->SetPoint( 0 , -1000 , -1000 , -1000 ) ;
_pts->SetPoint( 1 , mid , yFin , zInic ) ;
_pts->SetPoint( 2 , 1000 , 1000 , 1000 ) ;
}
_tabsMgr->addNewTab( crea::std2wx(fileName) );
_tabsMgr->loadDiagram(inputStream, filePathName);
+
_tabsMgr->saveTempActualDiagram("load diagram");
GetToolBar()->EnableTool(ID_UNDO, false);
GetToolBar()->EnableTool(ID_UNDO, false);
//EED 15 oct 2012 BlackBoxDescriptor::Pointer descriptor = GObjectsMVCFactory::getInstance()->getBlackBoxDescriptor(packageName, boxType);
+
Package::Pointer k;
std::map< std::string, BlackBoxDescriptor::Pointer> mapDesc;
try{
std::map<std::string, BlackBoxInputDescriptor*> descriptorInMap =
descriptor->GetInputDescriptorMap();
std::map<std::string, BlackBoxInputDescriptor*>::iterator itInput;
-
int i = 0;
for (itInput = descriptorInMap.begin(); itInput != descriptorInMap.end(); ++itInput) {
BlackBoxInputDescriptor *desc = itInput->second;
std::map<std::string, BlackBoxOutputDescriptor*> descriptorOutMap =
descriptor->GetOutputDescriptorMap();
std::map<std::string, BlackBoxOutputDescriptor*>::iterator itOutput;
-
i = 0;
for (itOutput = descriptorOutMap.begin(); itOutput
!= descriptorOutMap.end(); ++itOutput) {
//(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
//(NOTE: Refresh is only made by the view)
view->setModel(model);
view->setBaseView(_baseView);
- view->initVtkObjects();
+
+//EED017 view->initVtkObjects();
+ view->createVtkObjects();
+// view->addVtkActors();
+
//Associates the controller with the correspondent model and view
controller->setModelAndView(model, view);
addObjectController(controller);
return (GPortController*) controller;
+
}
//=========================================================================
* JGRR AND CM
* Width increased from 2 to 3, it simplifies line handling and spline control :P
* @param WidthLine
- */
+ */
+ //EED2017
manContourView->SetWidthLine( 3 ) ;
manContourView->SetShowText(false);
std::istringstream is(result);
is >> numBoxes;
- for (int i = 0; i < numBoxes; i++) {
+ for (int i = 0; i < numBoxes; i++)
+ {
//----------
getCleanLine(inputStream, line);//BOX
getCleanLine(inputStream, line);//package:type:name
bool boxExecutable = false;
- if (isExec == "TRUE") {
+ if (isExec == "TRUE")
+ {
boxExecutable = true;
}
isCons >> numConns;
- for (int i = 0; i < numConns; i++) {
+ for (int i = 0; i < numConns; i++)
+ {
//----------
getCleanLine(inputStream, line);//CONNECTION
getCleanLine(inputStream, line);//Startbox.PortName:EndBox.PortName
result = strtok(NULL, delims);
std::string nameEndPort(result);
-
int idCon = configGConnetion(nameStartBox, nameStartPort,nameEndBox, nameEndPort);
if (version != "1.0") {
virtual bool OnLeftButtonUp();
virtual bool OnRightButtonUp();
virtual bool OnLeftDClick();
- virtual bool OnMiddleButtonDown(); ///JLGR 21-05-2012
- virtual bool OnMiddleButtonUp(); ///JLGR 21-05-2012
+ virtual bool OnMiddleButtonDown(); ///JLGR 21-05-2012
+ virtual bool OnMiddleButtonUp(); ///JLGR 21-05-2012
//-------
int createGBlackBox(int x, int y, std::string packageName, std::string boxType );
//Add a map of object controllers
void addObjects(std::map<int,GObjectController*> objectsMap);
- /// Duplicates Objects to current a diagram
- void DuplicateObjects(std::map<int,GObjectController*> objectsMap);///JLGR 21-05-2012
+ /// Duplicates Objects to current a diagram
+ void DuplicateObjects(std::map<int,GObjectController*> objectsMap);///JLGR 21-05-2012
//-------
// Makes a BlackBox Executable
std::string _Author;
std::string _Category;
std::string _Description;
- std::string _MessageKind;
- std::string _MessageLevel;
+ std::string _MessageKind;
+ std::string _MessageLevel;
//wxPanel that uses the manager
wxGEditorTabPanel *_parent;
int _contLastId;
vtkTextActor3D *_textActor;
- std::string _bugTextActor_text;
- int _bugTextActor_status;
+ std::string _bugTextActor_text;
+ int _bugTextActor_status;
- vtkPoints *_pts;
- vtkActor *_fillObjectActor;
+ vtkPoints *_pts;
+ vtkActor *_fillObjectActor;
vtkDataSetMapper *_aPolygonMapper;
Factory::Pointer _bbtkfactory;