]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
An error fixed: if GetCommonParameters() is called for the first time on "Interface...
authorasv <asv@opencascade.com>
Tue, 1 Aug 2006 14:00:57 +0000 (14:00 +0000)
committerasv <asv@opencascade.com>
Tue, 1 Aug 2006 14:00:57 +0000 (14:00 +0000)
src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx

index 2165d3e5f6fbe46ce1dc0e853f6c9282f9a72cd0..d6d6fcd17d41d817a871870d609838e1de8298b5 100644 (file)
@@ -1527,26 +1527,31 @@ void SALOMEDSImpl_Study::Modify()
 //============================================================================
 Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_Study::GetCommonParameters(const char* theID, int theSavePoint)
 {
-  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_AttributeParameter) attParam;
-  if(theSavePoint == 0) //Get an attribute that is placed on the component itself.
-    builder->FindAttribute(so, attParam, "AttributeParameter");
-  else {  // Try to find SObject that contains attribute parameter ...
-    TDF_Label savePointLabel = so->GetLabel().FindChild( theSavePoint, /*create=*/0 );
-       if ( !savePointLabel.IsNull() ) {
-         so = GetSObject( savePointLabel );
-         builder->FindAttribute(so, attParam, "AttributeParameter");
-       } // ... if it does not exist - create a new one
-       else {
-         so = builder->NewObjectToTag( so, theSavePoint );
-         Handle(TDF_Attribute) att = builder->FindOrCreateAttribute(so, "AttributeParameter");
-         attParam = Handle(SALOMEDSImpl_AttributeParameter)::DownCast( att );
-    }
-  }
-  return attParam;
+if(theSavePoint < 0) return NULL;\r
+  Handle(SALOMEDSImpl_StudyBuilder) builder = NewBuilder();\r
+  Handle(SALOMEDSImpl_SObject) so = FindComponent((char*)theID);\r
+  if(so.IsNull()) so = builder->NewComponent((char*)theID); \r
+  Handle(SALOMEDSImpl_AttributeParameter) attParam;\r
+  if(theSavePoint == 0) { //Get an attribute that is placed on the component itself.\r
+    builder->FindAttribute(so, attParam, "AttributeParameter");\r
+       if ( attParam.IsNull() ) { // first call of GetCommonParameters on "Interface Applicative" component\r
+         Handle(TDF_Attribute) att = builder->FindOrCreateAttribute(so, "AttributeParameter");\r
+         attParam = Handle(SALOMEDSImpl_AttributeParameter)::DownCast( att );\r
+       }\r
+  }\r
+  else {  // Try to find SObject that contains attribute parameter ...\r
+    TDF_Label savePointLabel = so->GetLabel().FindChild( theSavePoint, /*create=*/0 );\r
+       if ( !savePointLabel.IsNull() ) {\r
+         so = GetSObject( savePointLabel );\r
+         builder->FindAttribute(so, attParam, "AttributeParameter");\r
+       } // ... if it does not exist - create a new one\r
+       else {\r
+         so = builder->NewObjectToTag( so, theSavePoint );\r
+         Handle(TDF_Attribute) att = builder->FindOrCreateAttribute(so, "AttributeParameter");\r
+         attParam = Handle(SALOMEDSImpl_AttributeParameter)::DownCast( att );\r
+    }\r
+  }\r
+  return attParam;\r
 }
 
 //============================================================================