From ae4547df80826c3456f431a208639fae5da847aa Mon Sep 17 00:00:00 2001 From: larsl Date: Sat, 12 Jun 2004 22:02:12 +0000 Subject: [PATCH] Make 'no data' handling consistent in the GPX provider and remove isnan() since it breaks Windows builds git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@1566 c8812cc2-4d05-0410-92ff-de0c093fc19c --- providers/gpx/gpsdata.cpp | 2 +- providers/gpx/gpsdata.h | 5 +---- providers/gpx/qgsgpxprovider.cpp | 4 ++-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/providers/gpx/gpsdata.cpp b/providers/gpx/gpsdata.cpp index c16b6f349d8..3e318f1ba90 100644 --- a/providers/gpx/gpsdata.cpp +++ b/providers/gpx/gpsdata.cpp @@ -24,7 +24,7 @@ GPSPoint::GPSPoint() { - ele = DOUBLE_NA; + ele = -std::numeric_limits::max(); } diff --git a/providers/gpx/gpsdata.h b/providers/gpx/gpsdata.h index 8e64b53357a..998332d39e4 100644 --- a/providers/gpx/gpsdata.h +++ b/providers/gpx/gpsdata.h @@ -30,9 +30,6 @@ #include "../../src/qgsrect.h" -#define DOUBLE_NA (std::numeric_limits::signaling_NaN()) - - /** This is the parent class for all GPS data classes (except tracksegment). It contains the variables that all GPS objects can have. */ @@ -138,7 +135,7 @@ class GPSData { successfully its index will be returned, otherwise a negative number will be returned. */ int addWaypoint(double lat, double lon, std::string name = "", - double ele = DOUBLE_NA); + double ele = -std::numeric_limits::max()); /** This function tries to add a new route. If the route was added successfully its index will be returned, otherwise a negative number diff --git a/providers/gpx/qgsgpxprovider.cpp b/providers/gpx/qgsgpxprovider.cpp index fdd079937e0..951928d48df 100644 --- a/providers/gpx/qgsgpxprovider.cpp +++ b/providers/gpx/qgsgpxprovider.cpp @@ -147,7 +147,7 @@ QgsFeature *QgsGPXProvider::getNextFeature(bool fetchAttributes) { result->addAttribute("name", wpt.name.c_str()); result->addAttribute("lat", QString("%1").arg(wpt.lat)); result->addAttribute("lon", QString("%1").arg(wpt.lon)); - if (isnan(wpt.ele)) + if (wpt.ele == -std::numeric_limits::max()) result->addAttribute("ele", ""); else result->addAttribute("ele", QString("%1").arg(wpt.ele)); @@ -279,7 +279,7 @@ QgsFeature * QgsGPXProvider::getNextFeature(std::list& attlist) { result->addAttribute("lon", QString("%1").arg(wpt.lon)); break; case 3: - if (isnan(wpt.ele)) + if (wpt.ele == -std::numeric_limits::max()) result->addAttribute("ele", ""); else result->addAttribute("ele", QString("%1").arg(wpt.ele));