]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
PAL13002: EDF231 Salome ask if we want to save the study even if it was just done.
authorjfa <jfa@opencascade.com>
Wed, 2 Aug 2006 08:33:58 +0000 (08:33 +0000)
committerjfa <jfa@opencascade.com>
Wed, 2 Aug 2006 08:33:58 +0000 (08:33 +0000)
src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx
src/SALOMEDSImpl/SALOMEDSImpl_StudyBuilder.cxx

index ed054fb2ecb984c83154d96070ea83f389044640..78e9ee86977723bf1be850999c251d182a623343 100644 (file)
@@ -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;
 }
 
 //============================================================================
index 275d748f2c08e77925df6a44df035d58de49a3e3..05d9dec5e8378a2f93a19adc0eb54a459c6b03ad 100644 (file)
@@ -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;