// 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;