X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_Entity.cxx;h=f8238ec656dbde367949cbcb1104f7ec09497f40;hb=5b4f8c7000189059d1c32f1982e24ca998d994fe;hp=be8a51ed92dbaaf64064eed62fcba814f57f13c3;hpb=84f8b4a57d3cdad820bc1333a5066699cd1c8ae3;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_Entity.cxx b/src/HYDROData/HYDROData_Entity.cxx index be8a51ed..f8238ec6 100644 --- a/src/HYDROData/HYDROData_Entity.cxx +++ b/src/HYDROData/HYDROData_Entity.cxx @@ -19,6 +19,8 @@ #include #include +static const Standard_GUID GUID_MUST_BE_UPDATED("80f2bb81-3873-4631-8ddd-940d2119f000"); + IMPLEMENT_STANDARD_HANDLE(HYDROData_Entity,MMgt_TShared) IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Entity,MMgt_TShared) @@ -26,7 +28,7 @@ IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Entity,MMgt_TShared) bool IsEqual(const Handle_HYDROData_Entity& theObj1, const Handle_HYDROData_Entity& theObj2) { if ( !theObj1.IsNull() && !theObj2.IsNull() ) - return theObj1->ID() == theObj2->ID(); + return theObj1->Label() == theObj2->Label(); return false; } @@ -51,7 +53,7 @@ QStringList HYDROData_Entity::DumpToPython( MapOfTreatedObjects& theTreatedObjec return anEmptyList; } -void HYDROData_Entity::Update( const bool theIsForce ) +void HYDROData_Entity::Update() { } @@ -60,6 +62,23 @@ QVariant HYDROData_Entity::GetDataVariant() return QVariant(); } +void HYDROData_Entity::SetToUpdate(bool theFlag) +{ + if ( theFlag ) + { + TDataStd_UAttribute::Set( myLab, GUID_MUST_BE_UPDATED ); + } + else + { + myLab.ForgetAttribute( GUID_MUST_BE_UPDATED ); + } +} + +bool HYDROData_Entity::IsMustBeUpdated() const +{ + return myLab.IsAttribute( GUID_MUST_BE_UPDATED ); +} + bool HYDROData_Entity::IsRemoved() const { return !myLab.HasAttribute(); @@ -84,6 +103,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 +170,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 ) {