0020971: CEA 422 avoiding display of computed meshes

This commit is contained in:
vsr 2010-10-07 11:47:40 +00:00
parent a77543a265
commit c19d21d073
5 changed files with 58 additions and 23 deletions

View File

@ -67,6 +67,7 @@
<parameter name="scalar_bar_vertical_y" value="0.1" />
<parameter name="DisplayMode" value="true" />
<parameter name="auto_update" value="true" />
<parameter name="update_limit" value="500000" />
<parameter name="display_mode" value="1" />
<parameter name="auto_groups" value="false"/>
<parameter name="show_result_notification" value="2"/>

View File

@ -1330,13 +1330,22 @@ LightApp_SelectionMgr* SMESHGUI::selectionMgr()
return 0;
}
bool SMESHGUI::automaticUpdate()
//=============================================================================
/*!
*
*/
//=============================================================================
bool SMESHGUI::automaticUpdate(unsigned int requestedSize, bool* limitExceeded)
{
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
if ( !resMgr )
return false;
return resMgr->booleanValue( "SMESH", "auto_update", false );
bool autoUpdate = resMgr->booleanValue( "SMESH", "auto_update", false );
long updateLimit = resMgr->integerValue( "SMESH", "update_limit", 500000 );
bool exceeded = updateLimit > 0 && requestedSize > updateLimit;
if ( limitExceeded ) *limitExceeded = autoUpdate && exceeded;
return autoUpdate && !exceeded;
}
//=============================================================================
@ -3821,8 +3830,12 @@ void SMESHGUI::createPreferences()
// General tab ------------------------------------------------------------------------
int genTab = addPreference( tr( "PREF_TAB_GENERAL" ) );
int updateGroup = addPreference( tr( "PREF_GROUP_UPDATE" ), genTab );
addPreference( tr( "PREF_AUTO_UPDATE" ), updateGroup, LightApp_Preferences::Bool, "SMESH", "auto_update" );
int autoUpdate = addPreference( tr( "PREF_AUTO_UPDATE" ), genTab, LightApp_Preferences::Auto, "SMESH", "auto_update" );
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" ) );
int qaGroup = addPreference( tr( "PREF_GROUP_QUALITY" ), genTab );
setPreferenceProperty( qaGroup, "columns", 2 );

View File

@ -77,7 +77,7 @@ public :
bool isActiveStudyLocked();
static bool automaticUpdate();
static bool automaticUpdate(unsigned int requestedSize = 0, bool* limitExceeded = 0);
static void Modified( bool = true );

View File

@ -734,25 +734,36 @@ void SMESHGUI_BaseComputeOp::computeMesh()
// SHOW MESH
// NPAL16631: if ( getSMESHGUI()->automaticUpdate() )
if ( !memoryLack && getSMESHGUI()->automaticUpdate() )
long newSize = myMesh->NbElements();
bool limitExceeded;
if ( !memoryLack )
{
try {
if ( getSMESHGUI()->automaticUpdate( newSize, &limitExceeded ) )
{
try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS;
OCC_CATCH_SIGNALS;
#endif
SMESH::Update(myIObject, true);
}
catch (...) {
SMESH::Update(myIObject, true);
}
catch (...) {
#ifdef _DEBUG_
MESSAGE ( "Exception thrown during mesh visualization" );
MESSAGE ( "Exception thrown during mesh visualization" );
#endif
if ( SMDS_Mesh::CheckMemory(true) ) { // has memory to show warning?
SMESH::OnVisuException();
}
else {
memoryLack = true;
}
if ( SMDS_Mesh::CheckMemory(true) ) { // has memory to show warning?
SMESH::OnVisuException();
}
else {
memoryLack = true;
}
}
}
else if ( limitExceeded )
{
SUIT_MessageBox::warning( desktop(),
tr( "SMESH_WRN_WARNING" ),
tr( "SMESH_WRN_SIZE_LIMIT_EXCEEDED" ) );
}
}
LightApp_SelectionMgr *Sel = selectionMgr();
if ( Sel )
@ -804,7 +815,7 @@ void SMESHGUI_BaseComputeOp::computeMesh()
void SMESHGUI_BaseComputeOp::showComputeResult( const bool theMemoryLack,
const bool theNoCompError,
SMESH::compute_error_array_var& theCompErrors,
const bool theNoHypoError,
const bool theNoHypoError,
const QString& theHypErrors )
{
bool hasShape = myMesh->HasShapeToMesh();
@ -1562,6 +1573,7 @@ void SMESHGUI_PrecomputeOp::onPreview()
SMESH::MeshPreviewStruct_var previewData =
gen->Precompute(myMesh, myMainShape, (SMESH::Dimension)dim, aShapesId);
SMESH::MeshPreviewStruct* previewRes = previewData._retn();
if ( previewRes && previewRes->nodesXYZ.length() > 0 )
{

View File

@ -2060,6 +2060,11 @@ Consider saving your work before application crash</translation>
<source>SMESH_WRN_VIEWER_VTK</source>
<translation>Study frame with VTK Viewer must be activated</translation>
</message>
<message>
<source>SMESH_WRN_SIZE_LIMIT_EXCEEDED</source>
<translation>Mesh size limit has been exceeded.
No automatic update of the presentation has been done.</translation>
</message>
<message>
<source>SMESH_WRN_WARNING</source>
<translation>Warning</translation>
@ -3246,6 +3251,14 @@ Please, create VTK viewer and try again</translation>
<source>PREF_AUTO_UPDATE</source>
<translation>Automatic update</translation>
</message>
<message>
<source>PREF_UPDATE_LIMIT</source>
<translation>Size limit (elements)</translation>
</message>
<message>
<source>PREF_UPDATE_LIMIT_NOLIMIT</source>
<translation>No limit</translation>
</message>
<message>
<source>PREF_BACKFACE</source>
<translation>Back face</translation>
@ -3346,10 +3359,6 @@ Please, create VTK viewer and try again</translation>
<source>PREF_GROUP_SELECTION</source>
<translation>Selection</translation>
</message>
<message>
<source>PREF_GROUP_UPDATE</source>
<translation>Update</translation>
</message>
<message>
<source>PREF_HIGHLIGHT_COLOR</source>
<translation>Highlight color</translation>