]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Export of empty calculation case corrected (Bug #171).
authoradv <adv@opencascade.com>
Thu, 5 Dec 2013 05:23:48 +0000 (05:23 +0000)
committeradv <adv@opencascade.com>
Thu, 5 Dec 2013 05:23:48 +0000 (05:23 +0000)
src/HYDROData/HYDROData_CalculationCase.cxx
src/HYDROGUI/HYDROGUI_ExportCalculationOp.cxx
src/HYDROGUI/resources/HYDROGUI_msg_en.ts

index c93052c84c32f474d055bea871c54ffa95695b3d..e3c408012df7bc11a0a90a9526f7638ae8e3b4e6 100644 (file)
@@ -426,29 +426,32 @@ TopoDS_Shell HYDROData_CalculationCase::GetShell()
   aSewing.Perform();
   TopoDS_Shape aSewedShape = aSewing.SewedShape();
 
-  if ( aSewedShape.ShapeType() == TopAbs_FACE && aCaseRegions.Length() ==1 ) {
-    // create shell from one face
-    BRep_Builder aBuilder;
-    aBuilder.MakeShell( aShell );
-    aBuilder.Add( aShell, aSewedShape);
-  } else {
-    TopExp_Explorer anExpShells( aSewedShape, TopAbs_SHELL );
-    Standard_Integer aNbOfShells = 0;
-    for ( ; anExpShells.More(); anExpShells.Next() ) {
-      aShell = TopoDS::Shell( anExpShells.Current() );
-      aNbOfShells++;
-    }
-
-    if ( aNbOfShells != 1 ) {
-      aShell.Nullify();
+  if ( !aSewedShape.IsNull() )
+  {
+    if ( aSewedShape.ShapeType() == TopAbs_FACE && aCaseRegions.Length() ==1 ) {
+      // create shell from one face
       BRep_Builder aBuilder;
       aBuilder.MakeShell( aShell );
+      aBuilder.Add( aShell, aSewedShape);
+    } else {
+      TopExp_Explorer anExpShells( aSewedShape, TopAbs_SHELL );
+      Standard_Integer aNbOfShells = 0;
+      for ( ; anExpShells.More(); anExpShells.Next() ) {
+        aShell = TopoDS::Shell( anExpShells.Current() );
+        aNbOfShells++;
+      }
 
-      TopExp_Explorer anExpFaces( aSewedShape, TopAbs_FACE );
-      for ( ; anExpFaces.More(); anExpFaces.Next() ) {
-        TopoDS_Face aFace = TopoDS::Face( anExpFaces.Current() );
-        if ( !aFace.IsNull() ) {
-          aBuilder.Add( aShell, aFace );
+      if ( aNbOfShells != 1 ) {
+        aShell.Nullify();
+        BRep_Builder aBuilder;
+        aBuilder.MakeShell( aShell );
+
+        TopExp_Explorer anExpFaces( aSewedShape, TopAbs_FACE );
+        for ( ; anExpFaces.More(); anExpFaces.Next() ) {
+          TopoDS_Face aFace = TopoDS::Face( anExpFaces.Current() );
+          if ( !aFace.IsNull() ) {
+            aBuilder.Add( aShell, aFace );
+          }
         }
       }
     }
index 6344eddd19da49c5dd25dd4c461ee7edf77fab56..77722af36d2ebeeeec1da79c503b4e80235b2e6e 100644 (file)
@@ -80,7 +80,7 @@ bool HYDROGUI_ExportCalculationOp::processApply( int& theUpdateFlags,
       HYDROGUI_Tool::GetSelectedObject( module() ) );
 
   if ( aCalculation.IsNull() ) {
-    theErrorMsg = tr( "EXPORT_FAILED" );
+    theErrorMsg = tr( "NULL_DATA_OBJECT" );
     return false;
   }
 
@@ -125,16 +125,12 @@ bool HYDROGUI_ExportCalculationOp::processApply( int& theUpdateFlags,
         anIsOk = true;
       } 
     }
-  } else {
-    anErrorMsg = tr( "RESULT_SHAPE_NULL" );
-  }
 
-  if ( !anIsOk ) {
-    theErrorMsg = tr( "EXPORT_FAILED" );
+    if ( !anIsOk )
+      theErrorMsg = tr( "IMPOSSIBLE_TO_CREATE_GEOM_SHAPE" );
 
-    if( !anErrorMsg.isEmpty() ) {
-      theErrorMsg.prepend( anErrorMsg + "\n" );
-    }
+  } else {
+    theErrorMsg = tr( "RESULT_SHAPE_NULL" );
   }
 
   return anIsOk;
@@ -176,13 +172,14 @@ void HYDROGUI_ExportCalculationOp::onApply()
   } 
   else {
     abort();
-    QString aMsg = tr( "EXPORT_FAILED" );
-    /* TODO: improve error processing
-    if( !anErrorMsg.isEmpty() )
-      aMsg.prepend( anErrorMsg + "\n" );
-    */
+
+    if ( anErrorMsg.isEmpty() )
+      anErrorMsg = tr( "EXPORT_DATA_FAILED" );
+
+    anErrorMsg.prepend( tr( "EXPORT_FAILED" ) + "\n" );
+
     SUIT_MessageBox::critical( module()->getApp()->desktop(),
                                tr( "EXPORT_STATUS" ),
-                               aMsg ); 
+                               anErrorMsg ); 
   }
 }
\ No newline at end of file
index 5999f7ef165d225dc0d2c69f8d9966ac0de0b750..fe2d0936f1ebb7a79e48c861abf5ecb46f611895 100644 (file)
@@ -1399,11 +1399,23 @@ file cannot be correctly imported for an Obstacle definition.</translation>
     </message>
     <message>
       <source>EXPORT_FAILED</source>
-      <translation>Export failed.</translation>
+      <translation>Export of calculation case failed:</translation>
+    </message>
+    <message>
+      <source>EXPORT_DATA_FAILED</source>
+      <translation>parameters of calculation case is invalid.</translation>
+    </message>
+    <message>
+      <source>NULL_DATA_OBJECT</source>
+      <translation>data model object is null pointer.</translation>
     </message>
     <message>
       <source>RESULT_SHAPE_NULL</source>
-      <translation>Export failed: result shape is null.</translation>
+      <translation>shape of calculation case regions is empty.</translation>
+    </message>
+    <message>
+      <source>IMPOSSIBLE_TO_CREATE_GEOM_SHAPE</source>
+      <translation>something was wrong during publishing of GEOM shape.</translation>
     </message>
     <message>
       <source>OBJ_PREFIX</source>