- try {
-#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
- OCC_CATCH_SIGNALS;
-#endif
- SMESH_Actor *anActor = SMESH::FindActorByObject( myMesh );
- if ( !anActor ) anActor = SMESH::CreateActor( aMeshSObj->GetStudy(), aMeshSObj->GetID().c_str(), true );
-
- anActor->SetEntityMode( entities );
- SMESH::DisplayActor( SMESH::GetActiveWindow(), anActor );
-
- SMESH::Update(myIObject, true);
-
- if ( limitExceeded )
- {
- QStringList hiddenMsg;
- if ( hidden & SMESH_Actor::e0DElements ) hiddenMsg << tr( "SMESH_ELEMS0D" );
- if ( hidden & SMESH_Actor::eEdges ) hiddenMsg << tr( "SMESH_EDGES" );
- if ( hidden & SMESH_Actor::eFaces ) hiddenMsg << tr( "SMESH_FACES" );
- if ( hidden & SMESH_Actor::eVolumes ) hiddenMsg << tr( "SMESH_VOLUMES" );
- if ( hidden & SMESH_Actor::eBallElem ) hiddenMsg << tr( "SMESH_BALLS" );
- SUIT_MessageBox::warning( desktop(),
- tr( "SMESH_WRN_WARNING" ),
- tr( "SMESH_WRN_SIZE_INC_LIMIT_EXCEEDED" ).arg( myMesh->NbElements() ).arg( limitSize ).arg( hiddenMsg.join(", ") ) );
+ SMESH::SMESH_subMesh_var sm = aSubMeshes[i];
+ if ( CORBA::is_nil( sm ) ) continue;
+ _PTR(SObject) smSObj = SMESH::ObjectToSObject( sm );
+ if ( !smSObj ) continue;
+ SMESH::SMESH_IDSource_var aSubMeshObj =
+ SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( smSObj );
+ SMESH_Actor *anActor = SMESH::FindActorByObject( aSubMeshObj );
+ if ( anActor && anActor->GetVisibility() )
+ aListToUpdate.append( TListOf_IDSrc_SObj::value_type( aSubMeshObj, smSObj ));
+ }
+ // put Groups into list
+ SMESH::ListOfGroups_var aGroups = myMesh->GetGroups();
+ for ( size_t i = 0; i < aGroups->length(); ++i )
+ {
+ SMESH::SMESH_GroupBase_var aGrp = aGroups[i];
+ if ( CORBA::is_nil( aGrp ) ) continue;
+ SMESH::SMESH_Group_var aStdGroup = SMESH::SMESH_Group::_narrow( aGrp );
+ if ( !aStdGroup->_is_nil() ) continue; // don't update standalone groups
+ _PTR(SObject) aGroupSO = SMESH::FindSObject( aGrp );
+ if ( !aGroupSO ) continue;
+ SMESH::SMESH_IDSource_var aGroupObj =
+ SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aGroupSO );
+ SMESH_Actor *anActor = SMESH::FindActorByObject( aGroupObj );
+ if ( anActor && anActor->GetVisibility() )
+ aListToUpdate.append( TListOf_IDSrc_SObj::value_type( aGroupObj, aGroupSO ));
+ }
+
+ // update mesh, sub-mesh and groups, if it's possible
+ TListOf_IDSrc_SObj::iterator anIter;
+ for ( anIter = aListToUpdate.begin(); anIter != aListToUpdate.end(); anIter++ )
+ {
+ SMESH::SMESH_Mesh_var aMesh =
+ SMESH::SMESH_Mesh::_narrow( SMESH::SObjectToObject( (*anIter).second ));
+
+ if ( getSMESHGUI()->automaticUpdate( (*anIter).first, &entities, &limitExceeded,
+ &hidden, &nbElements ) )
+ {
+ try {
+ OCC_CATCH_SIGNALS;
+ bool toDisplay = false;
+ if ( !aMesh->_is_nil() ) // display only a mesh
+ {
+ toDisplay = true;
+ SMESH_Actor *anActor = SMESH::FindActorByObject( aMesh );
+ if ( !anActor ) anActor = SMESH::CreateActor( (*anIter).second->GetStudy(),
+ (*anIter).second->GetID().c_str(),
+ /*clearLog =*/ true );
+ if ( anActor ) // actor is not created for an empty mesh
+ {
+ anActor->SetEntityMode( entities );
+ SMESH::DisplayActor( SMESH::GetActiveWindow(), anActor );
+ }
+ }
+ Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject
+ ( (*anIter).second->GetID().c_str(), "SMESH", (*anIter).second->GetName().c_str() );
+ SMESH::Update(anIO, toDisplay);
+
+ if ( limitExceeded && !aMesh->_is_nil() )
+ {
+ QStringList hiddenMsg;
+ if ( hidden & SMESH_Actor::e0DElements ) hiddenMsg << tr( "SMESH_ELEMS0D" );
+ if ( hidden & SMESH_Actor::eEdges ) hiddenMsg << tr( "SMESH_EDGES" );
+ if ( hidden & SMESH_Actor::eFaces ) hiddenMsg << tr( "SMESH_FACES" );
+ if ( hidden & SMESH_Actor::eVolumes ) hiddenMsg << tr( "SMESH_VOLUMES" );
+ if ( hidden & SMESH_Actor::eBallElem ) hiddenMsg << tr( "SMESH_BALLS" );
+ SUIT_MessageBox::warning( desktop(),
+ tr( "SMESH_WRN_WARNING" ),
+ tr( "SMESH_WRN_SIZE_INC_LIMIT_EXCEEDED" ).
+ arg( nbElements ).
+ arg( limitSize ).
+ arg( hiddenMsg.join(", ")));
+ }