Salome HOME
Update mechanism is corrected (Bug #182).
[modules/hydro.git] / src / HYDROData / HYDROData_Entity.cxx
index eb7d6599ebdfb24053625897b711d30de35ff1a4..126f6dffbe261bae936a9679b339359fac4dfb3a 100644 (file)
@@ -2,6 +2,7 @@
 #include "HYDROData_Entity.h"
 
 #include "HYDROData_Iterator.h"
+#include "HYDROData_Tool.h"
 
 #include <TDataStd_Name.hxx>
 #include <TDataStd_ByteArray.hxx>
@@ -28,7 +29,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;
 }
 
@@ -55,6 +56,7 @@ QStringList HYDROData_Entity::DumpToPython( MapOfTreatedObjects& theTreatedObjec
 
 void HYDROData_Entity::Update()
 {
+  SetToUpdate( false );
 }
 
 QVariant HYDROData_Entity::GetDataVariant()
@@ -62,11 +64,21 @@ QVariant HYDROData_Entity::GetDataVariant()
   return QVariant();
 }
 
-void HYDROData_Entity::SetToUpdate(bool theFlag)
+void HYDROData_Entity::SetToUpdate( bool theFlag )
 {
+  if ( IsMustBeUpdated() == theFlag )
+    return;
+
   if ( theFlag )
   {
     TDataStd_UAttribute::Set( myLab, GUID_MUST_BE_UPDATED );
+
+    Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
+    if ( !aDocument.IsNull() )
+    {
+      // Change the states of this and all depended objects
+      HYDROData_Tool::SetMustBeUpdatedObjects( aDocument );
+    }
   }
   else
   {
@@ -89,6 +101,11 @@ void HYDROData_Entity::Remove()
   return myLab.ForgetAllAttributes( true );
 }
 
+bool HYDROData_Entity::CanRemove()
+{
+  return true;
+}
+
 HYDROData_Entity::HYDROData_Entity()
 {
 }
@@ -121,6 +138,11 @@ Handle(HYDROData_Entity) HYDROData_Entity::GetFatherObject() const
   return aFather;
 }
 
+HYDROData_SequenceOfObjects HYDROData_Entity::GetAllReferenceObjects() const
+{
+  return HYDROData_SequenceOfObjects();
+}
+
 void HYDROData_Entity::SetLabel(TDF_Label theLabel)
 {
   myLab = theLabel;