From: davila <> Date: Wed, 29 Sep 2010 21:18:28 +0000 (+0000) Subject: no message X-Git-Tag: v1_0_0~33 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=5cf9c7b92a97ee411e6a441beca8a06d2bffc8b3;p=bbtkGEditor.git no message --- diff --git a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h index 36fd776..f03d48d 100644 --- a/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h +++ b/lib/EditorGraphicBBS/bbsKernelEditorGraphic/GlobalConstants.h @@ -172,6 +172,8 @@ namespace bbtk const int ID_SAVE_AS_BBS = 1010; const int ID_SAVE_AS_COMPLEXBOX = 1011; const int ID_COPY_TO_COMPLEXDIAGRAM = 1012; + const int ID_BTNBOX = 1013; + const int wxID_NOTEBOOK = 1013; } diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBoxController.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBoxController.cxx index adb3bf0..bd3b652 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBoxController.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/GBoxController.cxx @@ -114,7 +114,6 @@ namespace bbtk wxVTKiren->GetEventPosition(X,Y); int state = _view->getState(); - //Evaluate new state if(_isLeftClickDown) { @@ -126,7 +125,7 @@ namespace bbtk _model->notifyObservers(getId()); } } - return true; + return true; } diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/InterpreterBBS.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/InterpreterBBS.cxx index 56a6a9b..c905626 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/InterpreterBBS.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/InterpreterBBS.cxx @@ -64,6 +64,8 @@ namespace bbtk _xGeneral = -100; _yGeneral = 100; _zGeneral = 900; // ????? +printf("EED InterpreterBBS::createGBlackBox 900-450\n"); + _countBoxes = 0; _countInputs = 0; _countOutputs = 0; diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx index f5027ed..c9c63b3 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx @@ -104,6 +104,7 @@ namespace bbtk 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); @@ -118,6 +119,8 @@ namespace bbtk 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")); @@ -136,6 +139,7 @@ namespace bbtk 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)); @@ -419,13 +423,10 @@ namespace bbtk 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 @@ -612,7 +613,24 @@ printf("EED wxGUIEditorGraphicBBS::OnOpenBBS file=%s\n", (const char*) (fileNam } //========================================================================= + + + 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(); diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h index 48bce9b..887b7c6 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.h @@ -56,6 +56,7 @@ #include "wxart_run.xpm" #include "wxart_delete.xpm" #include "wxart_centerview.xpm" +#include "wxart_box.xpm" #include "wxart_complexbox.xpm" #include "wxart_complexinputport.xpm" #include "wxart_complexoutputport.xpm" @@ -137,6 +138,7 @@ namespace bbtk void OnExecuteActualDiagram(wxCommandEvent& event); void OnDeleteAllBoxesActualDiagram(wxCommandEvent& event); void OnCenterViewActualDiagram(wxCommandEvent& event); + void OnClickBtnBox(wxCommandEvent& event); void OnClickBtnComplexBox(wxCommandEvent& event); void OnAddComplexBoxInput(wxCommandEvent& event); void OnAddComplexBoxOutput(wxCommandEvent& event); diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.cxx index 3cf0c06..db678ab 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxBlackBoxEditionDialog.cxx @@ -74,7 +74,7 @@ namespace bbtk std::vector lstInputs = _model->getInputPorts(); wxFlexGridSizer *sizer = new wxFlexGridSizer(lstInputs.size(),3,5,5); - for(int i = 0;igetBBTKType(); diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx index 5199260..66c468a 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx @@ -102,10 +102,10 @@ 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 @@ -174,6 +174,7 @@ namespace bbtk _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 ); @@ -249,7 +250,7 @@ namespace bbtk //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); @@ -335,6 +336,7 @@ namespace bbtk //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); @@ -377,9 +379,9 @@ namespace bbtk //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 @@ -388,6 +390,8 @@ namespace bbtk //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); @@ -790,9 +794,9 @@ namespace bbtk if(portmod->getPortType()==GINPUTPORT && portView->getState()==HIGHLIGHTED) { isOverPort=true; - } - } - } + } // if + } // if + } // for if(isOverPort==false) { @@ -809,14 +813,14 @@ namespace bbtk 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++) { @@ -824,8 +828,8 @@ namespace bbtk GObjectController* cont = _controllers[id]; cont->getView()->setState(DRAG); cont->getModel()->notifyObservers(_idManager); - } - } + } // for + } // _selectedObjects @@ -1624,13 +1628,6 @@ namespace bbtk 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 @@ -1678,14 +1675,7 @@ namespace bbtk 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 @@ -1770,17 +1760,8 @@ namespace bbtk 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); @@ -1833,67 +1814,6 @@ namespace bbtk std::string nameEndPort(result); configGConnetion(nameStartBox, nameStartPort, nameEndBox, nameEndPort); -//ups 3 EED Borrame -/* - std::vector lstB = getBlackBoxes(); - GPortModel *startP = NULL; - GPortModel *endP = NULL; - int j; - for(j = 0;jgetModel(); - 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 lstInputs = getComplexInputPorts(); - for(j = 0;jgetModel(); - if(_controllers[idB]->getModel()->getBBTKName()==nameStartBox) - { - startP = cbMod->getOutputPort(nameStartPort); - } // if - } // for - } // if - - if(endP==NULL) - { - std::vector lstOutputs = getComplexOutputPorts(); - for(j = 0;jgetModel(); - 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 @@ -1995,54 +1915,6 @@ namespace bbtk printf("EED wxVtkSceneManager::configGConnetion 2 %p %p \n", startP, endP ); -/*ups5 EED Borrame - std::vector 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 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 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;