From cb0d9f093048fb83b0a400e893b5e6d9d5344703 Mon Sep 17 00:00:00 2001 From: Magnus Homann Date: Wed, 29 Aug 2012 00:09:37 +0200 Subject: [PATCH] Small tidying up, replacing with GEO_NONE --- src/app/qgsmaptoolfeatureaction.cpp | 2 -- src/app/qgsmaptoolidentify.cpp | 2 +- src/app/qgsoptions.cpp | 2 +- src/core/qgsdistancearea.cpp | 2 +- src/core/qgsexpression.cpp | 14 +++++++------- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/app/qgsmaptoolfeatureaction.cpp b/src/app/qgsmaptoolfeatureaction.cpp index 7ab38736e65..e33e2caa196 100644 --- a/src/app/qgsmaptoolfeatureaction.cpp +++ b/src/app/qgsmaptoolfeatureaction.cpp @@ -15,7 +15,6 @@ #include "qgsmaptoolfeatureaction.h" -#include "qgsdistancearea.h" #include "qgsfeature.h" #include "qgsfield.h" #include "qgsgeometry.h" @@ -111,7 +110,6 @@ bool QgsMapToolFeatureAction::doAction( QgsVectorLayer *layer, int x, int y ) // load identify radius from settings QSettings settings; double identifyValue = settings.value( "/Map/identifyRadius", QGis::DEFAULT_IDENTIFY_RADIUS ).toDouble(); - QString ellipsoid = settings.value( "/qgis/measure/ellipsoid", "WGS84" ).toString(); if ( identifyValue <= 0.0 ) identifyValue = QGis::DEFAULT_IDENTIFY_RADIUS; diff --git a/src/app/qgsmaptoolidentify.cpp b/src/app/qgsmaptoolidentify.cpp index f7773c322e6..56476d608ce 100644 --- a/src/app/qgsmaptoolidentify.cpp +++ b/src/app/qgsmaptoolidentify.cpp @@ -204,7 +204,7 @@ bool QgsMapToolIdentify::identifyVectorLayer( QgsVectorLayer *layer, int x, int // load identify radius from settings QSettings settings; double identifyValue = settings.value( "/Map/identifyRadius", QGis::DEFAULT_IDENTIFY_RADIUS ).toDouble(); - QString ellipsoid = settings.value( "/qgis/measure/ellipsoid", "WGS84" ).toString(); + QString ellipsoid = settings.value( "/qgis/measure/ellipsoid", GEO_NONE ).toString(); if ( identifyValue <= 0.0 ) identifyValue = QGis::DEFAULT_IDENTIFY_RADIUS; diff --git a/src/app/qgsoptions.cpp b/src/app/qgsoptions.cpp index 0414c93711a..7f17f7dd38b 100644 --- a/src/app/qgsoptions.cpp +++ b/src/app/qgsoptions.cpp @@ -283,7 +283,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) : getEllipsoidList(); // Pre-select current ellipsoid - QString myEllipsoidId = settings.value( "/qgis/measure/ellipsoid", "WGS84" ).toString(); + QString myEllipsoidId = settings.value( "/qgis/measure/ellipsoid", GEO_NONE ).toString(); cmbEllipsoid->setCurrentIndex( cmbEllipsoid->findText( getEllipsoidName( myEllipsoidId ), Qt::MatchExactly ) ); // Check if CRS transformation is on, or else turn combobox off if ( QgisApp::instance()->mapCanvas()->mapRenderer()->hasCrsTransformEnabled() ) diff --git a/src/core/qgsdistancearea.cpp b/src/core/qgsdistancearea.cpp index 7efadc32615..67d3c495886 100644 --- a/src/core/qgsdistancearea.cpp +++ b/src/core/qgsdistancearea.cpp @@ -44,7 +44,7 @@ QgsDistanceArea::QgsDistanceArea() mEllipsoidalMode = false; mCoordTransform = new QgsCoordinateTransform; setSourceCrs( GEOCRS_ID ); // WGS 84 - setEllipsoid( "WGS84" ); + setEllipsoid( GEO_NONE ); } diff --git a/src/core/qgsexpression.cpp b/src/core/qgsexpression.cpp index 4c13fdaf11d..b8a628a2c3a 100644 --- a/src/core/qgsexpression.cpp +++ b/src/core/qgsexpression.cpp @@ -773,15 +773,15 @@ static QVariant fcnRound( const QVariantList& values , QgsFeature *f, QgsExpress Q_UNUSED( f ); if ( values.length() == 2 ) { - double number = getDoubleValue( values.at( 0 ), parent ); - double scaler = pow( 10.0, getIntValue( values.at( 1 ), parent ) ); - return QVariant( qRound( number * scaler ) / scaler ); + double number = getDoubleValue( values.at( 0 ), parent ); + double scaler = pow( 10.0, getIntValue( values.at( 1 ), parent ) ); + return QVariant( round( number * scaler ) / scaler ); } if ( values.length() == 1 ) { - double number = getIntValue( values.at( 0 ), parent ); - return QVariant( qRound( number) ).toInt(); + double number = getIntValue( values.at( 0 ), parent ); + return QVariant( round( number ) ).toInt(); } return QVariant(); @@ -933,10 +933,10 @@ bool QgsExpression::needsGeometry() void QgsExpression::initGeomCalculator() { mCalc = new QgsDistanceArea; - mCalc->setEllipsoidalMode( false ); QSettings settings; - QString ellipsoid = settings.value( "/qgis/measure/ellipsoid", "WGS84" ).toString(); + QString ellipsoid = settings.value( "/qgis/measure/ellipsoid", GEO_NONE ).toString(); mCalc->setEllipsoid( ellipsoid ); + mCalc->setEllipsoidalMode( false ); } bool QgsExpression::prepare( const QgsFieldMap& fields )