]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
refs #1848: additional warning if importing of xy/xyz poly fails
authorisn <isn@opencascade.com>
Fri, 11 Jan 2019 17:25:14 +0000 (20:25 +0300)
committerisn <isn@opencascade.com>
Fri, 11 Jan 2019 17:26:07 +0000 (20:26 +0300)
Signed-off-by: isn <isn@opencascade.com>
src/HYDROData/HYDROData_Tool.cxx
src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx

index 9ad6eccc7fcd662ab8365db5bc0ee51f1e6ee4c5..f5b1acfc0e4942c06bc3950c203f99939c95a26e 100755 (executable)
@@ -749,10 +749,16 @@ bool HYDROData_Tool::importFromXYZ( QString& theFileName,
       z = 0;
 
       if( sscanf( aLine.c_str(), "%lf %lf %lf", &x, &y, &z )!=3 )
+      {
+        aFile.close();
         return false;
+      }
 
       if (!AddXYZ(bImportXY, x, y, z, thePointsXYZ, thePointsXY ))
+      {
+        aFile.close();
         return false;
+      }
     }
   }
   else if (aFileSuf == "xy" )
@@ -767,10 +773,16 @@ bool HYDROData_Tool::importFromXYZ( QString& theFileName,
       y = 0;
 
       if( sscanf( aLine.c_str(), "%lf %lf", &x, &y )!=2 )
+      {
+        aFile.close();
         return false;
+      }
 
       if (!AddXYZ(true, x, y, 0, thePointsXYZ, thePointsXY ))
+      {
+        aFile.close();
         return false;
+      }
     }
   }
 
index 6697b42010576b0f68c513458fd002f654cf7009..8889bd5c45d786d185948146f1d5f6474c5e562e 100644 (file)
@@ -199,11 +199,13 @@ NCollection_Sequence<Handle(HYDROData_Entity)> HYDROGUI_ImportPolylineOp::Import
     }
     else if ( anExt == "xy" || (importXY && anExt == "xyz"))
     {
-      HYDROData_Tool::importPolylineFromXYZ(aFileName, theDocument, true, importedEntities);   
+      if (!HYDROData_Tool::importPolylineFromXYZ(aFileName, theDocument, true, importedEntities))
+        SUIT_MessageBox::warning( module->getApp()->desktop(), tr( "IMPORT_POLYLINE" ), tr( "NO_ONE_POLYLINE_IMPORTED" ));
     }
     else if (anExt == "xyz")
     {
-      HYDROData_Tool::importPolylineFromXYZ(aFileName, theDocument, false, importedEntities);
+      if (!HYDROData_Tool::importPolylineFromXYZ(aFileName, theDocument, false, importedEntities))
+        SUIT_MessageBox::warning( module->getApp()->desktop(), tr( "IMPORT_POLYLINE" ), tr( "NO_ONE_POLYLINE_IMPORTED" ));
     }
   }
   return importedEntities;