]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
0020971: CEA 422 avoiding display of computed meshes
authorvsr <vsr@opencascade.com>
Thu, 7 Oct 2010 11:47:40 +0000 (11:47 +0000)
committervsr <vsr@opencascade.com>
Thu, 7 Oct 2010 11:47:40 +0000 (11:47 +0000)
resources/SalomeApp.xml
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESHGUI.h
src/SMESHGUI/SMESHGUI_ComputeDlg.cxx
src/SMESHGUI/SMESH_msg_en.ts

index a1806b5cd5b6e53bae2db01088519fb2850bfbba..b7993a340edf69ebd05615a84c3dd73a8a9d4d97 100644 (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"/>
index 4867a2ca1fa7aef924b942d7a099aa645afe5a82..a81fdaec4152a3657757b63b140c5506621f1844 100644 (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 );
index 4a82e5c1a8b0b08e430cc254965affb14b5ad741..bb2b29c043327e39d8300d011fbec3bb729b414a 100644 (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 );
 
index ccd700190a6f67b26a9e24799aeee12d78270eaa..01891fc8137735dab51b99c167baa5a1fbb68d26 100644 (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 )
     {
index 4a3a32e3ff95254ed5db14ed69d3f0779d54560c..d3482c48b8c60e224ed02bc11cd1b01237673407 100644 (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>