#include "wxVtkSceneManager.h"
+ #include <vtkPolygon.h>
+ #include <vtkUnstructuredGrid.h>
+
+
namespace bbtk
{
interactorstylebaseview->SetwxVtkBaseView(_baseView);
_baseView->GetRenderer()->GetActiveCamera()->ParallelProjectionOn();
- _baseView->GetRenderer()->ResetCamera(-100,100,-100,100,900,1000);
+ _baseView->GetRenderer()->ResetCamera(-100,100,-100,100,800,1100);
_baseView->GetRenderer()->SetBackground(0.9,0.9,0.9);
- _baseView->GetRenderer()->GradientBackgroundOff();
+ _baseView->GetRenderer()->GradientBackgroundOn();
_baseView->Refresh();
// Actos Port_Text
_textActor = vtkTextActor3D::New();
_textActor->SetPosition( -9999 , -9999 , 900 );
_textActor->SetInput( "<void>" );
- _textActor->GetTextProperty()->SetFontSize(80);
+ _textActor->GetTextProperty()->SetFontSize(60);
_textActor->GetTextProperty()->BoldOn();
_textActor->GetTextProperty()->SetColor(PORTTEXT_NH_R,PORTTEXT_NH_G,PORTTEXT_NH_B);
double xInic = 0;
double yInic = 0;
double zInic = 900;
- vtkCellArray *strip = vtkCellArray::New();
- vtkPolyData *pdFill = vtkPolyData::New();
+
+ vtkPolygon *aPolygon = vtkPolygon::New();
_fillObjectActor = vtkActor::New();
- _fillPolyMapper = vtkPolyDataMapper::New();
+
_pts = vtkPoints::New();
+//ups4 EED Borrame
+
+ double w=100,h=10,b=h/15,t=3;
+ _pts->SetNumberOfPoints(21);
+ _pts->InsertPoint(0, xInic+w*0.33-t/2 , yInic , zInic );
+ _pts->InsertPoint(1, xInic+w*0.33 , yInic-t , zInic );
+ _pts->InsertPoint(2, xInic+w*0.33+t/2 , yInic , zInic );
+ _pts->InsertPoint(3, xInic+w*0.33+t/2 , yInic , zInic );
+ _pts->InsertPoint(4, xInic+w-b*4 , yInic+b*0 , zInic );
+
+ _pts->InsertPoint( 5, xInic+w-b*4 , yInic+b*0 , zInic );
+ _pts->InsertPoint( 6, xInic+w-b*2 , yInic+b*1 , zInic );
+ _pts->InsertPoint( 7, xInic+w-b*1 , yInic+b*2 , zInic );
+ _pts->InsertPoint( 8, xInic+w-b*0 , yInic+b*4 , zInic );
+
+ _pts->InsertPoint( 9, xInic+w-b*0 , yInic+h-b*4 , zInic );
+ _pts->InsertPoint(10, xInic+w-b*1 , yInic+h-b*2 , zInic );
+ _pts->InsertPoint(11, xInic+w-b*2 , yInic+h-b*1 , zInic );
+ _pts->InsertPoint(12, xInic+w-b*4 , yInic+h-b*0 , zInic );
+
+ _pts->InsertPoint(13, xInic+b*4 , yInic+h-b*0 , zInic );
+ _pts->InsertPoint(14, xInic+b*2 , yInic+h-b*1 , zInic );
+ _pts->InsertPoint(15, xInic+b*1 , yInic+h-b*2 , zInic );
+ _pts->InsertPoint(16, xInic+b*0 , yInic+h-b*4 , zInic );
+
+ _pts->InsertPoint(17, xInic+b*0 , yInic+b*4 , zInic );
+ _pts->InsertPoint(18, xInic+b*1 , yInic+b*2 , zInic );
+ _pts->InsertPoint(19, xInic+b*2 , yInic+b*1 , zInic );
+ _pts->InsertPoint(20, xInic+b*4 , yInic+b*0 , zInic );
- _pts->SetNumberOfPoints(4);
- _pts->SetPoint(0, xInic , yInic , zInic );
- _pts->SetPoint(1, xInic+50 , yInic , zInic );
- _pts->SetPoint(2, xInic+50 , yInic+50 , zInic );
- _pts->SetPoint(3, xInic , yInic+50 , zInic );
- 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);
+ aPolygon->GetPointIds()->SetNumberOfIds(21);
+ for (int i=0;i<21; i++)
+ {
+ aPolygon->GetPointIds()->SetId(i, i);
+ }
+
+ vtkUnstructuredGrid *aPolygonGrid = vtkUnstructuredGrid::New();
+ aPolygonGrid->Allocate(1, 1);
+ aPolygonGrid->InsertNextCell(aPolygon->GetCellType(), aPolygon->GetPointIds());
+ aPolygonGrid->SetPoints(_pts);
+ _aPolygonMapper = vtkDataSetMapper::New();
+ _aPolygonMapper->SetInput(aPolygonGrid);
+ _fillObjectActor->SetMapper(_aPolygonMapper);
_fillObjectActor->GetProperty()->SetColor(PORTFILL_NH_R,PORTFILL_NH_G,PORTFILL_NH_B);
- _fillPolyMapper->Modified();
+ _fillObjectActor->GetProperty()->SetOpacity(0);
+ _aPolygonMapper->Modified();
_baseView->GetRenderer()->AddActor( _fillObjectActor );
}
//z value is not important yet, because it is only used a parallel projection
double zz = 900;
-
+printf("EED wxVtkSceneManager::createGBlackBox 900-450\n");
_baseView->TransCoordScreenToWorld(xx,yy,zz);
model->setInicPoint(xx,yy,zz);
//z value is not important yet, because it is only used a parallel projection
double zz = 900;
+printf("EED wxVtkSceneManager::createGComplexBoxInputPort 900-450\n");
_baseView->TransCoordScreenToWorld(xx,yy,zz);
model->setInicPoint(xx,yy,zz);
//Create the MVC Objects
- GComplexBoxPortModel *model = (GComplexBoxPortModel*)GObjectsMVCFactory::getInstance()->createGObjectModel(type);
- vtkGObjectView *view = GObjectsMVCFactory::getInstance()->createGObjectView(type);
- GObjectController* controller = GObjectsMVCFactory::getInstance()->createGObjectController(type);
+ GComplexBoxPortModel *model = (GComplexBoxPortModel*)GObjectsMVCFactory::getInstance()->createGObjectModel(type);
+ vtkGObjectView *view = GObjectsMVCFactory::getInstance()->createGObjectView(type);
+ GObjectController *controller = GObjectsMVCFactory::getInstance()->createGObjectController(type);
//Prepares the initial model
//z value is not important yet, because it is only used a parallel projection
double zz = 900;
+
+printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n");
_baseView->TransCoordScreenToWorld(xx,yy,zz);
model->setInicPoint(xx,yy,zz);
{
// PortText
okPortMessage = true;
+ py=py+5;
_textActor->SetInput( desc->getStatusText().c_str() );
_textActor->SetScale(0.1);
- _textActor->SetPosition( px-25 ,py , pz+2 );
+ _textActor->SetPosition( px-25 ,py+1 , pz+2 );
+//ups4 EED Borrame
// FillPortText
- px=px-35;
- _pts->SetPoint(0, px , py , 900+1 );
- _pts->SetPoint(1, px+100, py , 900+1 );
- _pts->SetPoint(2, px+100, py+10 , 900+1 );
- _pts->SetPoint(3, px , py+10 , 900+1 );
- _fillPolyMapper->Modified();
-
+ px=px-33;
+ py=py;
+ _fillObjectActor->SetScale(1);
+ _fillObjectActor->GetProperty()->SetOpacity(0.50);
+ _fillObjectActor->SetPosition(px,py,1);
+ _aPolygonMapper->Modified();
} // if GPORT
} // for controllers it
}
}
-
if (okStatusMessage==false)
{
updateStatusBar("");
if (okPortMessage==false)
{
_textActor->SetScale(0.0001);
+ _fillObjectActor->SetScale(0.0001);
}
if(portmod->getPortType()==GINPUTPORT && portView->getState()==HIGHLIGHTED)
{
isOverPort=true;
- }
- }
- }
+ } // if
+ } // if
+ } // for
if(isOverPort==false)
{
desc->SetActive(true);
desc->getView()->setState(NOTHING_HAPPENS);
desc->getModel()->notifyObservers(_idManager);
- }
- }
- }
+ } // for
+ } // isOverPort
+ } // _worldState
if(_selectedObjects.size()!=0)
{
- _worldState = DRAG_OBJECTS;
- _startDragging = true;
+ _worldState = DRAG_OBJECTS;
+ _startDragging = true;
for (int i = 0; i < (int)_selectedObjects.size(); i++)
{
GObjectController* cont = _controllers[id];
cont->getView()->setState(DRAG);
cont->getModel()->notifyObservers(_idManager);
- }
- }
+ } // for
+ } // _selectedObjects
configGComBoxInputOutputPort(true, inputPortName,xIn,yIn,zIn);
-//ups 3 EED Borrame
-// int idInputPort = createGComplexBoxInputPort(inputPortName);
-// GObjectController *cont = _controllers[idInputPort];
-// GBoxModel *cbmod = (GBoxModel*)cont->getModel();
-// cbmod->setInicPoint(xIn,yIn,zIn);
-// cbmod->notifyObservers(_idManager);
-
} // for input complex box
getline(inputStream,line);//FIN_COMPLEX_PORT
configGComBoxInputOutputPort(false, outputPortName,xIn,yIn,zIn);
-
-//ups 3 EED Borrame
-// int idOutputPort = createGComplexBoxOutputPort(outputPortName);
-// GObjectController *cont = _controllers[idOutputPort];
-// GBoxModel *cbmod = (GBoxModel*)cont->getModel();
-// cbmod->setInicPoint(xIn,yIn,zIn);
-// cbmod->notifyObservers(_idManager);
-
+
} // for output complex box
} // complex box
GObjectController *cont = _controllers[idBox];
GBlackBoxModel *bbmod = (GBlackBoxModel*)cont->getModel();
+
-
-//ups2 eed
-// GObjectController *cont = _controllers[idBox];
-// GBlackBoxModel *bbmod = (GBlackBoxModel*)cont->getModel();
-// bbmod->setBBTKName(name);
-// bbmod->setInicPoint(xIn,yIn,zIn);
-// bbmod->setFinalPoint(xEn,yEn,zEn);
-// bbmod->setExecutable(boxExecutable);
-
-
//----------
getline(inputStream,line);//PORT o FIN_BOX
std::string port=line.substr(0,4);
std::string nameEndPort(result);
configGConnetion(nameStartBox, nameStartPort, nameEndBox, nameEndPort);
-//ups 3 EED Borrame
-/*
- std::vector<int> lstB = getBlackBoxes();
- GPortModel *startP = NULL;
- GPortModel *endP = NULL;
- int j;
- for(j = 0;j<lstB.size();j++)
- {
- int idB = lstB[j];
- GBlackBoxModel *bbMod = (GBlackBoxModel*)_controllers[idB]->getModel();
- if(_controllers[idB]->getModel()->getBBTKName()==nameStartBox)
- {
- startP = bbMod->getOutputPort(nameStartPort);
- }
- else if(_controllers[idB]->getModel()->getBBTKName()==nameEndBox)
- {
- endP = bbMod->getInputPort(nameEndPort);
- }
- } // for
-
- if(_isComplexBox)
- {
- if(startP==NULL)
- {
- std::vector<int> lstInputs = getComplexInputPorts();
- for(j = 0;j<lstInputs.size();j++)
- {
- int idB = lstInputs[j];
- GBoxModel *cbMod = (GBoxModel*)_controllers[idB]->getModel();
- if(_controllers[idB]->getModel()->getBBTKName()==nameStartBox)
- {
- startP = cbMod->getOutputPort(nameStartPort);
- } // if
- } // for
- } // if
-
- if(endP==NULL)
- {
- std::vector<int> lstOutputs = getComplexOutputPorts();
- for(j = 0;j<lstOutputs.size();j++)
- {
- int idB = lstOutputs[j];
- GBoxModel *cbMod = (GBoxModel*)_controllers[idB]->getModel();
- if(_controllers[idB]->getModel()->getBBTKName()==nameEndBox)
- {
- endP = cbMod->getInputPort(nameEndPort);
- } // if
- } // for
- } // if endP
- } // complex box
-
- int idCon = createGConnector(startP);
- _worldState = NOTHING_HAPPENS;
- GConnectorController *tempp = (GConnectorController*)_controllers[idCon];
-
- GConnectorModel *conMod = (GConnectorModel*)tempp->getModel();
- vtkGConnectorView *conView = (vtkGConnectorView*)tempp->getView();
- tempp->endContourCreation();
- conMod->setEndPort(endP);
- conView->updateStartEndPoints();
- */
} // for numConns
} // start
printf("EED wxVtkSceneManager::configGConnetion 2 %p %p \n", startP, endP );
-/*ups5 EED Borrame
- std::vector<int> lstB = getBlackBoxes();
- int j;
- for(j = 0;j<(int)lstB.size();j++)
- {
- int idB = lstB[j];
- GBlackBoxModel *bbMod = (GBlackBoxModel*)_controllers[idB]->getModel();
- if(_controllers[idB]->getModel()->getBBTKName()==nameStartBox)
- {
- startP = bbMod->getOutputPort(nameStartPort);
- }
- else if(_controllers[idB]->getModel()->getBBTKName()==nameEndBox)
- {
- endP = bbMod->getInputPort(nameEndPort);
- }
- } // for
-
- if(_isComplexBox)
- {
- if(startP==NULL)
- {
- std::vector<int> lstInputs = getComplexInputPorts();
- for(j = 0;j<(int)lstInputs.size();j++)
- {
- int idB = lstInputs[j];
- GBoxModel *cbMod = (GBoxModel*)_controllers[idB]->getModel();
- if(_controllers[idB]->getModel()->getBBTKName()==nameStartBox)
- {
- startP = cbMod->getOutputPort(nameStartPort);
- } // if
- } // for
- } // if
-
- if(endP==NULL)
- {
- std::vector<int> lstOutputs = getComplexOutputPorts();
- for(j = 0;j<(int)lstOutputs.size();j++)
- {
- int idB = lstOutputs[j];
- GBoxModel *cbMod = (GBoxModel*)_controllers[idB]->getModel();
- if(_controllers[idB]->getModel()->getBBTKName()==nameEndBox)
- {
- endP = cbMod->getInputPort(nameEndPort);
- } // if
- } // for
- } // if endP
- } // complex box
- */
int idCon = createGConnector(startP);
_worldState = NOTHING_HAPPENS;