X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_Tool.cxx;h=58511d16cea71b587a10df916512f4b35cc7e28b;hb=f108c7fd8c3b2dbb8c263b14456a31f8dd1d0921;hp=0cd144270fe620e29b9936ee0a4cc679cce5f4f8;hpb=ac7145bc4d05b5df24b7bb28e968dfdc2930aed6;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_Tool.cxx b/src/HYDROData/HYDROData_Tool.cxx index 0cd14427..58511d16 100644 --- a/src/HYDROData/HYDROData_Tool.cxx +++ b/src/HYDROData/HYDROData_Tool.cxx @@ -1,6 +1,9 @@ #include "HYDROData_Tool.h" +#include "HYDROData_Image.h" +#include "HYDROData_Iterator.h" + #include #include #include @@ -17,5 +20,38 @@ void HYDROData_Tool::WriteStringsToFile( QFile& theFile, return; QTextStream anOutStream( &theFile ); - anOutStream << aWriteStr << theSep; + anOutStream << aWriteStr << theSep << theSep; +} + +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; + } + } + } + } }