From: apo Date: Wed, 20 Dec 2006 07:31:45 +0000 (+0000) Subject: To clarify algorithm of "SelectPrs3dToBeDeleted" function X-Git-Tag: WP1_2_3_20-12-2006_bug_fixing~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ddcef600efc5ffe8af4f5e93d40db67de9d4c874;p=modules%2Fvisu.git To clarify algorithm of "SelectPrs3dToBeDeleted" function --- diff --git a/src/VISU_I/VISU_ColoredPrs3dCache_i.cc b/src/VISU_I/VISU_ColoredPrs3dCache_i.cc index b24b2e19..3447140e 100644 --- a/src/VISU_I/VISU_ColoredPrs3dCache_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3dCache_i.cc @@ -157,23 +157,21 @@ namespace // by cleaning of active holder's presentation if( theActiveHolderEntry != "" ){ aHolderIter = theHolderMap.find( theActiveHolderEntry ); + if(aHolderIter == theHolderMap.end()) + return false; + const VISU::TLastVisitedPrsList& aPrsList = aHolderIter->second; + + // To prefere "move" action instead of destroy / create presentation + if(aPrsList.back()->GetMemorySize() >= theRequiredMemory) + return false; + VISU::TLastVisitedPrsList::const_reverse_iterator aPrsIter = aPrsList.rbegin(); - VISU::TLastVisitedPrsList::const_reverse_iterator aPrsIterEnd = aPrsList.rend(); + // Do not porcess first item to avoid of the device destruction + VISU::TLastVisitedPrsList::const_reverse_iterator aPrsIterEnd = aPrsList.rend()++; for(; aPrsIter != aPrsIterEnd; aPrsIter++){ VISU::TPrs3dPtr aPrs3d = *aPrsIter; - // To avoid of device destruction - if(aPrs3d.GetPointer() == aPrsList.front().GetPointer()) - return false; - - CORBA::Float aMemory = aPrs3d->GetMemorySize(); - - // To prefere "move" action instead of destroy / create - if(aPrsIter == aPrsList.rbegin()) - if(aMemory >= theRequiredMemory) - return false; - - aGatheredMemory += aMemory; + aGatheredMemory += aPrs3d->GetMemorySize(); theColoredPrs3dHolderMap[theActiveHolderEntry].push_back(aPrs3d); if( aGatheredMemory > theRequiredMemory ) return true;