X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FEditorGraphicBBS%2FbbsWxGUIEditorGraphic%2FwxVtkSceneManager.cxx;h=1c13d7d0d4e3201f56fe7260ecfe0a5f6724b581;hb=refs%2Ftags%2FCreatools2-0-3_bbGEditor1-0-0_17Feb2011;hp=cf08b262520bf5eab10e9d8293b4422794f0d762;hpb=ec7fc3bf3cc44da7cb9f9b840391c2f44c52a875;p=bbtkGEditor.git diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx index cf08b26..1c13d7d 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx @@ -47,6 +47,12 @@ namespace bbtk //========================================================================= wxVtkSceneManager::wxVtkSceneManager(wxGEditorTabPanel *parent, wxVtk3DBaseView *baseView,int idManager) { + _cbName = "ComplexBoxName"; + _cbPackageName = "PackageName"; + _Author = "Author ??"; + _Category = ""; + _Description = "Description ??"; + _parent = parent; _numBoxes = 0; _idManager = idManager; @@ -1253,6 +1259,28 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); script+=LineNumber(wln,lnNmbr); script+="\n"; + +//ups2 + + script+=LineNumber(wln,lnNmbr); + script+="author \""; + script+=_Author; + script+="\"\n"; + + script+=LineNumber(wln,lnNmbr); + script+="description \""; + script+=_Description; + script+="\"\n"; + + script+=LineNumber(wln,lnNmbr); + script+="category \""; + script+=_Category; + script+="\"\n"; + + script+=LineNumber(wln,lnNmbr); + script+="\n"; + + // script+="include std\n"; // JPR for(i = 0; i < (int)boxes.size();i++) @@ -1339,9 +1367,8 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); //========================================================================= - std::string wxVtkSceneManager::saveComplexBoxBBS(std::string cbName,std::string paName,std::string cbAuthor,std::string cbCategory,std::string cbDescription) + std::string wxVtkSceneManager::saveComplexBoxBBS() { - std::vector packages; std::vector boxes; std::vector connections; @@ -1398,21 +1425,28 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); } script+="\n"; + // Definition of a complex box script+="define "; - script+=cbName+" "+paName; + script+=_cbName+" "+_cbPackageName; script+="\n"; script+="\n"; - script+="author \" "; - script+=cbAuthor; + script+="author \""; + script+=_Author; script+="\"\n"; - script+="description \" "; - script+=cbDescription; + script+="description \""; + script+=_Description; script+="\"\n"; script+="\n"; + script+="category \""; + script+=_Category; + script+="\"\n"; + script+="\n"; + + // Create boxes for(i = 0; i<(int)boxes.size();i++) { @@ -1589,11 +1623,32 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); { char buffer [50]; + content+="CATEGORY:"; + content+=GetCategory(); + content+="\n"; + + content+="DESCRIPTION:"; + content+=GetDescription(); + content+="\n"; + + content+="AUTHOR:"; + content+=GetAuthor(); + content+="\n"; + + //Print info IF COMPLEX BOX content+="COMPLEXBOX:"; if(_isComplexBox) { content+="TRUE\n"; +//ups1 + content+="COMPLEXBOXNAME:"; + content+=GetCbName(); + content+="\n"; + + content+="PACKAGENAME:"; + content+=GetCbPackageName(); + content+="\n"; //Print info complex input ports std::vector inputs = getComplexInputPorts(); @@ -1667,7 +1722,7 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); void wxVtkSceneManager::loadDiagram(ifstream &inputStream) { - std::string version; + std::string version=""; std::string line=""; char delims[] = ":"; char *result = NULL; @@ -1682,9 +1737,15 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); if (line=="# - BBTKGEditor v 1.0 BBG BlackBox Diagram file") { version=line.substr(18,3); - printf("EED wxVtkSceneManager::loadDiagram version=%s\n",version.c_str()); } - + if (line=="# - BBTKGEditor v 1.1 BBG BlackBox Diagram file") + { + version=line.substr(18,3); + } + if (line=="# - BBTKGEditor v 1.2 BBG BlackBox Diagram file") + { + version=line.substr(18,3); + } } else if(line=="APP_START") { @@ -1693,14 +1754,40 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); } } + printf("EED wxVtkSceneManager::loadDiagram version=%s\n",version.c_str()); + if(start) { + if ((version!="1.0") && (version!="1.1")) + { + getline(inputStream,line);//CATEGORY: + char categoryTmp[30]; + strcpy( categoryTmp, line.c_str() ); + result = strtok( categoryTmp, delims ); + result = strtok( NULL, delims ); + SetCategory(result); + + getline(inputStream,line);//DESCRIPTION: + char descriptionTmp[1024]; + strcpy( descriptionTmp, line.c_str() ); + result = strtok( descriptionTmp, delims ); + result = strtok( NULL, delims ); + SetDescription(result); + + getline(inputStream,line);//AUTHOR: + char authorTmp[255]; + strcpy( authorTmp, line.c_str() ); + result = strtok( authorTmp, delims ); + result = strtok( NULL, delims ); + SetAuthor(result); + } + //---------- getline(inputStream,line);//COMPLEX_BOX:TRUE|FALSE - char complex[30]; - strcpy( complex, line.c_str() ); - result = strtok( complex, delims ); + char complexTmp[30]; + strcpy( complexTmp, line.c_str() ); + result = strtok( complexTmp, delims ); result = strtok( NULL, delims ); std::string isComplexBox(result); @@ -1708,6 +1795,24 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); { _isComplexBox=true; + if ((version!="1.0") && (version!="1.1")) + { + getline(inputStream,line);//COMPLEXNAME: + char complexboxnameTmp[255]; + strcpy( complexboxnameTmp, line.c_str() ); + result = strtok( complexboxnameTmp, delims ); + result = strtok( NULL, delims ); + SetCbName(result); + + getline(inputStream,line);//PACKAGENAME: + char packagenameTmp[255]; + strcpy( packagenameTmp, line.c_str() ); + result = strtok( packagenameTmp, delims ); + result = strtok( NULL, delims ); + SetCbPackageName(result); + } + + //----------------------- //- COMPLEX INPUT PORTS //----------------------- @@ -2428,31 +2533,91 @@ printf("EED wxVtkSceneManager::createGComplexBoxOutputPort 900-450\n"); //========================================================================= - void wxVtkSceneManager::SetComplexBoxName(std::string cbName) + void wxVtkSceneManager::SetCbName(std::string cbName) + { + _cbName=cbName; + if (_cbName=="") + { + _cbName=""; + } + } + + //========================================================================= + std::string wxVtkSceneManager::GetCbName() + { + return _cbName; + } + + //========================================================================= + void wxVtkSceneManager::SetCbPackageName(std::string packagename) { - _complexBoxName=cbName; + _cbPackageName=packagename; + if (_cbPackageName=="") + { + _cbPackageName=""; + } } //========================================================================= - std::string wxVtkSceneManager::GetComplexBoxName() + std::string wxVtkSceneManager::GetCbPackageName() { - return _complexBoxName; + return _cbPackageName; } + //========================================================================= + void wxVtkSceneManager::SetAuthor(std::string author) + { + _Author=author; + if (_Author=="") + { + _Author=""; + } + } //========================================================================= - void wxVtkSceneManager::SetPackageName(std::string paName) + std::string wxVtkSceneManager::GetAuthor() { - _packageName=paName; + return _Author; } //========================================================================= - std::string wxVtkSceneManager::GetPackageName() + void wxVtkSceneManager::SetCategory(std::string category) { - return _packageName; + _Category=category; + if (_Category=="") + { + _Category=""; + } } //========================================================================= + std::string wxVtkSceneManager::GetCategory() + { + return _Category; + } + + //========================================================================= + void wxVtkSceneManager::SetDescription(std::string description) + { + _Description=description; + if (_Description=="") + { + _Description=""; + } + } + + //========================================================================= + std::string wxVtkSceneManager::GetDescription() + { + return _Description; + } + + //========================================================================= + + + + + } // EO namespace bbtk