From: jfa Date: Wed, 2 Aug 2006 08:33:58 +0000 (+0000) Subject: PAL13002: EDF231 Salome ask if we want to save the study even if it was just done. X-Git-Tag: For_OCT_611~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b61f779ff1522efaf1b890223f78c98e5b282ce7;p=modules%2Fkernel.git PAL13002: EDF231 Salome ask if we want to save the study even if it was just done. --- diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx index ed054fb2e..78e9ee869 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx @@ -1527,16 +1527,28 @@ void SALOMEDSImpl_Study::Modify() //============================================================================ Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_Study::GetCommonParameters(const char* theID, int theSavePoint) { - if(theSavePoint < 0) return NULL; + if (theSavePoint < 0) return NULL; Handle(SALOMEDSImpl_StudyBuilder) builder = NewBuilder(); Handle(SALOMEDSImpl_SObject) so = FindComponent((char*)theID); - if(so.IsNull()) so = builder->NewComponent((char*)theID); - Handle(SALOMEDSImpl_SObject) newSO; - if(theSavePoint == 0) //Get an attribute that is placed on the component itself. - newSO = so; - else - newSO = builder->NewObjectToTag(so, theSavePoint); - return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(builder->FindOrCreateAttribute(newSO, "AttributeParameter")); + if (so.IsNull()) so = builder->NewComponent((char*)theID); + Handle(SALOMEDSImpl_AttributeParameter) attParam; + + if (theSavePoint > 0) { // Try to find SObject that contains attribute parameter ... + TDF_Label savePointLabel = so->GetLabel().FindChild( theSavePoint, /*create=*/0 ); + if ( !savePointLabel.IsNull() ) + so = GetSObject( savePointLabel ); + else // ... if it does not exist - create a new one + so = builder->NewObjectToTag( so, theSavePoint ); + } + + if (!so.IsNull()) { + builder->FindAttribute(so, attParam, "AttributeParameter"); + if ( attParam.IsNull() ) { // first call of GetCommonParameters on "Interface Applicative" component + Handle(TDF_Attribute) att = builder->FindOrCreateAttribute(so, "AttributeParameter"); + attParam = Handle(SALOMEDSImpl_AttributeParameter)::DownCast( att ); + } + } + return attParam; } //============================================================================ diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx index 275d748f2..05d9dec5e 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx @@ -524,7 +524,8 @@ bool SALOMEDSImpl_StudyBuilder::FindAttribute(const Handle(SALOMEDSImpl_SObject) } TDF_Label Lab = anObject->GetLabel(); if (Lab.FindAttribute(SALOMEDSImpl_SObject::GetGUID(aTypeOfAttribute), anAttribute)) { - _doc->Modify(); + // commented out because NO MODIFICATION is done to attributes when calling FindAttribute() + // _doc->Modify(); return Standard_True; } return Standard_False;