From: apo Date: Mon, 16 Jul 2007 13:57:00 +0000 (+0000) Subject: To avoid confusion when there is more than one study X-Git-Tag: T_MULTIPR_INDUS_Persistence~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c4724399ba8a107e15b422a80a31477059856ffe;p=modules%2Fvisu.git To avoid confusion when there is more than one study --- diff --git a/src/VISU_I/VISU_Gen_i.cc b/src/VISU_I/VISU_Gen_i.cc index 487bbd48..034644e1 100644 --- a/src/VISU_I/VISU_Gen_i.cc +++ b/src/VISU_I/VISU_Gen_i.cc @@ -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(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(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(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(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(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(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(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(); }