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="scalar_bar_vertical_y" value="0.1" />
<parameter name="DisplayMode" value="true" /> <parameter name="DisplayMode" value="true" />
<parameter name="auto_update" value="true" /> <parameter name="auto_update" value="true" />
<parameter name="update_limit" value="500000" />
<parameter name="display_mode" value="1" /> <parameter name="display_mode" value="1" />
<parameter name="auto_groups" value="false"/> <parameter name="auto_groups" value="false"/>
<parameter name="show_result_notification" value="2"/> <parameter name="show_result_notification" value="2"/>

View File

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

View File

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

View File

@ -734,7 +734,11 @@ void SMESHGUI_BaseComputeOp::computeMesh()
// SHOW MESH // SHOW MESH
// NPAL16631: if ( getSMESHGUI()->automaticUpdate() ) // NPAL16631: if ( getSMESHGUI()->automaticUpdate() )
if ( !memoryLack && getSMESHGUI()->automaticUpdate() ) long newSize = myMesh->NbElements();
bool limitExceeded;
if ( !memoryLack )
{
if ( getSMESHGUI()->automaticUpdate( newSize, &limitExceeded ) )
{ {
try { try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
@ -754,6 +758,13 @@ void SMESHGUI_BaseComputeOp::computeMesh()
} }
} }
} }
else if ( limitExceeded )
{
SUIT_MessageBox::warning( desktop(),
tr( "SMESH_WRN_WARNING" ),
tr( "SMESH_WRN_SIZE_LIMIT_EXCEEDED" ) );
}
}
LightApp_SelectionMgr *Sel = selectionMgr(); LightApp_SelectionMgr *Sel = selectionMgr();
if ( Sel ) if ( Sel )
{ {
@ -1562,6 +1573,7 @@ void SMESHGUI_PrecomputeOp::onPreview()
SMESH::MeshPreviewStruct_var previewData = SMESH::MeshPreviewStruct_var previewData =
gen->Precompute(myMesh, myMainShape, (SMESH::Dimension)dim, aShapesId); gen->Precompute(myMesh, myMainShape, (SMESH::Dimension)dim, aShapesId);
SMESH::MeshPreviewStruct* previewRes = previewData._retn(); SMESH::MeshPreviewStruct* previewRes = previewData._retn();
if ( previewRes && previewRes->nodesXYZ.length() > 0 ) 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> <source>SMESH_WRN_VIEWER_VTK</source>
<translation>Study frame with VTK Viewer must be activated</translation> <translation>Study frame with VTK Viewer must be activated</translation>
</message> </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> <message>
<source>SMESH_WRN_WARNING</source> <source>SMESH_WRN_WARNING</source>
<translation>Warning</translation> <translation>Warning</translation>
@ -3246,6 +3251,14 @@ Please, create VTK viewer and try again</translation>
<source>PREF_AUTO_UPDATE</source> <source>PREF_AUTO_UPDATE</source>
<translation>Automatic update</translation> <translation>Automatic update</translation>
</message> </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> <message>
<source>PREF_BACKFACE</source> <source>PREF_BACKFACE</source>
<translation>Back face</translation> <translation>Back face</translation>
@ -3346,10 +3359,6 @@ Please, create VTK viewer and try again</translation>
<source>PREF_GROUP_SELECTION</source> <source>PREF_GROUP_SELECTION</source>
<translation>Selection</translation> <translation>Selection</translation>
</message> </message>
<message>
<source>PREF_GROUP_UPDATE</source>
<translation>Update</translation>
</message>
<message> <message>
<source>PREF_HIGHLIGHT_COLOR</source> <source>PREF_HIGHLIGHT_COLOR</source>
<translation>Highlight color</translation> <translation>Highlight color</translation>