Salome HOME
Merge from PortingMED3 07Apr11
[modules/visu.git] / src / VISU_I / VISU_DumpPython.cc
index 5ba81d944e9bd36e267a7cf4b0cfb651e713a8bf..38b1318d8878861529af5be5a4018321eb5235c7 100644 (file)
@@ -50,7 +50,7 @@
 #include "utilities.h"
 
 #include <cctype>
-#include <strstream>
+#include <sstream>
 #include <functional>
 
 #include <QString>
@@ -229,6 +229,7 @@ namespace VISU
         case MT_O_PLUS:  aParam1 = "MT_O_PLUS"; break;
         case MT_O_STAR:  aParam1 = "MT_O_STAR"; break;
         case MT_O_X:     aParam1 = "MT_O_X"; break;
+        case MT_POINT_SPRITE: aParam1 = "MT_POINT_SPRITE"; break;
         default:         aParam1 = "MT_NONE"; break;
         }
         switch( aMarkerScale ) {
@@ -245,8 +246,10 @@ namespace VISU
         case MS_60:      aParam2 = "MS_60"; break;
         case MS_65:      aParam2 = "MS_65"; break;
         case MS_70:      aParam2 = "MS_70"; break;
-        default:         aParam2 = "MT_NONE"; break;
+        default:         aParam2 = "MS_NONE"; break;
         }
+        if( aMarkerType == MT_POINT_SPRITE )
+          aParam2 = "MS_NONE";
         theStr<<thePrefix<<theName<<".SetMarkerStd(VISU."<<aParam1<<", VISU."<<aParam2<<")"<<endl;
       }
       else {
@@ -959,7 +962,7 @@ namespace VISU
     CORBA::Long aNbRows = theTableAttr->GetNbRows();
 
     // push values and their indices into streams
-    strstream values, rows, columns;
+    stringstream values, rows, columns;
     string comma = "";
     for(CORBA::Long i = 1; i <= aNbColumns; i++){
       for(CORBA::Long j = aNbRows; j > 0; j--){
@@ -973,7 +976,7 @@ namespace VISU
       }
     }
     // push titles and units into streams
-    strstream rowUnits, rowTitles, colTitles;
+    stringstream rowUnits, rowTitles, colTitles;
     SALOMEDS::StringSeq_var aRowUnits = theTableAttr->GetRowUnits();
     SALOMEDS::StringSeq_var aRowTitles = theTableAttr->GetRowTitles();
     comma = "";
@@ -2294,6 +2297,7 @@ namespace VISU
   VISU_Gen_i::
   DumpPython(CORBA::Object_ptr theStudy,
             CORBA::Boolean theIsPublished,
+            CORBA::Boolean theIsMultiFile,
             CORBA::Boolean& theIsValidScript)
   {
     theIsValidScript = false;
@@ -2311,14 +2315,17 @@ namespace VISU
 #define aStr cout
 #endif
 
-    std::string aPrefix(PREFIX);
-    aStr<<"def RebuildData(theStudy):"<<endl;
+    std::string aPrefix = theIsMultiFile ? PREFIX : "";
+    if( theIsMultiFile )
+      aStr<<"def RebuildData(theStudy):"<<endl;
     aStr<<aPrefix<<"from batchmode_salome import orb, naming_service, lcc, myStudyManager"<<endl;
     aStr<<aPrefix<<"import SALOME_MED"<<endl;
     aStr<<aPrefix<<"import SALOMEDS"<<endl;
     aStr<<aPrefix<<"import VISU"<<endl;
     aStr<<aPrefix<<"import visu"<<endl;
     aStr<<endl;
+    if( !theIsMultiFile )
+      aStr<<"theStudy = salome.myStudy"<<endl;
     aStr<<aPrefix<<"aVisu = visu.Initialize(orb,naming_service,lcc,myStudyManager,theStudy,0)"<<endl;
     aStr<<aPrefix<<"aSComponent = visu.PublishComponent(theStudy)"<<endl;
     aStr<<aPrefix<<"aMed = lcc.FindOrLoadComponent('FactoryServer','MED')"<<endl;
@@ -2400,10 +2407,13 @@ namespace VISU
       }
     }
 
-    aStr<<aPrefix<<"pass"<<endl;
+    if( theIsMultiFile )
+      aStr<<aPrefix<<"pass"<<endl;
 
     if(theIsPublished) { //SRN: define function for Animation
 
+      aPrefix = PREFIX;
+
       //Define a function that find a SObject by its father's path and its name
       aStr<<endl;
       aStr<<endl;