]> SALOME platform Git repositories - modules/hydro.git/blobdiff - src/HYDROData/HYDROData_Entity.cxx
Salome HOME
Image positioning by two points.
[modules/hydro.git] / src / HYDROData / HYDROData_Entity.cxx
index be8a51ed92dbaaf64064eed62fcba814f57f13c3..27efc616cf9f6449c6bddbee1b963737c20e4875 100644 (file)
@@ -84,6 +84,24 @@ void HYDROData_Entity::CopyTo(Handle_HYDROData_Entity theDestination) const
   aCopy.Perform();
 }
 
+Handle(HYDROData_Entity) HYDROData_Entity::GetFatherObject() const
+{
+  Handle(HYDROData_Entity) aFather;
+
+  if ( !myLab.IsNull() )
+  {
+    TDF_Label aFatherLabel = myLab.Father();
+
+    while ( aFather.IsNull() && !aFatherLabel.IsNull() && !aFatherLabel.IsRoot() )
+    {
+      aFather = HYDROData_Iterator::Object( aFatherLabel );
+      aFatherLabel = aFatherLabel.Father();
+    }
+  }
+
+  return aFather;
+}
+
 void HYDROData_Entity::SetLabel(TDF_Label theLabel)
 {
   myLab = theLabel;
@@ -133,6 +151,27 @@ int HYDROData_Entity::NbReferenceObjects( const int theTag ) const
   return aRefs.IsNull() ? 0 : aRefs->Extent();
 }
 
+bool HYDROData_Entity::HasReference( const Handle_HYDROData_Entity& theObj,
+                                     const int                      theTag ) const
+{
+  if ( theObj.IsNull() )
+    return false;
+
+  Handle(TDataStd_ReferenceList) aRefs = getReferenceList( theTag, false );
+  if ( aRefs.IsNull() || aRefs->IsEmpty() )
+    return false;
+
+  TDF_ListIteratorOfLabelList aListIt( aRefs->List() );
+  for ( ; aListIt.More(); aListIt.Next() )
+  {
+    const TDF_Label& aRefLabel = aListIt.Value();
+    if  ( theObj->Label() == aRefLabel )
+      return true;
+  }
+
+  return false;
+}
+
 void HYDROData_Entity::AddReferenceObject( const Handle_HYDROData_Entity& theObj,
                                            const int                      theTag )
 {