From: isn Date: Fri, 11 Jan 2019 17:25:14 +0000 (+0300) Subject: refs #1848: additional warning if importing of xy/xyz poly fails X-Git-Tag: SH_V2_2_0~99^2~39^2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5b6451a24c57b798af3888c081f95a7d3a1e24a4;p=modules%2Fhydro.git refs #1848: additional warning if importing of xy/xyz poly fails Signed-off-by: isn --- diff --git a/src/HYDROData/HYDROData_Tool.cxx b/src/HYDROData/HYDROData_Tool.cxx index 9ad6eccc..f5b1acfc 100755 --- a/src/HYDROData/HYDROData_Tool.cxx +++ b/src/HYDROData/HYDROData_Tool.cxx @@ -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; + } } } diff --git a/src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx b/src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx index 6697b420..8889bd5c 100644 --- a/src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx @@ -199,11 +199,13 @@ NCollection_Sequence 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;