Skip to content

Commit

Permalink
Use std::round instead of qRound
Browse files Browse the repository at this point in the history
Now that our minimum VS studio version allowed supports std::round,
we should use that in place of Qt's qRound method.

Because:
- it doesn't truncate to int, resulting in unpredictable
behaviour (refs #16925)
- better to stick to standard c++ methods wherever possible,
since they're likely better supported and optimised by the
compilers
- it's a tiny reduction to the barrier for entry to QGIS
development (I'm sick of pointing out the need to use
qRound during PR reviews!)
  • Loading branch information
nyalldawson committed Aug 24, 2017
1 parent 50e8e1c commit 4b009f9
Show file tree
Hide file tree
Showing 54 changed files with 1,800 additions and 1,798 deletions.
6 changes: 0 additions & 6 deletions python/core/qgis.sip
Expand Up @@ -153,12 +153,6 @@ Compare two doubles using specified number of significant digits
:rtype: bool
%End

double qgsRound( double x );
%Docstring
A round function which returns a double to guard against overflows
:rtype: float
%End

double qgsRound( double number, double places );
%Docstring
Returns a double ``number``, rounded (as close as possible) to the specified number of ``places``.
Expand Down
8 changes: 4 additions & 4 deletions src/analysis/raster/qgsalignraster.cpp
Expand Up @@ -30,16 +30,16 @@

static double ceil_with_tolerance( double value )
{
if ( qAbs( value - qRound( value ) ) < 1e-6 )
return qRound( value );
if ( qAbs( value - std::round( value ) ) < 1e-6 )
return std::round( value );
else
return qCeil( value );
}

static double floor_with_tolerance( double value )
{
if ( qAbs( value - qRound( value ) ) < 1e-6 )
return qRound( value );
if ( qAbs( value - std::round( value ) ) < 1e-6 )
return std::round( value );
else
return qFloor( value );
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/composer/qgscomposermapwidget.cpp
Expand Up @@ -444,7 +444,7 @@ void QgsComposerMapWidget::on_mScaleLineEdit_editingFinished()
return;
}

if ( qRound( scaleDenominator ) == qRound( mComposerMap->scale() ) )
if ( std::round( scaleDenominator ) == std::round( mComposerMap->scale() ) )
return;

mComposerMap->beginCommand( tr( "Map scale changed" ) );
Expand Down
4 changes: 2 additions & 2 deletions src/app/pluginmanager/qgspluginmanager.cpp
Expand Up @@ -699,8 +699,8 @@ void QgsPluginManager::showPluginDetails( QStandardItem *item )
voteLabel->show();
voteSlider->show();
voteSubmit->show();
QgsDebugMsg( QString( "vote slider:%1" ).arg( qRound( metadata->value( "average_vote" ).toFloat() ) ) );
voteSlider->setValue( qRound( metadata->value( "average_vote" ).toFloat() ) );
QgsDebugMsg( QString( "vote slider:%1" ).arg( std::round( metadata->value( "average_vote" ).toFloat() ) ) );
voteSlider->setValue( std::round( metadata->value( "average_vote" ).toFloat() ) );
mCurrentPluginId = metadata->value( "plugin_id" ).toInt();
}
else
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsalignrasterdialog.cpp
Expand Up @@ -61,7 +61,7 @@ struct QgsAlignRasterDialogProgress : public QgsAlignRaster::ProgressHandler
explicit QgsAlignRasterDialogProgress( QProgressBar *pb ) : mPb( pb ) {}
virtual bool progress( double complete ) override
{
mPb->setValue( ( int ) qRound( complete * 100 ) );
mPb->setValue( ( int ) std::round( complete * 100 ) );
qApp->processEvents(); // to actually show the progress in GUI
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsdecorationgrid.cpp
Expand Up @@ -790,7 +790,7 @@ bool QgsDecorationGrid::getIntervalFromExtent( double *values, bool useXAxis )
int factor = pow( 10, floor( log10( interval ) ) );
if ( factor != 0 )
{
interval2 = qRound( interval / factor ) * factor;
interval2 = std::round( interval / factor ) * factor;
QgsDebugMsg( QString( "interval2: %1" ).arg( interval2 ) );
if ( !qgsDoubleNear( interval2, 0.0 ) )
interval = interval2;
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsdecorationscalebar.cpp
Expand Up @@ -164,7 +164,7 @@ void QgsDecorationScaleBar::render( const QgsMapSettings &mapSettings, QgsRender
if ( mSnapping )
{
double scaler = pow( 10.0, myPowerOf10 );
myActualSize = qRound( myActualSize / scaler ) * scaler;
myActualSize = std::round( myActualSize / scaler ) * scaler;
myScaleBarWidth = myActualSize / myMapUnitsPerPixelDouble;
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsmaptoolrotatefeature.cpp
Expand Up @@ -89,7 +89,7 @@ void QgsAngleMagnetWidget::setAngle( double angle )
const int magnet = mMagnetSpinBox->value();
if ( magnet )
{
mAngleSpinBox->setValue( qRound( angle / magnet ) * magnet );
mAngleSpinBox->setValue( std::round( angle / magnet ) * magnet );
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsmeasuredialog.cpp
Expand Up @@ -280,7 +280,7 @@ QString QgsMeasureDialog::formatDistance( double distance, bool convertUnits ) c
{
// special handling for degrees - because we can't use smaller units (eg m->mm), we need to make sure there's
// enough decimal places to show a usable measurement value
int minPlaces = qRound( log10( 1.0 / distance ) ) + 1;
int minPlaces = std::round( log10( 1.0 / distance ) ) + 1;
decimals = qMax( decimals, minPlaces );
}
return QgsDistanceArea::formatDistance( distance, decimals, mDistanceUnits, baseUnit );
Expand Down
2 changes: 1 addition & 1 deletion src/core/composer/qgscomposermapgrid.cpp
Expand Up @@ -1445,7 +1445,7 @@ QString QgsComposerMapGrid::gridAnnotationString( double value, QgsComposerMapGr
{
QString hemisphere;

double coordRounded = qRound( value * pow( 10.0, mGridAnnotationPrecision ) ) / pow( 10.0, mGridAnnotationPrecision );
double coordRounded = std::round( value * pow( 10.0, mGridAnnotationPrecision ) ) / pow( 10.0, mGridAnnotationPrecision );
if ( coord == QgsComposerMapGrid::Longitude )
{
//don't use E/W suffixes if ambiguous (e.g., 180 degrees)
Expand Down
2 changes: 1 addition & 1 deletion src/core/effects/qgsimageoperation.cpp
Expand Up @@ -349,7 +349,7 @@ void QgsImageOperation::MultiplyOpacityPixelOperation::operator()( QRgb &rgb, co
{
Q_UNUSED( x );
Q_UNUSED( y );
rgb = qRgba( qRed( rgb ), qGreen( rgb ), qBlue( rgb ), qBound( 0, qRound( mFactor * qAlpha( rgb ) ), 255 ) );
rgb = qRgba( qRed( rgb ), qGreen( rgb ), qBlue( rgb ), qBound( 0.0, std::round( mFactor * qAlpha( rgb ) ), 255.0 ) );
}

// overlay color
Expand Down
4 changes: 2 additions & 2 deletions src/core/expression/qgsexpressionfunction.cpp
Expand Up @@ -2884,13 +2884,13 @@ static QVariant fcnRound( const QVariantList &values, const QgsExpressionContext
{
double number = QgsExpressionUtils::getDoubleValue( values.at( 0 ), parent );
double scaler = pow( 10.0, QgsExpressionUtils::getIntValue( values.at( 1 ), parent ) );
return QVariant( qRound( number * scaler ) / scaler );
return QVariant( std::round( number * scaler ) / scaler );
}

if ( values.length() >= 1 )
{
double number = QgsExpressionUtils::getIntValue( values.at( 0 ), parent );
return QVariant( qRound( number ) );
return QVariant( qlonglong( std::round( number ) ) );
}

return QVariant();
Expand Down
12 changes: 6 additions & 6 deletions src/core/geometry/qgsgeos.cpp
Expand Up @@ -1701,11 +1701,11 @@ GEOSCoordSequence *QgsGeos::createCoordinateSequence( const QgsCurve *curve, dou
{
for ( int i = 0; i < numOutPoints; ++i )
{
GEOSCoordSeq_setX_r( geosinit.ctxt, coordSeq, i, qgsRound( line->xAt( i % numPoints ) / precision ) * precision );
GEOSCoordSeq_setY_r( geosinit.ctxt, coordSeq, i, qgsRound( line->yAt( i % numPoints ) / precision ) * precision );
GEOSCoordSeq_setX_r( geosinit.ctxt, coordSeq, i, std::round( line->xAt( i % numPoints ) / precision ) * precision );
GEOSCoordSeq_setY_r( geosinit.ctxt, coordSeq, i, std::round( line->yAt( i % numPoints ) / precision ) * precision );
if ( hasZ )
{
GEOSCoordSeq_setOrdinate_r( geosinit.ctxt, coordSeq, i, 2, qgsRound( line->zAt( i % numPoints ) / precision ) * precision );
GEOSCoordSeq_setOrdinate_r( geosinit.ctxt, coordSeq, i, 2, std::round( line->zAt( i % numPoints ) / precision ) * precision );
}
if ( hasM )
{
Expand Down Expand Up @@ -1765,11 +1765,11 @@ GEOSGeometry *QgsGeos::createGeosPointXY( double x, double y, bool hasZ, double
}
if ( precision > 0. )
{
GEOSCoordSeq_setX_r( geosinit.ctxt, coordSeq, 0, qgsRound( x / precision ) * precision );
GEOSCoordSeq_setY_r( geosinit.ctxt, coordSeq, 0, qgsRound( y / precision ) * precision );
GEOSCoordSeq_setX_r( geosinit.ctxt, coordSeq, 0, std::round( x / precision ) * precision );
GEOSCoordSeq_setY_r( geosinit.ctxt, coordSeq, 0, std::round( y / precision ) * precision );
if ( hasZ )
{
GEOSCoordSeq_setOrdinate_r( geosinit.ctxt, coordSeq, 0, 2, qgsRound( z / precision ) * precision );
GEOSCoordSeq_setOrdinate_r( geosinit.ctxt, coordSeq, 0, 2, std::round( z / precision ) * precision );
}
}
else
Expand Down
4 changes: 2 additions & 2 deletions src/core/processing/qgsprocessingparameters.cpp
Expand Up @@ -112,13 +112,13 @@ int QgsProcessingParameters::parameterAsInt( const QgsProcessingParameterDefinit
//work around this by first converting to double, and then checking whether the double is convertible to int
if ( ok )
{
double round = qgsRound( dbl );
double round = std::round( dbl );
if ( round > INT_MAX || round < -INT_MAX )
{
//double too large to fit in int
return 0;
}
return qRound( dbl );
return std::round( dbl );
}

return val.toInt();
Expand Down
8 changes: 1 addition & 7 deletions src/core/qgis.h
Expand Up @@ -236,13 +236,7 @@ inline bool qgsDoubleNearSig( double a, double b, int significantDigits = 10 )
double br = frexp( b, &bexp );

return aexp == bexp &&
qRound( ar * pow( 10.0, significantDigits ) ) == qRound( br * pow( 10.0, significantDigits ) );
}

//! A round function which returns a double to guard against overflows
inline double qgsRound( double x )
{
return x < 0.0 ? std::ceil( x - 0.5 ) : std::floor( x + 0.5 );
std::round( ar * pow( 10.0, significantDigits ) ) == std::round( br * pow( 10.0, significantDigits ) );
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/core/qgscolorramp.cpp
Expand Up @@ -396,7 +396,7 @@ QList<QColor> QgsLimitedRandomColorRamp::randomColors( int count,
//see http://basecase.org/env/on-rainbows for more details
currentHueAngle += 137.50776;
//scale hue to between hueMax and hueMin
h = qBound( 0, qRound( ( fmod( currentHueAngle, 360.0 ) / 360.0 ) * ( safeHueMax - safeHueMin ) + safeHueMin ), 359 );
h = qBound( 0.0, std::round( ( fmod( currentHueAngle, 360.0 ) / 360.0 ) * ( safeHueMax - safeHueMin ) + safeHueMin ), 359.0 );
s = qBound( 0, ( qrand() % ( safeSatMax - safeSatMin + 1 ) ) + safeSatMin, 255 );
v = qBound( 0, ( qrand() % ( safeValMax - safeValMin + 1 ) ) + safeValMin, 255 );
colors.append( QColor::fromHsv( h, s, v ) );
Expand Down Expand Up @@ -468,7 +468,7 @@ void QgsRandomColorRamp::setTotalColorCount( const int colorCount )
//build up a list of colors
for ( int idx = 0; idx < colorCount; ++ idx )
{
int h = qRound( currentHue ) % 360;
int h = static_cast< int >( std::round( currentHue ) ) % 360;
int s = ( qrand() % ( DEFAULT_RANDOM_SAT_MAX - DEFAULT_RANDOM_SAT_MIN + 1 ) ) + DEFAULT_RANDOM_SAT_MIN;
int v = ( qrand() % ( DEFAULT_RANDOM_VAL_MAX - DEFAULT_RANDOM_VAL_MIN + 1 ) ) + DEFAULT_RANDOM_VAL_MIN;
mPrecalculatedColors << QColor::fromHsv( h, s, v );
Expand Down
16 changes: 8 additions & 8 deletions src/core/qgsdatadefinedsizelegend.cpp
Expand Up @@ -156,9 +156,9 @@ void QgsDataDefinedSizeLegend::drawCollapsedLegend( QgsRenderContext &context, Q
// make sure we draw bigger symbols first
std::sort( classes.begin(), classes.end(), []( const SizeClass & a, const SizeClass & b ) { return a.size > b.size; } );

int hLengthLine = qRound( context.convertToPainterUnits( hLengthLineMM, QgsUnitTypes::RenderMillimeters ) );
int hSpaceLineText = qRound( context.convertToPainterUnits( hSpaceLineTextMM, QgsUnitTypes::RenderMillimeters ) );
int dpm = qRound( context.scaleFactor() * 1000 ); // scale factor = dots per millimeter
int hLengthLine = std::round( context.convertToPainterUnits( hLengthLineMM, QgsUnitTypes::RenderMillimeters ) );
int hSpaceLineText = std::round( context.convertToPainterUnits( hSpaceLineTextMM, QgsUnitTypes::RenderMillimeters ) );
int dpm = std::round( context.scaleFactor() * 1000 ); // scale factor = dots per millimeter

// get font metrics - we need a temporary image just to get the metrics right for the given DPI
QImage tmpImg( QSize( 1, 1 ), QImage::Format_ARGB32_Premultiplied );
Expand Down Expand Up @@ -194,10 +194,10 @@ void QgsDataDefinedSizeLegend::drawCollapsedLegend( QgsRenderContext &context, Q
switch ( mVAlign )
{
case AlignCenter:
symbolTopY << qRound( outputLargestSize / 2 - outputSymbolSize / 2 );
symbolTopY << std::round( outputLargestSize / 2 - outputSymbolSize / 2 );
break;
case AlignBottom:
symbolTopY << qRound( outputLargestSize - outputSymbolSize );
symbolTopY << std::round( outputLargestSize - outputSymbolSize );
break;
}
}
Expand All @@ -222,7 +222,7 @@ void QgsDataDefinedSizeLegend::drawCollapsedLegend( QgsRenderContext &context, Q
int totalTextHeight = textBottomY - textTopY;

int fullWidth = outputLargestSize + hLengthLine + hSpaceLineText + maxTextWidth;
int fullHeight = qMax( qRound( outputLargestSize ) - textTopY, totalTextHeight );
int fullHeight = qMax( static_cast< int >( std::round( outputLargestSize ) ) - textTopY, totalTextHeight );

if ( outputSize )
*outputSize = QSize( fullWidth, fullHeight );
Expand Down Expand Up @@ -292,8 +292,8 @@ QImage QgsDataDefinedSizeLegend::collapsedLegendImage( QgsRenderContext &context
QSize contentSize;
drawCollapsedLegend( context, &contentSize );

int padding = qRound( context.convertToPainterUnits( paddingMM, QgsUnitTypes::RenderMillimeters ) );
int dpm = qRound( context.scaleFactor() * 1000 ); // scale factor = dots per millimeter
int padding = std::round( context.convertToPainterUnits( paddingMM, QgsUnitTypes::RenderMillimeters ) );
int dpm = std::round( context.scaleFactor() * 1000 ); // scale factor = dots per millimeter

QImage img( contentSize.width() + padding * 2, contentSize.height() + padding * 2, QImage::Format_ARGB32_Premultiplied );
img.setDotsPerMeterX( dpm );
Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsfield.cpp
Expand Up @@ -249,14 +249,14 @@ bool QgsField::convertCompatible( QVariant &v ) const
return false;
}

double round = qgsRound( dbl );
double round = std::round( dbl );
if ( round > INT_MAX || round < -INT_MAX )
{
//double too large to fit in int
v = QVariant( d->type );
return false;
}
v = QVariant( qRound( dbl ) );
v = QVariant( static_cast< int >( std::round( dbl ) ) );
return true;
}

Expand Down
8 changes: 4 additions & 4 deletions src/core/qgsmaptopixelgeometrysimplifier.cpp
Expand Up @@ -47,12 +47,12 @@ float QgsMapToPixelSimplifier::calculateLengthSquared2D( double x1, double y1, d

bool QgsMapToPixelSimplifier::equalSnapToGrid( double x1, double y1, double x2, double y2, double gridOriginX, double gridOriginY, float gridInverseSizeXY )
{
int grid_x1 = qRound( ( x1 - gridOriginX ) * gridInverseSizeXY );
int grid_x2 = qRound( ( x2 - gridOriginX ) * gridInverseSizeXY );
int grid_x1 = std::round( ( x1 - gridOriginX ) * gridInverseSizeXY );
int grid_x2 = std::round( ( x2 - gridOriginX ) * gridInverseSizeXY );
if ( grid_x1 != grid_x2 ) return false;

int grid_y1 = qRound( ( y1 - gridOriginY ) * gridInverseSizeXY );
int grid_y2 = qRound( ( y2 - gridOriginY ) * gridInverseSizeXY );
int grid_y1 = std::round( ( y1 - gridOriginY ) * gridInverseSizeXY );
int grid_y2 = std::round( ( y2 - gridOriginY ) * gridInverseSizeXY );
if ( grid_y1 != grid_y2 ) return false;

return true;
Expand Down
20 changes: 10 additions & 10 deletions src/core/qgspointxy.cpp
Expand Up @@ -95,7 +95,7 @@ QString QgsPointXY::toDegreesMinutesSeconds( int precision, const bool useSuffix
double mySecondsY = double( myFloatMinutesY - myIntMinutesY ) * 60;

//make sure rounding to specified precision doesn't create seconds >= 60
if ( qRound( mySecondsX * pow( 10.0, precision ) ) >= 60 * pow( 10.0, precision ) )
if ( std::round( mySecondsX * pow( 10.0, precision ) ) >= 60 * pow( 10.0, precision ) )
{
mySecondsX = qMax( mySecondsX - 60, 0.0 );
myIntMinutesX++;
Expand All @@ -105,7 +105,7 @@ QString QgsPointXY::toDegreesMinutesSeconds( int precision, const bool useSuffix
myDegreesX++;
}
}
if ( qRound( mySecondsY * pow( 10.0, precision ) ) >= 60 * pow( 10.0, precision ) )
if ( std::round( mySecondsY * pow( 10.0, precision ) ) >= 60 * pow( 10.0, precision ) )
{
mySecondsY = qMax( mySecondsY - 60, 0.0 );
myIntMinutesY++;
Expand Down Expand Up @@ -138,18 +138,18 @@ QString QgsPointXY::toDegreesMinutesSeconds( int precision, const bool useSuffix
}
//check if coordinate is all zeros for the specified precision, and if so,
//remove the sign and hemisphere strings
if ( myDegreesX == 0 && myIntMinutesX == 0 && qRound( mySecondsX * pow( 10.0, precision ) ) == 0 )
if ( myDegreesX == 0 && myIntMinutesX == 0 && std::round( mySecondsX * pow( 10.0, precision ) ) == 0 )
{
myXSign = QString();
myXHemisphere = QString();
}
if ( myDegreesY == 0 && myIntMinutesY == 0 && qRound( mySecondsY * pow( 10.0, precision ) ) == 0 )
if ( myDegreesY == 0 && myIntMinutesY == 0 && std::round( mySecondsY * pow( 10.0, precision ) ) == 0 )
{
myYSign = QString();
myYHemisphere = QString();
}
//also remove directional prefix from 180 degree longitudes
if ( myDegreesX == 180 && myIntMinutesX == 0 && qRound( mySecondsX * pow( 10.0, precision ) ) == 0 )
if ( myDegreesX == 180 && myIntMinutesX == 0 && std::round( mySecondsX * pow( 10.0, precision ) ) == 0 )
{
myXHemisphere = QString();
}
Expand Down Expand Up @@ -193,12 +193,12 @@ QString QgsPointXY::toDegreesMinutes( int precision, const bool useSuffix, const
double myFloatMinutesY = double( ( qAbs( mY ) - myDegreesY ) * 60 );

//make sure rounding to specified precision doesn't create minutes >= 60
if ( qRound( myFloatMinutesX * pow( 10.0, precision ) ) >= 60 * pow( 10.0, precision ) )
if ( std::round( myFloatMinutesX * pow( 10.0, precision ) ) >= 60 * pow( 10.0, precision ) )
{
myFloatMinutesX = qMax( myFloatMinutesX - 60, 0.0 );
myDegreesX++;
}
if ( qRound( myFloatMinutesY * pow( 10.0, precision ) ) >= 60 * pow( 10.0, precision ) )
if ( std::round( myFloatMinutesY * pow( 10.0, precision ) ) >= 60 * pow( 10.0, precision ) )
{
myFloatMinutesY = qMax( myFloatMinutesY - 60, 0.0 );
myDegreesY++;
Expand Down Expand Up @@ -226,18 +226,18 @@ QString QgsPointXY::toDegreesMinutes( int precision, const bool useSuffix, const
}
//check if coordinate is all zeros for the specified precision, and if so,
//remove the sign and hemisphere strings
if ( myDegreesX == 0 && qRound( myFloatMinutesX * pow( 10.0, precision ) ) == 0 )
if ( myDegreesX == 0 && std::round( myFloatMinutesX * pow( 10.0, precision ) ) == 0 )
{
myXSign = QString();
myXHemisphere = QString();
}
if ( myDegreesY == 0 && qRound( myFloatMinutesY * pow( 10.0, precision ) ) == 0 )
if ( myDegreesY == 0 && std::round( myFloatMinutesY * pow( 10.0, precision ) ) == 0 )
{
myYSign = QString();
myYHemisphere = QString();
}
//also remove directional prefix from 180 degree longitudes
if ( myDegreesX == 180 && qRound( myFloatMinutesX * pow( 10.0, precision ) ) == 0 )
if ( myDegreesX == 180 && std::round( myFloatMinutesX * pow( 10.0, precision ) ) == 0 )
{
myXHemisphere = QString();
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsproperty.cpp
Expand Up @@ -605,7 +605,7 @@ int QgsProperty::valueAsInt( const QgsExpressionContext &context, int defaultVal
{
if ( ok )
*ok = true;
return qRound( dbl );
return std::round( dbl );
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsvectorlayerlabeling.cpp
Expand Up @@ -203,7 +203,7 @@ std::unique_ptr<QgsMarkerSymbolLayer> backgroundToMarkerLayer( const QgsTextBack
QColor strokeColor = settings.strokeColor();
if ( settings.opacity() < 1 )
{
int alpha = qRound( settings.opacity() * 255 );
int alpha = std::round( settings.opacity() * 255 );
fillColor.setAlpha( alpha );
strokeColor.setAlpha( alpha );
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/raster/qgscolorrampshader.cpp
Expand Up @@ -286,7 +286,7 @@ void QgsColorRampShader::classifyColorRamp( const int classes, const int band, c

// calculate a reasonable number of decimals to display
double maxabs = log10( qMax( qAbs( max ), qAbs( min ) ) );
int nDecimals = qRound( qMax( 3.0 + maxabs - log10( max - min ), maxabs <= 15.0 ? maxabs + 0.49 : 0.0 ) );
int nDecimals = std::round( qMax( 3.0 + maxabs - log10( max - min ), maxabs <= 15.0 ? maxabs + 0.49 : 0.0 ) );

QList<QgsColorRampShader::ColorRampItem> colorRampItems;
for ( ; value_it != entryValues.end(); ++value_it, ++color_it )
Expand Down

0 comments on commit 4b009f9

Please sign in to comment.