+
+void HYDROData_Tool::SetMustBeUpdatedImages(
+ Handle_HYDROData_Document theDoc)
+{
+ bool aChanged = true;
+
+ // iterate until there is no changes because images on all level of dependency must be updated
+ while ( aChanged )
+ {
+ aChanged = false;
+
+ HYDROData_Iterator anIter( theDoc, KIND_IMAGE );
+ for ( ; anIter.More(); anIter.Next() )
+ {
+ Handle(HYDROData_Image) anImage =
+ Handle(HYDROData_Image)::DownCast( anIter.Current() );
+ if ( anImage.IsNull() || anImage->MustBeUpdated() )
+ continue;
+
+ for ( int i = 0, aNBRefs = anImage->NbReferences(); i < aNBRefs; ++i )
+ {
+ Handle(HYDROData_Image) aRefImage =
+ Handle(HYDROData_Image)::DownCast( anImage->Reference( i ) );
+ if ( !aRefImage.IsNull() && aRefImage->MustBeUpdated() )
+ {
+ // image references to updated => also must be updated
+ anImage->MustBeUpdated(true);
+ aChanged = true;
+ }
+ }
+ }
+ }
+}