54353: Mesh group is not updated in VTK

This commit is contained in:
eap 2018-02-26 19:57:39 +03:00
parent f7712f9c03
commit eda06d81d6
3 changed files with 34 additions and 11 deletions

View File

@ -247,15 +247,13 @@ void SMESHGUI_RemoveElementsDlg::ClickOnApply()
} catch (const SALOME::SALOME_Exception& S_ex) { } catch (const SALOME::SALOME_Exception& S_ex) {
SalomeApp_Tools::QtCatchCorbaException(S_ex); SalomeApp_Tools::QtCatchCorbaException(S_ex);
myEditCurrentArgument->clear(); } catch (...) {
} catch (...){
myEditCurrentArgument->clear();
} }
myEditCurrentArgument->clear();
if (aResult) { if (aResult) {
myEditCurrentArgument->clear();
mySelector->ClearIndex(); mySelector->ClearIndex();
SMESH::UpdateView(); SMESH::UpdateView( /*withChildrenOfSelected=*/true );
SMESHGUI::Modified(); SMESHGUI::Modified();
} }
} }

View File

@ -794,12 +794,13 @@ namespace SMESH
return false; return false;
} }
void UpdateView(){ void UpdateView( bool withChildrenOfSelected )
{
if ( SVTK_ViewWindow* aWnd = SMESH::GetCurrentVtkView()) { if ( SVTK_ViewWindow* aWnd = SMESH::GetCurrentVtkView()) {
LightApp_SelectionMgr* mgr = SMESHGUI::selectionMgr(); LightApp_SelectionMgr* mgr = SMESHGUI::selectionMgr();
SALOME_ListIO selected; mgr->selectedObjects( selected ); SALOME_ListIO selected; mgr->selectedObjects( selected );
if( selected.Extent() == 0){ if ( selected.Extent() == 0 ) {
vtkRenderer* aRenderer = aWnd->getRenderer(); vtkRenderer* aRenderer = aWnd->getRenderer();
VTK::ActorCollectionCopy aCopy(aRenderer->GetActors()); VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
vtkActorCollection *aCollection = aCopy.GetActors(); vtkActorCollection *aCollection = aCopy.GetActors();
@ -811,12 +812,36 @@ namespace SMESH
break; // avoid multiple warinings if visu failed break; // avoid multiple warinings if visu failed
} }
} }
}else{ }
else
{
SALOME_ListIteratorOfListIO anIter( selected ); SALOME_ListIteratorOfListIO anIter( selected );
for( ; anIter.More(); anIter.Next()){ for( ; anIter.More(); anIter.Next())
{
Handle(SALOME_InteractiveObject) anIO = anIter.Value(); Handle(SALOME_InteractiveObject) anIO = anIter.Value();
if ( !Update(anIO,true) ) if ( !Update( anIO, true ))
break; // avoid multiple warinings if visu failed break; // avoid multiple warinings if visu failed
if ( withChildrenOfSelected ) // update all visible children
{
QString aFatherID = anIO->getEntry();
vtkRenderer* aRenderer = aWnd->getRenderer();
VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
vtkActorCollection *aCollection = aCopy.GetActors();
aCollection->InitTraversal();
while ( vtkActor *anAct = aCollection->GetNextActor() ) {
if ( SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>( anAct )) {
if ( anActor->hasIO() && anActor->GetVisibility() )
{
QString aChildID = anActor->getIO()->getEntry();
if ( aChildID.size() > aFatherID.size() &&
aChildID.startsWith( aFatherID ))
if ( ! Update( anActor->getIO(), true ))
break;
}
}
}
}
} }
} }
RepaintCurrentView(); RepaintCurrentView();

View File

@ -120,7 +120,7 @@ SMESHGUI_EXPORT
bool UpdateView( EDisplaing, const char* = "" ); bool UpdateView( EDisplaing, const char* = "" );
SMESHGUI_EXPORT SMESHGUI_EXPORT
void UpdateView(); void UpdateView( bool withChildrenOfSelected = false );
SMESHGUI_EXPORT SMESHGUI_EXPORT
bool UpdateNulData( const Handle(SALOME_InteractiveObject)& theIO, bool theDisplay); bool UpdateNulData( const Handle(SALOME_InteractiveObject)& theIO, bool theDisplay);