From c4724399ba8a107e15b422a80a31477059856ffe Mon Sep 17 00:00:00 2001 From: apo Date: Mon, 16 Jul 2007 13:57:00 +0000 Subject: [PATCH] To avoid confusion when there is more than one study --- src/VISU_I/VISU_Gen_i.cc | 81 +++++++++++++++++++++++----------------- 1 file changed, 46 insertions(+), 35 deletions(-) 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(); } -- 2.39.2