Skip to content

Commit

Permalink
Use qgsRound in some more places
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Sep 18, 2018
1 parent 992fe4d commit 0da1e33
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/core/expression/qgsexpressionfunction.cpp
Expand Up @@ -3403,8 +3403,7 @@ static QVariant fcnRound( const QVariantList &values, const QgsExpressionContext
if ( values.length() == 2 && values.at( 1 ).toInt() != 0 )
{
double number = QgsExpressionUtils::getDoubleValue( values.at( 0 ), parent );
double scaler = std::pow( 10.0, QgsExpressionUtils::getIntValue( values.at( 1 ), parent ) );
return QVariant( std::round( number * scaler ) / scaler );
return qgsRound( number, QgsExpressionUtils::getIntValue( values.at( 1 ), parent ) );
}

if ( values.length() >= 1 )
Expand Down
2 changes: 1 addition & 1 deletion src/core/layout/qgslayoutitemmapgrid.cpp
Expand Up @@ -1376,7 +1376,7 @@ QString QgsLayoutItemMapGrid::gridAnnotationString( double value, QgsLayoutItemM
{
QString hemisphere;

double coordRounded = std::round( value * std::pow( 10.0, mGridAnnotationPrecision ) ) / std::pow( 10.0, mGridAnnotationPrecision );
double coordRounded = qgsRound( value, mGridAnnotationPrecision );
if ( coord == QgsLayoutItemMapGrid::Longitude )
{
//don't use E/W suffixes if ambiguous (e.g., 180 degrees)
Expand Down

0 comments on commit 0da1e33

Please sign in to comment.