]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
PAL9636
authorasl <asl@opencascade.com>
Fri, 26 Aug 2005 06:09:39 +0000 (06:09 +0000)
committerasl <asl@opencascade.com>
Fri, 26 Aug 2005 06:09:39 +0000 (06:09 +0000)
src/SalomeApp/SalomeApp_Study.cxx
src/SalomeApp/SalomeApp_Study.h

index d01cdd9f8c6421863209f96e634d0b354e7fd606..e1065c9fef289aae4017356b7bf5bf9f7e0d83d7 100644 (file)
@@ -332,3 +332,18 @@ QString SalomeApp_Study::newStudyName() const
   }
   return newName;
 }
+
+void SalomeApp_Study::deleteReferencesTo( _PTR( SObject ) obj )
+{
+  _PTR(StudyBuilder) sb = studyDS()->NewBuilder();
+  std::vector<_PTR(SObject)> aRefs = studyDS()->FindDependances( obj );
+  for( int i=0, n=aRefs.size(); i<n; i++ )
+  {
+    _PTR( SObject ) o = aRefs[i];
+    if( o->GetFatherComponent()->ComponentDataType()==obj->GetFatherComponent()->ComponentDataType() )
+    {
+      sb->RemoveReference( o );
+      sb->RemoveObjectWithChildren( o );
+    }
+  }
+}
index 5ac882766d97bc95fddf7347acfaa9168e02858f..1404446f4d17211628aa675537d8e46a60de9da0 100644 (file)
@@ -35,6 +35,9 @@ public:
 
   _PTR(Study)         studyDS() const;
 
+  // to delete all references to object, whose have the same component
+  void                deleteReferencesTo( _PTR( SObject ) );
+
 signals:
   void                saved( SUIT_Study* );
   void                opened( SUIT_Study* );