From: vsr Date: Fri, 21 Jun 2013 05:33:07 +0000 (+0000) Subject: 0022169: [CEA 750] Chose before visualization mesh element type to display X-Git-Tag: V7_3_0a1~334 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bcb546c1b2b55346563024a7e7d22e6796b612f8;p=modules%2Fsmesh.git 0022169: [CEA 750] Chose before visualization mesh element type to display --- diff --git a/resources/SalomeApp.xml.in b/resources/SalomeApp.xml.in index 02c11cc47..7f3e3c14e 100644 --- a/resources/SalomeApp.xml.in +++ b/resources/SalomeApp.xml.in @@ -77,6 +77,7 @@ + diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 062b376c0..c8e15859d 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -1976,6 +1976,82 @@ bool SMESHGUI::automaticUpdate(unsigned int requestedSize, bool* limitExceeded) return autoUpdate && !exceeded; } +//============================================================================= +/*! + * + */ +//============================================================================= +bool SMESHGUI::automaticUpdate( SMESH::SMESH_Mesh_ptr theMesh, + int* entities, bool* limitExceeded ) +{ + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + if ( !resMgr ) + return false; + + bool autoUpdate = resMgr->booleanValue( "SMESH", "auto_update", false ); + long updateLimit = resMgr->integerValue( "SMESH", "update_limit", 500000 ); + bool incrementalLimit = resMgr->booleanValue( "SMESH", "incremental_limit", false ); + + long requestedSize = theMesh->NbElements(); + + *entities = SMESH_Actor::eAllEntity; + + bool exceeded = updateLimit > 0 && requestedSize > updateLimit; + + if ( limitExceeded ) *limitExceeded = autoUpdate && exceeded; + + if ( incrementalLimit ) { + long nbOdElems = theMesh->Nb0DElements(); + long nbEdges = theMesh->NbEdges(); + long nbFaces = theMesh->NbFaces(); + long nbVolumes = theMesh->NbVolumes(); + long nbBalls = theMesh->NbBalls(); + long total = 0; + + if ( nbOdElems > 0 ) { + if ( total + nbOdElems > updateLimit ) + *entities = *entities & ~SMESH_Actor::e0DElements; + else + exceeded = false; + } + total += nbOdElems; + + if ( nbEdges > 0 ) { + if ( total + nbEdges > updateLimit ) + *entities = *entities & ~SMESH_Actor::eEdges; + else + exceeded = false; + } + total += nbEdges; + + if ( nbFaces > 0 ) { + if ( total + nbFaces > updateLimit ) + *entities = *entities & ~SMESH_Actor::eFaces; + else + exceeded = false; + } + total += nbFaces; + + if ( nbVolumes > 0 ) { + if ( total + nbVolumes > updateLimit ) + *entities = *entities & ~SMESH_Actor::eVolumes; + else + exceeded = false; + } + total += nbVolumes; + + if ( nbBalls > 0 ) { + if ( total + nbBalls > updateLimit ) + *entities = *entities & ~SMESH_Actor::eBallElem; + else + exceeded = false; + } + total += nbBalls; + } + + return autoUpdate && !exceeded; +} + //============================================================================= /*! * @@ -4388,7 +4464,7 @@ void SMESHGUI::initialize( CAM_Application* app ) popupMgr()->insert ( action( 6031 ), aSubId, -1 ); // EQUAL_VOLUME popupMgr()->setRule( action( 6031 ), aMeshInVtkHasVolumes, QtxPopupMgr::VisibleRule ); popupMgr()->setRule( action( 6031 ), "controlMode = 'eCoincidentElems3D'", QtxPopupMgr::ToggleRule ); - + popupMgr()->insert( separator(), anId, -1 ); popupMgr()->insert( action( 201 ), anId, -1 ); // SCALAR_BAR_PROP @@ -4675,11 +4751,13 @@ void SMESHGUI::createPreferences() int genTab = addPreference( tr( "PREF_TAB_GENERAL" ) ); int autoUpdate = addPreference( tr( "PREF_AUTO_UPDATE" ), genTab, LightApp_Preferences::Auto, "SMESH", "auto_update" ); + setPreferenceProperty( autoUpdate, "columns", 2 ); int lim = addPreference( tr( "PREF_UPDATE_LIMIT" ), autoUpdate, LightApp_Preferences::IntSpin, "SMESH", "update_limit" ); setPreferenceProperty( lim, "min", 0 ); setPreferenceProperty( lim, "max", 100000000 ); setPreferenceProperty( lim, "step", 1000 ); setPreferenceProperty( lim, "special", tr( "PREF_UPDATE_LIMIT_NOLIMIT" ) ); + addPreference( tr( "PREF_INCREMENTAL_LIMIT" ), autoUpdate, LightApp_Preferences::Bool, "SMESH", "incremental_limit" ); int qaGroup = addPreference( tr( "PREF_GROUP_QUALITY" ), genTab ); setPreferenceProperty( qaGroup, "columns", 2 ); diff --git a/src/SMESHGUI/SMESHGUI.h b/src/SMESHGUI/SMESHGUI.h index 1b990f099..8a38ec5ec 100644 --- a/src/SMESHGUI/SMESHGUI.h +++ b/src/SMESHGUI/SMESHGUI.h @@ -100,6 +100,7 @@ public : bool isActiveStudyLocked(); static bool automaticUpdate(unsigned int requestedSize = 0, bool* limitExceeded = 0); + static bool automaticUpdate( SMESH::SMESH_Mesh_ptr, int*, bool* ); static void Modified( bool = true ); diff --git a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx index 1bd4d86f1..4883f7873 100644 --- a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx @@ -33,6 +33,7 @@ #include "SMESHGUI_MeshOrderOp.h" #include "SMESHGUI_MeshOrderDlg.h" +#include "SMESH_Actor.h" #include "SMESH_ActorUtils.h" #include @@ -898,17 +899,31 @@ void SMESHGUI_BaseComputeOp::computeMesh() // SHOW MESH // NPAL16631: if ( getSMESHGUI()->automaticUpdate() ) SUIT_ResourceMgr* resMgr = SMESH::GetResourceMgr( SMESHGUI::GetSMESHGUI() ); - long newSize = myMesh->NbElements(); bool limitExceeded; + long limitSize = resMgr->integerValue( "SMESH", "update_limit", 500000 ); + int entities = SMESH_Actor::eAllEntity; if ( !memoryLack ) { - if ( getSMESHGUI()->automaticUpdate( newSize, &limitExceeded ) ) + if ( getSMESHGUI()->automaticUpdate( myMesh, &entities, &limitExceeded ) ) { try { #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 OCC_CATCH_SIGNALS; #endif - SMESH::Update(myIObject, true); + 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 ) + { + SUIT_MessageBox::warning( desktop(), + tr( "SMESH_WRN_WARNING" ), + tr( "SMESH_WRN_SIZE_INC_LIMIT_EXCEEDED" ).arg( myMesh->NbElements() ).arg( limitSize ) ); + } } catch (...) { #ifdef _DEBUG_ @@ -922,12 +937,11 @@ void SMESHGUI_BaseComputeOp::computeMesh() } } } - else if ( limitExceeded ) + else if ( limitExceeded ) { - long limitSize = resMgr->integerValue( "SMESH", "update_limit", 500000 ); SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ), - tr( "SMESH_WRN_SIZE_LIMIT_EXCEEDED" ).arg( newSize ).arg( limitSize ) ); + tr( "SMESH_WRN_SIZE_LIMIT_EXCEEDED" ).arg( myMesh->NbElements() ).arg( limitSize ) ); } } LightApp_SelectionMgr *Sel = selectionMgr(); diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts index 536914858..9b0b444b1 100644 --- a/src/SMESHGUI/SMESH_msg_en.ts +++ b/src/SMESHGUI/SMESH_msg_en.ts @@ -2719,6 +2719,12 @@ Consider saving your work before application crash SMESH_WRN_SIZE_LIMIT_EXCEEDED No automatic update of the presentation has been done: new mesh size (%1 elements) exceeds current size limit (%2 elements). Please check preferences of Mesh module. + + + + SMESH_WRN_SIZE_INC_LIMIT_EXCEEDED + New mesh sise (%1 elements) exceeds current size limit (%2 elements). +Not all mesh elements are shown. Please check preferences of Mesh module. @@ -4167,6 +4173,10 @@ Please, create VTK viewer and try again PREF_UPDATE_LIMIT_NOLIMIT No limit + + PREF_INCREMENTAL_LIMIT + Incremental limit check + PREF_BACKFACE Back surface color diff --git a/src/SMESHGUI/SMESH_msg_fr.ts b/src/SMESHGUI/SMESH_msg_fr.ts index 94c8691fc..21690cee9 100755 --- a/src/SMESHGUI/SMESH_msg_fr.ts +++ b/src/SMESHGUI/SMESH_msg_fr.ts @@ -2687,6 +2687,12 @@ Enregistrez votre travail avant que l'application se plante SMESH_WRN_SIZE_LIMIT_EXCEEDED La présentation n'a pas été mise à jour automatiquement: la nouvelle taille du maillage (%1 éléments) dépasse la limite de taille actuelle (%2 éléments). Vérifiez la limite dans les préférences du module Mesh. + + + + SMESH_WRN_SIZE_INC_LIMIT_EXCEEDED + New mesh sise (%1 elements) exceeds current size limit (%2 elements). +Not all mesh elements are shown. Please check preferences of Mesh module. @@ -4127,6 +4133,10 @@ Ouvrez une fenêtre VTK et essayez de nouveau PREF_UPDATE_LIMIT_NOLIMIT Sans limite + + PREF_INCREMENTAL_LIMIT + Incremental limit check + PREF_BACKFACE Couleur de face arrière