Salome HOME
Merge from V5_1_main branch 24/11/2010
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_ComputeDlg.cxx
index ccd700190a6f67b26a9e24799aeee12d78270eaa..b31a1b8e9685f65a227f377bb0664455697bc335 100644 (file)
@@ -98,6 +98,7 @@
 
 #define COLONIZE(str)   (QString(str).contains(":") > 0 ? QString(str) : QString(str) + " :" )
 
+/* OBSOLETE
 static void addSeparator( QWidget* parent )
 {
   QGridLayout* l = qobject_cast<QGridLayout*>( parent->layout() );
@@ -109,6 +110,7 @@ static void addSeparator( QWidget* parent )
     l->addWidget( hline, row, i );
   }
 }
+*/
 
 enum TCol {
   COL_ALGO = 0, COL_SHAPE, COL_ERROR, COL_SHAPEID, COL_PUBLISHED, COL_BAD_MESH, NB_COLUMNS
@@ -734,25 +736,38 @@ void SMESHGUI_BaseComputeOp::computeMesh()
 
       // SHOW MESH
       // NPAL16631: if ( getSMESHGUI()->automaticUpdate() )
-      if ( !memoryLack && getSMESHGUI()->automaticUpdate() )
+      SUIT_ResourceMgr* resMgr = SMESH::GetResourceMgr( SMESHGUI::GetSMESHGUI() );
+      long newSize = myMesh->NbElements();
+      long limitSize = resMgr->integerValue( "SMESH", "update_limit", 500000 );
+      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" ).arg( newSize ).arg( limitSize ) );
+       }
       }
       LightApp_SelectionMgr *Sel = selectionMgr();
       if ( Sel )
@@ -804,7 +819,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 +1577,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 )
     {