wxBitmap bmp_run(run_xpm);
wxBitmap bmp_delete(delete_xpm);
wxBitmap bmp_centerview(centerview_xpm);
+ wxBitmap bmp_box(box_xpm);
wxBitmap bmp_complexbox(complexbox_xpm);
wxBitmap bmp_complexinputport(complexinputport_xpm);
wxBitmap bmp_complexoutputport(complexoutputport_xpm);
toolbar->AddTool(ID_DELETEALL,_T("Delete all"),bmp_delete, wxNullBitmap, wxITEM_NORMAL,_T("Delete all boxes"), _T("Delete all boxes"));
toolbar->AddTool(ID_CENTERVIEW,_T("Center view"),bmp_centerview, wxNullBitmap, wxITEM_NORMAL,_T("Center view"), _T("Center view"));
toolbar->AddSeparator();
+ toolbar->AddTool(ID_BTNBOX,_T("New Box"),bmp_box, wxNullBitmap, wxITEM_NORMAL,_T("New Box"), _T("Nex Box"));
+ toolbar->AddSeparator();
toolbar->AddTool(ID_BTNCOMPLEXBOX,_T("Complex box"),complexbox_xpm, wxNullBitmap, wxITEM_NORMAL,_T("Complex box"), _T("Complex box"));
toolbar->SetToggle(ID_BTNCOMPLEXBOX,true);
toolbar->AddTool(ID_ADDCOMPLEXBOXINPUT,_T("Add input to Complex box"),bmp_complexinputport, wxNullBitmap, wxITEM_NORMAL,_T("Add input to Complex box"), _T("Add input to Complex box"));
Connect(ID_RUN,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnExecuteActualDiagram));
Connect(ID_DELETEALL,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnDeleteAllBoxesActualDiagram));
Connect(ID_CENTERVIEW,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnCenterViewActualDiagram));
+ Connect(ID_BTNBOX,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnClickBtnBox));
Connect(ID_BTNCOMPLEXBOX,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnClickBtnComplexBox));
Connect(ID_ADDCOMPLEXBOXINPUT,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnAddComplexBoxInput));
Connect(ID_ADDCOMPLEXBOXOUTPUT,wxEVT_COMMAND_TOOL_CLICKED,wxCommandEventHandler(wxGUIEditorGraphicBBS::OnAddComplexBoxOutput));
if (openFileDialog->ShowModal() == wxID_OK)
{
wxString fileName = openFileDialog->GetPath( );
-printf("EED wxGUIEditorGraphicBBS::OnOpenBBS file=%s\n", (const char*) (fileName.mb_str()) );
_tabsMgr->addNewTab();
-
-// bbtk::EExecuterBBSG::Pointer exe = bbtk::EExecuterBBSG::New( this->_tabsMgr->getActualTabPanel()->getSceneManager() , _pkgBrowser->GetFactory() );
bbtk::InterpreterBBS::Pointer I = bbtk::InterpreterBBS::New( this->_tabsMgr->getActualTabPanel()->getSceneManager() , _pkgBrowser->GetFactory());
// We tell the interpreter to throw exceptions on error
}
//=========================================================================
+
+
+ void wxGUIEditorGraphicBBS::OnClickBtnBox(wxCommandEvent& event)
+ {
+ BlackBoxDescriptor *bbDes = _pkgBrowser->GetActualSelected();
+ std::string typeName = bbDes->GetTypeName();
+ std::string packageName = bbDes->GetPackage()->GetName();
+ this->_tabsMgr->getActualTabPanel()->getSceneManager()->createGBlackBox(50,50,packageName, typeName);
+
+
+ printf("EED wxGUIEditorGraphicBBS::OnClickBtnBox \n");
+ refreshGUIControls();
+ }
+
+ //=========================================================================
+
+
void wxGUIEditorGraphicBBS::OnClickBtnComplexBox(wxCommandEvent& event)
{
wxToolBar* toolbar = GetToolBar();
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
_aPolygonMapper->SetInput(aPolygonGrid);
_fillObjectActor->SetMapper(_aPolygonMapper);
_fillObjectActor->GetProperty()->SetColor(PORTFILL_NH_R,PORTFILL_NH_G,PORTFILL_NH_B);
+ _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);
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);
-//ups3 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;