[QGIS Commit] r14711 - in trunk/qgis/src: analysis/interpolation
app core core/spatialindex/geometry gui plugins/georeferencer
plugins/scale_bar
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Thu Nov 18 15:43:21 EST 2010
Author: jef
Date: 2010-11-18 12:43:21 -0800 (Thu, 18 Nov 2010)
New Revision: 14711
Modified:
trunk/qgis/src/analysis/interpolation/qgsinterpolator.cpp
trunk/qgis/src/analysis/interpolation/qgstininterpolator.cpp
trunk/qgis/src/app/qgsprojectproperties.h
trunk/qgis/src/core/qgis.h
trunk/qgis/src/core/qgsclipper.h
trunk/qgis/src/core/qgspallabeling.cpp
trunk/qgis/src/core/qgspoint.cpp
trunk/qgis/src/core/qgsvectorlayer.cpp
trunk/qgis/src/core/spatialindex/geometry/Region.cc
trunk/qgis/src/gui/qgsquickprint.cpp
trunk/qgis/src/plugins/georeferencer/qgsgeoreftransform.cpp
trunk/qgis/src/plugins/georeferencer/qgsleastsquares.cpp
trunk/qgis/src/plugins/scale_bar/plugin.cpp
Log:
use Qt for isnan/isinf/abs
Modified: trunk/qgis/src/analysis/interpolation/qgsinterpolator.cpp
===================================================================
--- trunk/qgis/src/analysis/interpolation/qgsinterpolator.cpp 2010-11-18 12:20:44 UTC (rev 14710)
+++ trunk/qgis/src/analysis/interpolation/qgsinterpolator.cpp 2010-11-18 20:43:21 UTC (rev 14711)
@@ -83,7 +83,7 @@
continue;
}
attributeValue = att_it.value().toDouble( &attributeConversionOk );
- if ( !attributeConversionOk || isnan( attributeValue ) ) //don't consider vertices with attributes like 'nan' for the interpolation
+ if ( !attributeConversionOk || qIsNaN( attributeValue ) ) //don't consider vertices with attributes like 'nan' for the interpolation
{
continue;
}
Modified: trunk/qgis/src/analysis/interpolation/qgstininterpolator.cpp
===================================================================
--- trunk/qgis/src/analysis/interpolation/qgstininterpolator.cpp 2010-11-18 12:20:44 UTC (rev 14710)
+++ trunk/qgis/src/analysis/interpolation/qgstininterpolator.cpp 2010-11-18 20:43:21 UTC (rev 14711)
@@ -27,8 +27,14 @@
#include "qgsvectorlayer.h"
#include <QProgressDialog>
-QgsTINInterpolator::QgsTINInterpolator( const QList<LayerData>& inputData, TIN_INTERPOLATION interpolation, bool showProgressDialog ): QgsInterpolator( inputData ), mTriangulation( 0 ), \
- mTriangleInterpolator( 0 ), mIsInitialized( false ), mShowProgressDialog( showProgressDialog ), mExportTriangulationToFile( false ), mInterpolation( interpolation )
+QgsTINInterpolator::QgsTINInterpolator( const QList<LayerData>& inputData, TIN_INTERPOLATION interpolation, bool showProgressDialog )
+ : QgsInterpolator( inputData )
+ , mTriangulation( 0 )
+ , mTriangleInterpolator( 0 )
+ , mIsInitialized( false )
+ , mShowProgressDialog( showProgressDialog )
+ , mExportTriangulationToFile( false )
+ , mInterpolation( interpolation )
{
}
@@ -185,7 +191,7 @@
return 3;
}
attributeValue = att_it.value().toDouble( &attributeConversionOk );
- if ( !attributeConversionOk || isnan( attributeValue ) ) //don't consider vertices with attributes like 'nan' for the interpolation
+ if ( !attributeConversionOk || qIsNaN( attributeValue ) ) //don't consider vertices with attributes like 'nan' for the interpolation
{
return 4;
}
Modified: trunk/qgis/src/app/qgsprojectproperties.h
===================================================================
--- trunk/qgis/src/app/qgsprojectproperties.h 2010-11-18 12:20:44 UTC (rev 14710)
+++ trunk/qgis/src/app/qgsprojectproperties.h 2010-11-18 20:43:21 UTC (rev 14711)
@@ -21,7 +21,6 @@
#include "ui_qgsprojectpropertiesbase.h"
#include "qgis.h"
#include "qgisgui.h"
-#include "qgssnappingdialog.h"
#include "qgscontexthelp.h"
class QgsMapCanvas;
Modified: trunk/qgis/src/core/qgis.h
===================================================================
--- trunk/qgis/src/core/qgis.h 2010-11-18 12:20:44 UTC (rev 14710)
+++ trunk/qgis/src/core/qgis.h 2010-11-18 20:43:21 UTC (rev 14711)
@@ -18,20 +18,12 @@
#ifndef QGIS_H
#define QGIS_H
+
#include <QEvent>
#include <QString>
#include <cfloat>
-
-#ifndef Q_OS_MACX
#include <cmath>
-#else
-#include <math.h>
-#endif
-#ifdef WIN32
-#include <float.h>
-#define isnan(f) _isnan(f)
-#define isinf(f) (!_finite(f) && !_isnan(f))
-#endif
+#include <qnumeric.h>
/** \ingroup core
* The QGis class provides global constants for use throughout the application.
Modified: trunk/qgis/src/core/qgsclipper.h
===================================================================
--- trunk/qgis/src/core/qgsclipper.h 2010-11-18 12:20:44 UTC (rev 14710)
+++ trunk/qgis/src/core/qgsclipper.h 2010-11-18 20:43:21 UTC (rev 14711)
@@ -157,8 +157,8 @@
// look at each edge of the polygon in turn
//ignore segments with nan or inf coordinates
- if ( isnan( inX[i2] ) || isnan( inY[i2] ) || isinf( inX[i2] ) || isinf( inY[i2] )
- || isnan( inX[i1] ) || isnan( inY[i1] ) || isinf( inX[i1] ) || isinf( inY[i1] ) )
+ if ( qIsNaN( inX[i2] ) || qIsNaN( inY[i2] ) || qIsInf( inX[i2] ) || qIsInf( inY[i2] )
+ || qIsNaN( inX[i1] ) || qIsNaN( inY[i1] ) || qIsInf( inX[i1] ) || qIsInf( inY[i1] ) )
{
i1 = i2;
continue;
@@ -268,7 +268,7 @@
QgsPoint p;
- if ( std::abs( r_d ) > SMALL_NUM && std::abs( r_n ) > SMALL_NUM )
+ if ( qAbs( r_d ) > SMALL_NUM && qAbs( r_n ) > SMALL_NUM )
{ // they cross
double r = r_n / r_d;
p.set( x1 + r*( x2 - x1 ), y1 + r*( y2 - y1 ) );
@@ -277,7 +277,7 @@
{
// Should never get here, but if we do for some reason, cause a
// clunk because something else is wrong if we do.
- Q_ASSERT( std::abs( r_d ) > SMALL_NUM && std::abs( r_n ) > SMALL_NUM );
+ Q_ASSERT( qAbs( r_d ) > SMALL_NUM && qAbs( r_n ) > SMALL_NUM );
}
return p;
Modified: trunk/qgis/src/core/qgspallabeling.cpp
===================================================================
--- trunk/qgis/src/core/qgspallabeling.cpp 2010-11-18 12:20:44 UTC (rev 14710)
+++ trunk/qgis/src/core/qgspallabeling.cpp 2010-11-18 20:43:21 UTC (rev 14711)
@@ -453,7 +453,7 @@
//data defined position / alignment / rotation?
bool dataDefinedPosition = false;
bool dataDefinedRotation = false;
- double xPos, yPos, angle;
+ double xPos = 0.0, yPos = 0.0, angle = 0.0;
bool ddXPos, ddYPos;
QMap< DataDefinedProperties, int >::const_iterator dPosXIt = dataDefinedProperties.find( QgsPalLayerSettings::PositionX );
Modified: trunk/qgis/src/core/qgspoint.cpp
===================================================================
--- trunk/qgis/src/core/qgspoint.cpp 2010-11-18 12:20:44 UTC (rev 14710)
+++ trunk/qgis/src/core/qgspoint.cpp 2010-11-18 20:43:21 UTC (rev 14711)
@@ -137,12 +137,12 @@
QString QgsPoint::toDegreesMinutesSeconds( int thePrecision ) const
{
int myDegreesX = int( std::abs( m_x ) );
- float myFloatMinutesX = float(( std::abs( m_x ) - myDegreesX ) * 60 );
+ float myFloatMinutesX = float(( qAbs( m_x ) - myDegreesX ) * 60 );
int myIntMinutesX = int( myFloatMinutesX );
float mySecondsX = float( myFloatMinutesX - myIntMinutesX ) * 60;
int myDegreesY = int( std::abs( m_y ) );
- float myFloatMinutesY = float(( std::abs( m_y ) - myDegreesY ) * 60 );
+ float myFloatMinutesY = float(( qAbs( m_y ) - myDegreesY ) * 60 );
int myIntMinutesY = int( myFloatMinutesY );
float mySecondsY = float( myFloatMinutesY - myIntMinutesY ) * 60;
Modified: trunk/qgis/src/core/qgsvectorlayer.cpp
===================================================================
--- trunk/qgis/src/core/qgsvectorlayer.cpp 2010-11-18 12:20:44 UTC (rev 14710)
+++ trunk/qgis/src/core/qgsvectorlayer.cpp 2010-11-18 20:43:21 UTC (rev 14711)
@@ -426,8 +426,8 @@
// the rest of them so end the loop at that point.
for ( register unsigned int i = 0; i < nPoints; ++i )
{
- if ( std::abs( x[i] ) > QgsClipper::MAX_X ||
- std::abs( y[i] ) > QgsClipper::MAX_Y )
+ if ( qAbs( x[i] ) > QgsClipper::MAX_X ||
+ qAbs( y[i] ) > QgsClipper::MAX_Y )
{
QgsClipper::trimFeature( x, y, true ); // true = polyline
nPoints = x.size(); // trimming may change nPoints.
@@ -546,8 +546,8 @@
// the rest of them so end the loop at that point.
for ( register unsigned int i = 0; i < nPoints; ++i )
{
- if ( std::abs( ring->first[i] ) > QgsClipper::MAX_X ||
- std::abs( ring->second[i] ) > QgsClipper::MAX_Y )
+ if ( qAbs( ring->first[i] ) > QgsClipper::MAX_X ||
+ qAbs( ring->second[i] ) > QgsClipper::MAX_Y )
{
QgsClipper::trimFeature( ring->first, ring->second, false );
break;
@@ -4037,8 +4037,8 @@
double y = *(( double * )( feature + 5 + sizeof( double ) ) );
transformPoint( x, y, &renderContext.mapToPixel(), renderContext.coordinateTransform() );
- if ( std::abs( x ) > QgsClipper::MAX_X ||
- std::abs( y ) > QgsClipper::MAX_Y )
+ if ( qAbs( x ) > QgsClipper::MAX_X ||
+ qAbs( y ) > QgsClipper::MAX_Y )
{
break;
}
@@ -4085,8 +4085,8 @@
//QPointF pt( x, y );
// Work around a +/- 32768 limitation on coordinates
- if ( std::abs( x ) > QgsClipper::MAX_X ||
- std::abs( y ) > QgsClipper::MAX_Y )
+ if ( qAbs( x ) > QgsClipper::MAX_X ||
+ qAbs( y ) > QgsClipper::MAX_Y )
needToTrim = true;
else
p->drawImage( pt, *marker );
Modified: trunk/qgis/src/core/spatialindex/geometry/Region.cc
===================================================================
--- trunk/qgis/src/core/spatialindex/geometry/Region.cc 2010-11-18 12:20:44 UTC (rev 14710)
+++ trunk/qgis/src/core/spatialindex/geometry/Region.cc 2010-11-18 20:43:21 UTC (rev 14711)
@@ -306,11 +306,11 @@
if ( r.m_pHigh[i] < m_pLow[i] )
{
- x = std::abs( r.m_pHigh[i] - m_pLow[i] );
+ x = qAbs( r.m_pHigh[i] - m_pLow[i] );
}
else if ( m_pHigh[i] < r.m_pLow[i] )
{
- x = std::abs( r.m_pLow[i] - m_pHigh[i] );
+ x = qAbs( r.m_pLow[i] - m_pHigh[i] );
}
ret += x * x;
Modified: trunk/qgis/src/gui/qgsquickprint.cpp
===================================================================
--- trunk/qgis/src/gui/qgsquickprint.cpp 2010-11-18 12:20:44 UTC (rev 14710)
+++ trunk/qgis/src/gui/qgsquickprint.cpp 2010-11-18 20:43:21 UTC (rev 14711)
@@ -798,7 +798,7 @@
//Get map units per pixel. This can be negative at times (to do with
//projections) and that just confuses the rest of the code in this
//function, so force to a positive number.
- double myMapUnitsPerPixelDouble = std::abs( thepMapRenderer->mapUnitsPerPixel() );
+ double myMapUnitsPerPixelDouble = qAbs( thepMapRenderer->mapUnitsPerPixel() );
//
// Exit if the canvas width is 0 or layercount is 0 or QGIS will freeze
int myLayerCount = thepMapRenderer->layerSet().count();
Modified: trunk/qgis/src/plugins/georeferencer/qgsgeoreftransform.cpp
===================================================================
--- trunk/qgis/src/plugins/georeferencer/qgsgeoreftransform.cpp 2010-11-18 12:20:44 UTC (rev 14710)
+++ trunk/qgis/src/plugins/georeferencer/qgsgeoreftransform.cpp 2010-11-18 20:43:21 UTC (rev 14711)
@@ -372,8 +372,8 @@
else
{
// Guard against division by zero
- if ( abs( t->scaleX ) < std::numeric_limits<double>::epsilon() ||
- abs( t->scaleY ) < std::numeric_limits<double>::epsilon() )
+ if ( qAbs( t->scaleX ) < std::numeric_limits<double>::epsilon() ||
+ qAbs( t->scaleY ) < std::numeric_limits<double>::epsilon() )
{
for ( int i = 0; i < nPointCount; ++i )
{
@@ -591,7 +591,7 @@
double det = H[0] * adjoint[0] + H[3] * adjoint[1] + H[6] * adjoint[2];
- if ( std::abs( det ) < 1024.0*std::numeric_limits<double>::epsilon() )
+ if ( qAbs( det ) < 1024.0*std::numeric_limits<double>::epsilon() )
{
mParameters.hasInverse = false;
}
@@ -644,7 +644,7 @@
{
double Z = x[i] * H[6] + y[i] * H[7] + H[8];
// Projects to infinity?
- if ( std::abs( Z ) < 1024.0*std::numeric_limits<double>::epsilon() )
+ if ( qAbs( Z ) < 1024.0*std::numeric_limits<double>::epsilon() )
{
panSuccess[i] = false;
continue;
Modified: trunk/qgis/src/plugins/georeferencer/qgsleastsquares.cpp
===================================================================
--- trunk/qgis/src/plugins/georeferencer/qgsleastsquares.cpp 2010-11-18 12:20:44 UTC (rev 14710)
+++ trunk/qgis/src/plugins/georeferencer/qgsleastsquares.cpp 2010-11-18 20:43:21 UTC (rev 14711)
@@ -59,8 +59,8 @@
origin.setX( aX );
origin.setY( aY );
- pixelXSize = std::abs( bX );
- pixelYSize = std::abs( bY );
+ pixelXSize = qAbs( bX );
+ pixelYSize = qAbs( bY );
}
Modified: trunk/qgis/src/plugins/scale_bar/plugin.cpp
===================================================================
--- trunk/qgis/src/plugins/scale_bar/plugin.cpp 2010-11-18 12:20:44 UTC (rev 14710)
+++ trunk/qgis/src/plugins/scale_bar/plugin.cpp 2010-11-18 20:43:21 UTC (rev 14711)
@@ -191,7 +191,7 @@
//Get map units per pixel. This can be negative at times (to do with
//projections) and that just confuses the rest of the code in this
//function, so force to a positive number.
- double myMapUnitsPerPixelDouble = std::abs( qGisInterface->mapCanvas()->mapUnitsPerPixel() );
+ double myMapUnitsPerPixelDouble = qAbs( qGisInterface->mapCanvas()->mapUnitsPerPixel() );
// Exit if the canvas width is 0 or layercount is 0 or QGIS will freeze
int myLayerCount = qGisInterface->mapCanvas()->layerCount();
More information about the QGIS-commit
mailing list