bool anIsInserted = ( aPrs != 0 );
if( anIsVisible && ( !aPrs || aPrs->getIsToUpdate() || theIsForced ) )
{
+ // Erase the presentation in the view because of the problem with GEOM_Actor upadting on second SetShape.
+ if ( aPrs )
+ {
+ aViewer->Erase( aPrs, true );
+ }
+ // Update the presentation
if( HYDROGUI_VTKPrsDriver* aDriver = getDriver( (size_t)aViewer, anObj ) )
{
if( aDriver->Update( anObj, aPrs ) && aPrs && !anIsInserted )
}
else if ( isChanged )
{
- aView->Repaint();
+ aView->Repaint( true );
}
}
}
void HYDROGUI_VTKPrsDisplayer::purgeObjects( const int theViewerId )
{
+ bool doEraseScalarBar = false;
+
SVTK_Viewer* aViewer = module()->getVTKViewer( theViewerId );
if( aViewer )
{
SALOME_ListIO aListIO;
aViewer->GetVisible( aListIO );
-
+
HYDROGUI_VTKPrs* aPrs;
SALOME_ListIteratorOfListIO anIter( aListIO );
for( ; anIter.More(); anIter.Next() )
{
Handle(HYDROData_Entity) anOwnerObj =
module()->getDataModel()->objectByEntry( aPrsObj->getEntry() );
- if ( !anOwnerObj.IsNull() && anOwnerObj->IsRemoved() )
+ if ( anOwnerObj.IsNull() )
+ {
+ // We found an unknown IO presented in the viewer.
+ // Remove such an orphan presentation from all the views of the viewer.
+ SUIT_ViewManager* aViewMgr = dynamic_cast<SUIT_ViewManager*>( aViewer->getViewManager() );
+ if ( aViewMgr && aViewMgr->getViewsCount() > 0 )
+ {
+ QVector<SUIT_ViewWindow*> aViews = aViewMgr->getViews();
+ foreach ( SUIT_ViewWindow* aView, aViews )
+ {
+ SVTK_ViewWindow* aVTKView = dynamic_cast<SVTK_ViewWindow*>( aView );
+ if ( aVTKView )
+ {
+ aVTKView->Erase( aPrsObj, false );
+ }
+ }
+ }
+ // Remove the object presentation from the module's cache
+ module()->removeObjectVTKPrs( (size_t)aViewer, aPrsObj->getEntry() );
+ doEraseScalarBar = true;
+ }
+ else if ( anOwnerObj->IsRemoved() )
{
aPrs = module()->getObjectVTKPrs( (size_t)aViewer, anOwnerObj );
if ( aPrs )
{
aViewer->Erase( aPrs );
}
+ else
+ {
+ }
module()->removeObjectVTKPrs( (size_t)aViewer, anOwnerObj );
+ doEraseScalarBar = true;
}
}
}
+
+ if ( doEraseScalarBar )
+ {
+ EraseScalarBar( theViewerId );
+ }
}
}