]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To avoid confusion when there is more than one study
authorapo <apo@opencascade.com>
Mon, 16 Jul 2007 13:57:00 +0000 (13:57 +0000)
committerapo <apo@opencascade.com>
Mon, 16 Jul 2007 13:57:00 +0000 (13:57 +0000)
src/VISU_I/VISU_Gen_i.cc

index 487bbd48409e5b78ca434e0de5e05e549eb43957..034644e174b62c2b55d93db0b299f39781a015e1 100644 (file)
@@ -736,13 +736,15 @@ namespace VISU
                      const std::string& theSubMeshName, // Family or Group name
                      const std::string& theNewName)
   {
-    if (myStudyDocument->GetProperties()->IsLocked()) 
-      return;
-
     Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in());
     if (!aResult) 
       return;
 
+    SALOMEDS::Study_var aStudyDocument = aResult->GetStudyDocument();
+    if (aStudyDocument->GetProperties()->IsLocked()) 
+      return;
+
+
     QString aComment;
     VISU::VISUType aType;
     if (theEntity >= 0)
@@ -776,9 +778,9 @@ namespace VISU
     if (anEntry == "") 
       return;
 
-    SALOMEDS::SObject_ptr aSObject = myStudyDocument->FindObjectID(anEntry.c_str());
+    SALOMEDS::SObject_ptr aSObject = aStudyDocument->FindObjectID(anEntry.c_str());
 
-    SALOMEDS::StudyBuilder_var aStudyBuilder = myStudyDocument->NewBuilder();
+    SALOMEDS::StudyBuilder_var aStudyBuilder = aStudyDocument->NewBuilder();
     aStudyBuilder->NewCommand(); // There is a transaction
 
     SALOMEDS::GenericAttribute_var anAttr =
@@ -834,17 +836,20 @@ namespace VISU
                 const char* theMeshName,
                 VISU::Entity theEntity)
   {
-    if(myStudyDocument->GetProperties()->IsLocked())
-      return Mesh::_nil();
+    Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in());
+    if (!aResult) 
+      return VISU::Mesh::_nil();
+
+    SALOMEDS::Study_var aStudyDocument = aResult->GetStudyDocument();
+    if (aStudyDocument->GetProperties()->IsLocked()) 
+      return VISU::Mesh::_nil();
+
+    Mesh_i* aPresent = new Mesh_i();
+    if(aPresent->Create(aResult, theMeshName, theEntity))
+      return aPresent->_this();
+    else
+      aPresent->_remove_ref();
 
-    if(Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
-      Mesh_i* aPresent = new Mesh_i();
-      if(aPresent->Create(aResult, theMeshName, theEntity))
-       return aPresent->_this();
-      else{
-       aPresent->_remove_ref();
-      }
-    }
     return VISU::Mesh::_nil();
   }
 
@@ -857,17 +862,20 @@ namespace VISU
                       VISU::Entity theEntity,
                       const char* theFamilyName)
   {
-    if(myStudyDocument->GetProperties()->IsLocked())
-      return Mesh::_nil();
+    Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in());
+    if (!aResult) 
+      return VISU::Mesh::_nil();
+
+    SALOMEDS::Study_var aStudyDocument = aResult->GetStudyDocument();
+    if (aStudyDocument->GetProperties()->IsLocked()) 
+      return VISU::Mesh::_nil();
+
+    Mesh_i* aPresent = new Mesh_i();
+    if(aPresent->Create(aResult, theMeshName, theEntity, theFamilyName))
+      return aPresent->_this();
+    else
+      aPresent->_remove_ref();
 
-    if(Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
-      Mesh_i* aPresent = new Mesh_i();
-      if(aPresent->Create(aResult, theMeshName, theEntity, theFamilyName))
-       return aPresent->_this();
-      else{
-       aPresent->_remove_ref();
-      }
-    }
     return VISU::Mesh::_nil();
   }
 
@@ -879,17 +887,20 @@ namespace VISU
              const char* theMeshName,
              const char* theGroupName)
   {
-    if(myStudyDocument->GetProperties()->IsLocked())
-      return Mesh::_nil();
+    Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in());
+    if (!aResult) 
+      return VISU::Mesh::_nil();
+
+    SALOMEDS::Study_var aStudyDocument = aResult->GetStudyDocument();
+    if (aStudyDocument->GetProperties()->IsLocked()) 
+      return VISU::Mesh::_nil();
+
+    Mesh_i* aPresent = new Mesh_i();
+    if(aPresent->Create(aResult, theMeshName, theGroupName))
+      return aPresent->_this();
+    else
+      aPresent->_remove_ref();
 
-    if(Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
-      Mesh_i* aPresent = new Mesh_i();
-      if(aPresent->Create(aResult, theMeshName, theGroupName))
-       return aPresent->_this();
-      else{
-       aPresent->_remove_ref();
-      }
-    }
     return VISU::Mesh::_nil();
   }