[QGIS Commit] r15138 - trunk/qgis/src/core
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Tue Feb 8 03:40:37 EST 2011
Author: mhugent
Date: 2011-02-08 00:40:37 -0800 (Tue, 08 Feb 2011)
New Revision: 15138
Modified:
trunk/qgis/src/core/qgsrectangle.cpp
Log:
Use qIsNaN and qIsInf for QgsRectangle::isFinite
Modified: trunk/qgis/src/core/qgsrectangle.cpp
===================================================================
--- trunk/qgis/src/core/qgsrectangle.cpp 2011-02-08 07:17:12 UTC (rev 15137)
+++ trunk/qgis/src/core/qgsrectangle.cpp 2011-02-08 08:40:37 UTC (rev 15138)
@@ -21,6 +21,7 @@
#include <limits>
#include <QString>
#include <QTextStream>
+#include <qnumeric.h>
#include "qgspoint.h"
#include "qgsrectangle.h"
@@ -306,18 +307,13 @@
bool QgsRectangle::isFinite() const
{
- if ( std::numeric_limits<double>::has_infinity )
+ if ( qIsInf( xmin ) || qIsInf( ymin ) || qIsInf( xmax ) || qIsInf( ymax ) )
{
- if ( xmin == std::numeric_limits<double>::infinity() ||
- xmax == std::numeric_limits<double>::infinity() ||
- ymin == std::numeric_limits<double>::infinity() ||
- ymax == std::numeric_limits<double>::infinity() )
- return false;
+ return false;
}
- // By design, if a variable is nan, it won't equal itself, so that's
- // how we test for nan
- if ( xmin != xmin || xmax != xmax || ymin != ymin || ymax != ymax )
+ if ( qIsNaN( xmin ) || qIsNaN( ymin ) || qIsNaN( xmax ) || qIsNaN( ymax ) )
+ {
return false;
-
+ }
return true;
}
More information about the QGIS-commit
mailing list