0022169: [CEA 750] Chose before visualization mesh element type to display

This commit is contained in:
vsr 2013-06-21 05:33:07 +00:00
parent 9ad61d3503
commit bcb546c1b2
6 changed files with 121 additions and 7 deletions

View File

@ -77,6 +77,7 @@
<parameter name="distribution_color" value="0, 85, 0" />
<parameter name="DisplayMode" value="true" />
<parameter name="auto_update" value="true" />
<parameter name="incremental_limit" value="false" />
<parameter name="update_limit" value="500000" />
<parameter name="display_entity" value="true" />
<parameter name="display_mode" value="1" />

View File

@ -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 );

View File

@ -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 );

View File

@ -33,6 +33,7 @@
#include "SMESHGUI_MeshOrderOp.h"
#include "SMESHGUI_MeshOrderDlg.h"
#include "SMESH_Actor.h"
#include "SMESH_ActorUtils.h"
#include <SMDS_SetIterator.hxx>
@ -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();

View File

@ -2719,6 +2719,12 @@ Consider saving your work before application crash</translation>
<source>SMESH_WRN_SIZE_LIMIT_EXCEEDED</source>
<translation>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.
</translation>
</message>
<message>
<source>SMESH_WRN_SIZE_INC_LIMIT_EXCEEDED</source>
<translation>New mesh sise (%1 elements) exceeds current size limit (%2 elements).
Not all mesh elements are shown. Please check preferences of Mesh module.
</translation>
</message>
<message>
@ -4167,6 +4173,10 @@ Please, create VTK viewer and try again</translation>
<source>PREF_UPDATE_LIMIT_NOLIMIT</source>
<translation>No limit</translation>
</message>
<message>
<source>PREF_INCREMENTAL_LIMIT</source>
<translation>Incremental limit check</translation>
</message>
<message>
<source>PREF_BACKFACE</source>
<translation>Back surface color</translation>

View File

@ -2687,6 +2687,12 @@ Enregistrez votre travail avant que l&apos;application se plante</translation>
<source>SMESH_WRN_SIZE_LIMIT_EXCEEDED</source>
<translation>La présentation n&apos;a pas é 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.
</translation>
</message>
<message>
<source>SMESH_WRN_SIZE_INC_LIMIT_EXCEEDED</source>
<translation type="unfinished">New mesh sise (%1 elements) exceeds current size limit (%2 elements).
Not all mesh elements are shown. Please check preferences of Mesh module.
</translation>
</message>
<message>
@ -4127,6 +4133,10 @@ Ouvrez une fenêtre VTK et essayez de nouveau</translation>
<source>PREF_UPDATE_LIMIT_NOLIMIT</source>
<translation>Sans limite</translation>
</message>
<message>
<source>PREF_INCREMENTAL_LIMIT</source>
<translation type="unfinished">Incremental limit check</translation>
</message>
<message>
<source>PREF_BACKFACE</source>
<translation>Couleur de face arrière</translation>