From: davila <> Date: Sun, 12 Sep 2010 14:47:04 +0000 (+0000) Subject: no message X-Git-Tag: v1_0_0~48 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=c831683a7a606ee930de94df48aa0064d6db4dfa;p=bbtkGEditor.git no message --- diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/ExecuterBBSG.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/ExecuterBBSG.cxx index d485735..39df179 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/ExecuterBBSG.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/ExecuterBBSG.cxx @@ -48,16 +48,23 @@ namespace bbtk - EExecuterBBSG::Pointer EExecuterBBSG::New() + EExecuterBBSG::Pointer EExecuterBBSG::New( wxVtkSceneManager* sceneManager, Factory::Pointer factory ) { - return MakePointer( new EExecuterBBSG() ); + return MakePointer( new EExecuterBBSG( sceneManager, factory) ); } //========================================================================= - EExecuterBBSG::EExecuterBBSG() + EExecuterBBSG::EExecuterBBSG( wxVtkSceneManager* sceneManager, Factory::Pointer factory ) { + _factory = factory; + _sceneManager = sceneManager; + + _xGeneral = 10; + _yGeneral = 10; + _zGeneral = 900; // ????? + } //========================================================================= @@ -67,7 +74,9 @@ namespace bbtk } //========================================================================= - + + + //--EED /// Sets the inputs of the workspace : void EExecuterBBSG::SetInputs(const std::map& m) @@ -147,10 +156,13 @@ namespace bbtk } /// Creates a new black box in current complex box - void EExecuterBBSG::Create ( const std::string& boxType, const std::string& - boxName) + void EExecuterBBSG::Create ( const std::string& boxType, const std::string& boxName) { - printf("EED EExecuterBBSG::Create\n"); + std::string packagename = _factory->GetPackageNameOfaBlackBox(boxType); +// int idBox = _sceneManager->createGBlackBox( 0,0, packagename ,boxType); +// _sceneManager->configGBlackBox(idBox, _xGeneral,_yGeneral,_zGeneral,boxName, false , _xGeneral+100, _yGeneral-10 , _zGeneral ); + _yGeneral = _yGeneral + 30; + printf("EED EExecuterBBSG::Create packagename=%s boxtype=%s boxname=%s \n", packagename.c_str(), boxType.c_str(), boxName.c_str() ); } /// Destroys a black box diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/ExecuterBBSG.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/ExecuterBBSG.h index 4b0b018..80e2c10 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/ExecuterBBSG.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/ExecuterBBSG.h @@ -39,7 +39,7 @@ Version: $Revision$ #define __ExecuterBBSG_h__ //Includes same project -//.. +#include "wxVtkSceneManager.h" //Includes bbtk #include "bbtkVirtualExec.h" @@ -54,37 +54,14 @@ Version: $Revision$ - - -/* -namespace bbtk -{ - - class Interpreter; - - - class Executer : public VirtualExec - { - BBTK_OBJECT_INTERFACE(Executer); - typedef VirtualExec Superclass; - public: - static Pointer New(); -*/ - - - - namespace bbtk { class EExecuterBBSG : public VirtualExec { -// BBTK_OBJECT_INTERFACE(EExecuterBBSG); -// typedef VirtualExec Superclass; public: - static Pointer New(); -// Pointer New(); - EExecuterBBSG(); + static Pointer New( wxVtkSceneManager* sceneManager, Factory::Pointer factory ); + EExecuterBBSG( wxVtkSceneManager* sceneManager, Factory::Pointer factory ); ~EExecuterBBSG(); //Public methods @@ -218,7 +195,11 @@ namespace bbtk virtual void Print(const std::string & message); //--EED - + double _xGeneral; + double _yGeneral; + double _zGeneral; + wxVtkSceneManager *_sceneManager; + Factory::Pointer _factory; private: diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx index a633abf..e939b32 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx @@ -411,21 +411,21 @@ namespace bbtk if (openFileDialog->ShowModal() == wxID_OK) { wxString fileName = openFileDialog->GetPath( ); - printf("EED wxGUIEditorGraphicBBS::OnOpenBBS file=%s\n", (const char*) (fileName.mb_str()) ); +printf("EED wxGUIEditorGraphicBBS::OnOpenBBS file=%s\n", (const char*) (fileName.mb_str()) ); - bbtk::EExecuterBBSG::Pointer exe = bbtk::EExecuterBBSG::New(); -// EExecuterBBSG *exe = new EExecuterBBSG(); + + _tabsMgr->addNewTab(); + + + bbtk::EExecuterBBSG::Pointer exe = bbtk::EExecuterBBSG::New( this->_tabsMgr->getActualTabPanel()->getSceneManager() , _pkgBrowser->GetFactory() ); bbtk::Interpreter::Pointer I = bbtk::Interpreter::New( boost::static_pointer_cast(exe) ); -// bbtk::Interpreter::Pointer I = bbtk::Interpreter::New( ExecuterBBSG::New() ); -// bbtk::Interpreter::Pointer I = bbtk::Interpreter::New( ); // We tell the interpreter to throw exceptions on error I->SetThrow(true); // Interpret the file supposed to define a box called 'Processing' I->InterpretFile( (const char*) (fileName.mb_str()) ); - - } + refreshGUIControls(); } void wxGUIEditorGraphicBBS::OnSaveActualBBS(wxCommandEvent& event) @@ -463,7 +463,6 @@ namespace bbtk if (nameDialog->ShowModal() == wxID_OK) { wxString fileName = nameDialog->GetValue(); -//EED cbName=fileName; cbName=(const char*) (fileName.mb_str()); } @@ -475,7 +474,6 @@ namespace bbtk wxString fileName = saveFileDialog->GetPath(); ofstream file; -//EED file.open(fileName.c_str()); file.open( (const char*) (fileName.mb_str()) ); std::string content=""; @@ -503,7 +501,6 @@ namespace bbtk wxString fileName = saveFileDialog->GetPath(); ofstream file; -//EED file.open(fileName.c_str()); file.open( (const char*) (fileName.mb_str()) ); std::string content=""; @@ -513,7 +510,6 @@ namespace bbtk content += "# - BBTKGEditor v 1.0 BBG BlackBox Diagram file\n"; content += "# - "; -//EED content += fileName; content += (const char*) (fileName.mb_str()); content += "\n"; diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx index bf67893..53f6204 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx @@ -82,7 +82,7 @@ printf ("EED %p ~wxGEditorTabPanel()\n" , this ); bool wxGEditorTabPanel::OnDropText(wxCoord x, wxCoord y, const wxString& data) { std::string packageName=""; - std::string boxName=""; + std::string boxType=""; wxString foo( (data) ); char str[150]; @@ -94,9 +94,9 @@ printf ("EED %p ~wxGEditorTabPanel()\n" , this ); packageName += result; result = strtok( NULL, delims ); - boxName += result; + boxType += result; - _sceneManager->createGBlackBox(x,y,packageName, boxName); + _sceneManager->createGBlackBox(x,y,packageName, boxType); return true; } @@ -229,6 +229,13 @@ printf ("EED %p ~wxGEditorTabPanel()\n" , this ); //========================================================================= + + wxVtkSceneManager* wxGEditorTabPanel::getSceneManager() + { + return _sceneManager; + } + + } // EO namespace bbtk // EOF diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h index 3e75838..0f3b3bf 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.h @@ -135,14 +135,16 @@ namespace bbtk // Receives the string from a drag and drop source as for example the BBTK Package Browser virtual bool OnDropText(wxCoord x, wxCoord y, const wxString& data); + + wxVtkSceneManager* getSceneManager(); //========================================================================= private: - int _id; - wxAuiManager *_panelAUIMgr; - wxVtkSceneManager *_sceneManager; - wxTabPanelsManager* _panelsManager; + int _id; + wxAuiManager *_panelAUIMgr; + wxVtkSceneManager *_sceneManager; + wxTabPanelsManager * _panelsManager; protected: diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx index 1573fd2..1d3d107 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx @@ -109,7 +109,6 @@ namespace bbtk std::string wxVtkSceneManager::generateANewNameForABox() { - _numBoxes++; std::stringstream boxname; if(_numBoxes<10) { @@ -117,6 +116,7 @@ namespace bbtk }else{ boxname << "Box" << _numBoxes; } + _numBoxes++; return boxname.str(); } @@ -135,11 +135,27 @@ namespace bbtk } //========================================================================= +//ups1 eed + void wxVtkSceneManager::configGBlackBox(int idBox, double xIn, double yIn, double zIn, std::string name, bool boxExecutable,double xEn,double yEn,double zEn) + { + 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); + + bbmod->notifyObservers(_idManager); - int wxVtkSceneManager::createGBlackBox(int x, int y, std::string packageName, std::string boxType) + } + + + //========================================================================= + + int wxVtkSceneManager::createGBlackBox(int x, int y, std::string packageName, std::string boxType) { _worldState = NOTHING_HAPPENS; - int windowWidth = _baseView->GetRenWin()->GetSize()[0]; +//EED int windowWidth = _baseView->GetRenWin()->GetSize()[0]; int windowHeight = _baseView->GetRenWin()->GetSize()[1]; int type = GBLACKBOX; @@ -164,21 +180,14 @@ namespace bbtk _baseView->TransCoordScreenToWorld(xx,yy,zz); model->setInicPoint(xx,yy,zz); -//EED Borrame _numBoxes++; std::stringstream stream; - str:string newBoxName = findANewNameForABox(); + std::string newBoxName; + newBoxName = findANewNameForABox(); + + stream << newBoxName; -/* EED Borrame - if(_numBoxes<10) - { - stream << "Box0" << _numBoxes; - } - else - { - stream << "Box" << _numBoxes; - } -*/ + std::string arraystring = stream.str(); model->setBBTKName(arraystring); @@ -235,24 +244,24 @@ namespace bbtk int wxVtkSceneManager::createGComplexBoxInputPort(std::string inputName) { - int windowWidth=_baseView->GetRenWin()->GetSize()[0]; +//EED int windowWidth=_baseView->GetRenWin()->GetSize()[0]; int windowHeight=_baseView->GetRenWin()->GetSize()[1]; - int type = GCOMPLEXINPUTPORT; + int type = GCOMPLEXINPUTPORT; //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 - double xx = 5; - double yy = windowHeight-5; + double xx = 5; + double yy = windowHeight-5; //z value is not important yet, because it is only used a parallel projection - double zz = 900; + double zz = 900; _baseView->TransCoordScreenToWorld(xx,yy,zz); model->setInicPoint(xx,yy,zz); @@ -288,24 +297,24 @@ namespace bbtk int wxVtkSceneManager::createGComplexBoxOutputPort(std::string outputName) { - int windowWidth=_baseView->GetRenWin()->GetSize()[0]; +//EED int windowWidth=_baseView->GetRenWin()->GetSize()[0]; int windowHeight=_baseView->GetRenWin()->GetSize()[1]; - int type = GCOMPLEXOUTPUTPORT; + int type = GCOMPLEXOUTPUTPORT; //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 - double xx = 5; - double yy = windowHeight-5; + double xx = 5; + double yy = windowHeight-5; //z value is not important yet, because it is only used a parallel projection - double zz = 900; + double zz = 900; _baseView->TransCoordScreenToWorld(xx,yy,zz); model->setInicPoint(xx,yy,zz); @@ -499,10 +508,10 @@ namespace bbtk { if(command == ADD_TO_SELECTED) { - GObjectController* cont = _controllers[idController]; +//EED GObjectController* cont = _controllers[idController]; bool foundID=false; - for (int i=0; i<_selectedObjects.size() && foundID==false; i++) + for (int i=0; i<(int)_selectedObjects.size() && foundID==false; i++) { int id = _selectedObjects[i]; if(id==idController) @@ -604,7 +613,7 @@ namespace bbtk if(_worldState == DRAG_OBJECTS) { - for (int i=0; i<_selectedObjects.size(); i++) + for (int i=0; i<(int)_selectedObjects.size(); i++) { int id = _selectedObjects[i]; GObjectController* cont = _controllers[id]; @@ -703,7 +712,7 @@ namespace bbtk _worldState = DRAG_OBJECTS; _startDragging = true; - for (int i = 0; i < _selectedObjects.size(); i++) + for (int i = 0; i < (int)_selectedObjects.size(); i++) { int id = _selectedObjects[i]; GObjectController* cont = _controllers[id]; @@ -725,7 +734,7 @@ namespace bbtk { _worldState = NOTHING_HAPPENS; - for (int i = 0; i < _selectedObjects.size(); i++) + for (int i = 0; i < (int)_selectedObjects.size(); i++) { int id = _selectedObjects[i]; GObjectController* cont = _controllers[id]; @@ -760,7 +769,7 @@ namespace bbtk } - for (int i = 0; i < _selectedObjects.size(); i++) + for (int i = 0; i < (int)_selectedObjects.size(); i++) { int id = _selectedObjects[i]; GObjectController* cont = _controllers[id]; @@ -796,7 +805,7 @@ namespace bbtk { if(type==GBLACKBOX) { - for (int i=0; i<_selectedObjects.size(); i++) + for (int i=0; i< (int)_selectedObjects.size(); i++) { int id = _selectedObjects[i]; GObjectController* control = _controllers[id]; @@ -990,7 +999,7 @@ namespace bbtk std::string pkg = mod->getBBTKPackage(); bool existsPkg = false; - for(int t = 0;t inputs = model->getInputPorts(); - for(int j = 0; jisValueSet()) @@ -1063,7 +1072,7 @@ namespace bbtk } - for(i = 0; igetBBTKPackage(); bool existsPkg = false; - for(int t = 0;t inputs = model->getInputPorts(); - for(int j = 0; jisValueSet()) @@ -1212,7 +1221,7 @@ namespace bbtk std::string complexInputs=""; std::string complexOutputs=""; - for(i = 0; igetModel(); @@ -1622,21 +1632,26 @@ namespace bbtk std::istringstream zEt(zEnd); zEt >> zEn; - int idBox = createGBlackBox(0,0,package,type); - GObjectController *cont = _controllers[idBox]; - GBlackBoxModel *bbmod = (GBlackBoxModel*)cont->getModel(); - bbmod->setBBTKName(name); - bbmod->setInicPoint(xIn,yIn,zIn); - bbmod->setFinalPoint(xEn,yEn,zEn); - + bool boxExecutable=false; if(isExec=="TRUE") { - bbmod->setExecutable(true); - } - else if(isExec=="FALSE") - { - bbmod->setExecutable(false); + boxExecutable= true; } + + int idBox = createGBlackBox(xIn,yIn,package,type); + GObjectController *cont = _controllers[idBox]; + GBlackBoxModel *bbmod = (GBlackBoxModel*)cont->getModel(); + configGBlackBox(idBox, xIn,yIn,zIn,name, boxExecutable,xEn,yEn,zEn); + + +//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 @@ -1657,7 +1672,7 @@ namespace bbtk port=line.substr(0,4); } // while - bbmod->notifyObservers(_idManager); +//EED bbmod->notifyObservers(_idManager); } // boxes /// CONNECTIONS @@ -2003,11 +2018,11 @@ namespace bbtk std::vector newInputConnections = newBox->getConnectedInputs(); std::vector newOutputConnections = newBox->getConnectedOutputs(); - for(int k = 0; k *controllersToRemove, int id); - //Clear list of controllers and refresh void deleteAllBoxes();