]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Import bathymetry protection (Bug #203).
authoradv <adv@opencascade.com>
Thu, 26 Dec 2013 10:54:39 +0000 (10:54 +0000)
committeradv <adv@opencascade.com>
Thu, 26 Dec 2013 10:54:39 +0000 (10:54 +0000)
src/HYDROData/HYDROData_Bathymetry.cxx

index 8d679bd2173caa35788541263c04e8a1b7d88461..ec3ed113e0c5de225e20e03100b06f2bf721e9b1 100644 (file)
@@ -4,6 +4,8 @@
 #include "HYDROData_Tool.h"
 #include "HYDROData_PolylineXY.h"
 
+#include <boost/math/special_functions/fpclassify.hpp>
+
 #include <gp_XY.hxx>
 #include <gp_XYZ.hxx>
 
@@ -463,6 +465,11 @@ bool HYDROData_Bathymetry::importFromXYZFile( QFile&          theFile,
     if ( !isXOk || !isYOk || !isZOk )
       return false;
 
+    if ( boost::math::isnan( aPoint.X() ) || boost::math::isinf( aPoint.X() ) ||
+         boost::math::isnan( aPoint.Y() ) || boost::math::isinf( aPoint.Y() ) ||
+         boost::math::isnan( aPoint.Z() ) || boost::math::isinf( aPoint.Z() ) )
+      return false;
+
     // Invert the z value if requested
     if ( anIsAltitudesInverted )
       aPoint.SetZ( -aPoint.Z() );