]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
BUG 5885, Added a RemoveReference method as a pair to Addreference in SALOMEDS_StudyB...
authorsmh <smh@opencascade.com>
Tue, 18 May 2004 11:38:33 +0000 (11:38 +0000)
committersmh <smh@opencascade.com>
Tue, 18 May 2004 11:38:33 +0000 (11:38 +0000)
idl/SALOMEDS.idl
src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx
src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx

index 6184f8fb159447bb4cd70a4fc6063f6588cc76d0..f019faf3110c27845f360b1ebf2c8479fc22e5e4 100644 (file)
@@ -502,6 +502,14 @@ during each working session.
 
     void Addreference(in SObject anObject,
                      in SObject theReferencedObject) ;
+
+/*!
+    Removes a reference from %anObject to another object.
+    \param anObject The %SObject which contains a reference
+*/
+
+    void RemoveReference(in SObject anObject) ;
+
 /*!
    Adds a directory in the %Study.
    \param theName String parameter defining the name of the directory.
index df8bf416c675b9c81fa7d472a08c3395cc865b2a..64eba6c88b5fb489cfb825d0529b119f7904a5f0 100644 (file)
@@ -671,6 +671,34 @@ SALOMEDS_StudyBuilder_i::Addreference(SALOMEDS::SObject_ptr me,
   if(!CORBA::is_nil(_callbackOnRemove) && Lab.IsDescendant(_doc->Main())) _callbackOnRemove->OnRemoveSObject(me);
 }
 
+//============================================================================
+/*! Function : RemoveReference
+ *  Purpose  : 
+ */
+//============================================================================
+void SALOMEDS_StudyBuilder_i::RemoveReference(SALOMEDS::SObject_ptr me)
+{
+  SALOMEDS::SObject_var theReferencedObject;
+  if(!me->ReferencedObject(theReferencedObject)) return;  //No reference is found
+
+  CheckLocked();
+  TDF_Label Lab;
+  ASSERT(!CORBA::is_nil(me));
+  CORBA::String_var meid = me->GetID();
+  TDF_Tool::Label(_doc->GetData(),meid,Lab);  
+
+  Lab.ForgetAttribute(TDF_Reference::GetID());  
+
+  TDF_Label RefLab;  
+  ASSERT(!CORBA::is_nil(theReferencedObject));
+  CORBA::String_var roid = theReferencedObject->GetID();
+  TDF_Tool::Label(_doc->GetData(),roid,RefLab);
+
+  RemoveAttribute(theReferencedObject, "AttributeTarget");
+  //if(!CORBA::is_nil(_callbackOnRemove) && Lab.IsDescendant(_doc->Main())) _callbackOnRemove->OnRemoveSObject(me);
+}
+
+
 
 //============================================================================
 /*! Function : AddDirectory
index 9b668f4024a3ad0d41769e9321c0bee1fc1290bd..2b51ac83896758fa61250863855e4777b5136a56 100644 (file)
@@ -122,6 +122,8 @@ public:
 
   virtual void Addreference(SALOMEDS::SObject_ptr me, SALOMEDS::SObject_ptr thereferencedObject);
 
+  virtual void RemoveReference(SALOMEDS::SObject_ptr me);
+
   virtual void SetGUID(SALOMEDS::SObject_ptr anObject, const char* theGUID);
   virtual bool IsGUID(SALOMEDS::SObject_ptr anObject, const char* theGUID);