Salome HOME
Update mechanism is corrected (Bug #182).
[modules/hydro.git] / src / HYDROData / HYDROData_Entity.cxx
index 015cb0f7e17d73c4782107a1c3d8e6fa943e272a..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>
@@ -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
   {