Salome HOME
Join modifications from branch OCC_development_for_3_2_0a2
[modules/visu.git] / src / VISU_I / VISU_DumpPython.cc
index 91b8ef80fbdc5f9a9d214cca5d7dd3585dbea8ff..f3d809ed7fea735e81f4ce2218dc9e429ffb8b85 100644 (file)
@@ -175,8 +175,14 @@ namespace VISU{
     theStr<<thePrefix<<"if "<<theName<<":"<<endl;
     thePrefix += PREFIX;
 
+    // Add to Name->Object map
     theStr<<thePrefix<<"aName2ObjectMap['"<<theName<<"'] = "<<theName<<endl;
 
+    // Set name (as this object could be renamed by user)
+    CORBA::String_var aNameInStudy = theSObject->GetName();
+    theStr<<thePrefix<<"visu.SetName("<<theName<<",'"<<aNameInStudy.in()<<"')"<<endl;
+
+    // Set parameters
     theStr<<thePrefix<<theName<<".SetScalarMode("<<theServant->GetScalarMode()<<")"<<endl;
 
     switch(theServant->GetScaling()){
@@ -359,6 +365,10 @@ namespace VISU{
       theStr<<thePrefix<<"if "<<aName<<":"<<endl;
       std::string aPrefix2 = thePrefix + PREFIX;
 
+      // Set name (as this object could be renamed by user)
+      CORBA::String_var aNameInStudy = theSObject->GetName();
+      theStr<<aPrefix2<<aName<<".SetTitle('"<<aNameInStudy.in()<<"') # 1"<<endl;
+
       DumpChildrenToPython(theStudy,
                           theIsPublished,
                           theIsValidScript,
@@ -594,8 +604,14 @@ namespace VISU{
            theStr<<thePrefix<<"if "<<aName<<":"<<endl;
            thePrefix += PREFIX;
 
+           // Add to Name->Object map
            theStr<<thePrefix<<"aName2ObjectMap['"<<aName<<"'] = "<<aName<<endl;
 
+           // Set name (as this object could be renamed by user)
+           CORBA::String_var aNameInStudy = theSObject->GetName();
+           theStr<<thePrefix<<"visu.SetName("<<aName<<",'"<<aNameInStudy.in()<<"')"<<endl;
+
+           // Set presentation parameters
            SALOMEDS::Color aColor;
            aColor = aServant->GetCellColor();
            theStr<<thePrefix<<aName<<".SetCellColor(SALOMEDS.Color("<<
@@ -897,7 +913,6 @@ namespace VISU{
          return;
         case VISU::TTABLE:
           if(Table_i* aServant = dynamic_cast<Table_i*>(GetServant(anObj).in())){
-           SALOMEDS::SObject_var aSObject = aServant->GetSObject();
            SALOMEDS::GenericAttribute_var anAttr;
            if(theSObject->FindAttribute(anAttr,"AttributeComment")){
              using namespace SALOMEDS;
@@ -921,6 +936,11 @@ namespace VISU{
 
                  theStr<<thePrefix<<"anID = aSObject.GetID()"<<endl;
                  theStr<<thePrefix<<aName<<" = aVisu.CreateTable(anID)"<<endl;
+
+                 // Set name (as this object could be renamed by user)
+                 CORBA::String_var aNameInStudy = theSObject->GetName();
+                 theStr<<thePrefix<<aName<<".SetTitle('"<<aNameInStudy.in()<<"') # 2"<<endl;
+
                  theStr<<endl;
 
                  theArgumentName = aName;
@@ -944,6 +964,11 @@ namespace VISU{
 
                  theStr<<thePrefix<<"anID = aSObject.GetID()"<<endl;
                  theStr<<thePrefix<<aName<<" = aVisu.CreateTable(anID)"<<endl;
+
+                 // Set name (as this object could be renamed by user)
+                 CORBA::String_var aNameInStudy = theSObject->GetName();
+                 theStr<<thePrefix<<aName<<".SetTitle('"<<aNameInStudy.in()<<"') # 3"<<endl;
+
                  theStr<<endl;
 
                  theArgumentName = aName;
@@ -976,7 +1001,7 @@ namespace VISU{
           return;
        }
       }
-    }else{
+    }else{ /*if(!CORBA::is_nil(anObj))*/
       SALOMEDS::GenericAttribute_var anAttr;
       if(theSObject->FindAttribute(anAttr,"AttributeComment")){
        SALOMEDS::AttributeComment_var aComment =
@@ -1117,6 +1142,10 @@ namespace VISU{
        std::string aPrefix = thePrefix + PREFIX;
        theArgumentName = aName;
 
+       // Set name (as this object could be renamed by user)
+       CORBA::String_var aNameInStudy = aSObject->GetName();
+       theStr<<aPrefix<<"visu.SetName("<<aName<<",'"<<aNameInStudy.in()<<"')"<<endl;
+
        SALOMEDS::ChildIterator_var aCurveIter = theStudy->NewChildIterator(aSObject);
        for(aCurveIter->InitEx(false); aCurveIter->More(); aCurveIter->Next()){
          SALOMEDS::SObject_var aRefSObj = aCurveIter->Value();