]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
added a support for visual state dumping
authorsrn <srn@opencascade.com>
Wed, 8 Feb 2006 14:36:58 +0000 (14:36 +0000)
committersrn <srn@opencascade.com>
Wed, 8 Feb 2006 14:36:58 +0000 (14:36 +0000)
src/VISU_I/VISU_DumpPython.cc

index 91b8ef80fbdc5f9a9d214cca5d7dd3585dbea8ff..27f59c242972917e0c475b8c9db5d646c8a9c419 100644 (file)
 #include <qstring.h>
 #include <qfileinfo.h>
 
+#include <SALOMEDSClient.hxx>
+#include <SALOMEDS_IParameters.hxx>
+#include <SALOMEDS_Study.hxx>
+
 //#define COUT
 
 using namespace std;
@@ -1170,6 +1174,41 @@ namespace VISU{
     VISU::DumpChildrenToPython(aStudy,theIsPublished,theIsValidScript,aComponent.in(),aStr,aName2EntryMap,aEntry2NameMap,"",aPrefix);
     VISU::DumpContainersToPython(aStudy,theIsPublished,theIsValidScript,aComponent.in(),aStr,aName2EntryMap,aEntry2NameMap,"",aPrefix);
 
+
+
+    _PTR(Study) study(new SALOMEDS_Study(aStudy)); 
+    int savePoint = SALOMEDS_IParameters::getLastSavePoint(study, "Interface Applicative");
+    if(savePoint > 0) {
+      SALOMEDS_IParameters ip = SALOMEDS_IParameters(study->GetCommonParameters("Interface Applicative", savePoint));
+      if(ip.isDumpPython()) {
+       ip = SALOMEDS_IParameters(study->GetModuleParameters("Interface Applicative", "Post-Pro", savePoint));
+
+       aStr << aPrefix << "import iparameters" << endl;
+       aStr << aPrefix << "ipar = iparameters.IParameters(salome.myStudy.GetModuleParameters(\"Interface Applicative\", 1))\n\n";
+
+       
+       vector<string> v = ip.getProperties();
+       if(v.size() > 0) {
+         aStr << aPrefix << "#Set up visual properties:\n";
+         for(int i = 0; i<v.size(); i++) {
+           string prp = ip.getProperty(v[i]);
+           aStr << aPrefix << "ipar.setProperty(\"" << v[i] << "\", \"" << prp << "\")\n";
+         }
+       }
+       
+       v = ip.getLists();
+       if(v.size() > 0) {
+         aStr << aPrefix << "#Set up lists:\n";
+         for(int i = 0; i<v.size(); i++) {
+           vector<string> lst = ip.getValues(v[i]);
+           aStr << aPrefix << "# fill list " << v[i] << "\n";
+           for(int j = 0; j < lst.size(); j++)
+             aStr << aPrefix << "ipar.append(\"" << v[i] << "\", \"" << lst[j] << "\")\n";
+         }
+       }
+      }
+    }
+
     aStr<<aPrefix<<"pass"<<endl;
 
 #ifndef COUT