From c19418c4479b3eb0a637035f6fd79644f7c1fb34 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Fri, 25 Aug 2017 04:13:38 +1000 Subject: [PATCH] Add more missing std:: prefixes --- .../network/qgsvectorlayerdirector.cpp | 2 +- src/analysis/raster/qgsalignraster.cpp | 2 +- src/analysis/raster/qgshillshadefilter.cpp | 2 +- src/analysis/raster/qgskde.cpp | 4 +-- src/analysis/raster/qgsrastermatrix.cpp | 10 +++---- src/analysis/raster/qgsrelief.cpp | 4 +-- src/analysis/raster/qgsruggednessfilter.cpp | 2 +- src/analysis/raster/qgsslopefilter.cpp | 2 +- src/app/dwg/qgsdwgimporter.cpp | 6 ++--- src/app/qgsdecorationgrid.cpp | 2 +- src/app/qgsdecorationscalebar.cpp | 2 +- src/app/qgsmeasuredialog.cpp | 2 +- src/app/qgspointrotationitem.cpp | 2 +- src/core/composer/qgscomposeritem.cpp | 2 +- src/core/composer/qgscomposermapgrid.cpp | 2 +- src/core/composer/qgscomposernodesitem.cpp | 2 +- src/core/composer/qgscomposerscalebar.cpp | 10 +++---- src/core/composer/qgscomposerutils.cpp | 8 +++--- src/core/composer/qgscomposition.cpp | 22 ++++++++-------- src/core/effects/qgsimageoperation.cpp | 2 +- src/core/expression/qgsexpressionfunction.cpp | 22 ++++++++-------- src/core/expression/qgsexpressionnodeimpl.cpp | 2 +- src/core/geometry/qgscircularstring.cpp | 2 +- src/core/geometry/qgsellipse.cpp | 2 +- src/core/geometry/qgsgeometry.cpp | 2 +- src/core/geometry/qgsgeometryutils.cpp | 4 +-- src/core/geometry/qgsgeos.cpp | 4 +-- src/core/geometry/qgspoint.cpp | 12 ++++----- src/core/geometry/qgsrectangle.cpp | 2 +- src/core/geometry/qgstriangle.cpp | 6 ++--- src/core/layout/qgslayoututils.cpp | 2 +- src/core/pal/feature.cpp | 2 +- src/core/pal/geomfunction.h | 2 +- src/core/pal/labelposition.cpp | 2 +- src/core/qgis.h | 4 +-- src/core/qgscolorramp.cpp | 2 +- src/core/qgscoordinateutils.cpp | 2 +- src/core/qgsdiagramrenderer.cpp | 2 +- src/core/qgsdistancearea.cpp | 14 +++++----- src/core/qgshistogram.cpp | 2 +- src/core/qgsmapsettingsutils.cpp | 2 +- src/core/qgspallabeling.cpp | 4 +-- src/core/qgspointxy.cpp | 10 +++---- src/core/qgsscalecalculator.cpp | 2 +- src/core/qgstolerance.cpp | 4 +-- src/core/qgsvector.cpp | 2 +- src/core/raster/qgscolorrampshader.cpp | 4 +-- src/core/raster/qgshillshaderenderer.cpp | 2 +- src/core/raster/qgsrasterchecker.cpp | 2 +- src/core/raster/qgsrasterinterface.h | 2 +- src/core/simplify/effectivearea.cpp | 2 +- src/core/symbology/qgsarrowsymbollayer.cpp | 4 +-- src/core/symbology/qgsheatmaprenderer.cpp | 4 +-- src/core/symbology/qgslinesymbollayer.cpp | 4 +-- src/core/symbology/qgssymbollayerutils.cpp | 2 +- src/gui/qgsadvanceddigitizingdockwidget.cpp | 2 +- src/gui/qgscolorwidgets.cpp | 26 +++++++++---------- .../checks/qgsgeometrycheck.cpp | 4 +-- .../georeferencer/qgsgeorefplugingui.cpp | 2 +- .../georeferencer/qgsresidualplotitem.cpp | 6 ++--- src/providers/gdal/qgsgdalprovider.cpp | 2 +- src/providers/wms/qgswmsprovider.cpp | 8 +++--- 62 files changed, 141 insertions(+), 141 deletions(-) diff --git a/src/analysis/network/qgsvectorlayerdirector.cpp b/src/analysis/network/qgsvectorlayerdirector.cpp index a990a27c84d..3a5d57c1813 100644 --- a/src/analysis/network/qgsvectorlayerdirector.cpp +++ b/src/analysis/network/qgsvectorlayerdirector.cpp @@ -50,7 +50,7 @@ class QgsPointCompare double tx1 = std::ceil( p1.x() / mTolerance ); double tx2 = std::ceil( p2.x() / mTolerance ); if ( tx1 == tx2 ) - return ceil( p1.y() / mTolerance ) < std::ceil( p2.y() / mTolerance ); + return std::ceil( p1.y() / mTolerance ) < std::ceil( p2.y() / mTolerance ); return tx1 < tx2; } diff --git a/src/analysis/raster/qgsalignraster.cpp b/src/analysis/raster/qgsalignraster.cpp index 6ff588939c4..3b96d8e375e 100644 --- a/src/analysis/raster/qgsalignraster.cpp +++ b/src/analysis/raster/qgsalignraster.cpp @@ -40,7 +40,7 @@ static double floor_with_tolerance( double value ) if ( std::fabs( value - std::round( value ) ) < 1e-6 ) return std::round( value ); else - return floor( value ); + return std::floor( value ); } static double fmod_with_tolerance( double num, double denom ) diff --git a/src/analysis/raster/qgshillshadefilter.cpp b/src/analysis/raster/qgshillshadefilter.cpp index 91a63012c35..3da206fbc24 100644 --- a/src/analysis/raster/qgshillshadefilter.cpp +++ b/src/analysis/raster/qgshillshadefilter.cpp @@ -38,7 +38,7 @@ float QgsHillshadeFilter::processNineCellWindow( float *x11, float *x21, float * } float zenith_rad = mLightAngle * M_PI / 180.0; - float slope_rad = atan( std::sqrt( derX * derX + derY * derY ) ); + float slope_rad = std::atan( std::sqrt( derX * derX + derY * derY ) ); float azimuth_rad = mLightAzimuth * M_PI / 180.0; float aspect_rad = 0; if ( derX == 0 && derY == 0 ) //aspect undefined, take a neutral value. Better solutions? diff --git a/src/analysis/raster/qgskde.cpp b/src/analysis/raster/qgskde.cpp index eb06adf965c..69df88cc001 100644 --- a/src/analysis/raster/qgskde.cpp +++ b/src/analysis/raster/qgskde.cpp @@ -330,7 +330,7 @@ double QgsKernelDensityEstimation::quarticKernel( const double distance, const d return k * ( 15. / 16. ) * std::pow( 1. - std::pow( distance / bandwidth, 2 ), 2 ); } case OutputRaw: - return pow( 1. - std::pow( distance / bandwidth, 2 ), 2 ); + return std::pow( 1. - std::pow( distance / bandwidth, 2 ), 2 ); } return 0.0; //no, seriously, I told you NO WARNINGS! } @@ -348,7 +348,7 @@ double QgsKernelDensityEstimation::triweightKernel( const double distance, const return k * ( 35. / 32. ) * std::pow( 1. - std::pow( distance / bandwidth, 2 ), 3 ); } case OutputRaw: - return pow( 1. - std::pow( distance / bandwidth, 2 ), 3 ); + return std::pow( 1. - std::pow( distance / bandwidth, 2 ), 3 ); } return 0.0; // this is getting ridiculous... don't you ever listen to a word I say? } diff --git a/src/analysis/raster/qgsrastermatrix.cpp b/src/analysis/raster/qgsrastermatrix.cpp index 1bb15ca95d7..fa5e4a6ca3d 100644 --- a/src/analysis/raster/qgsrastermatrix.cpp +++ b/src/analysis/raster/qgsrastermatrix.cpp @@ -226,16 +226,16 @@ bool QgsRasterMatrix::oneArgumentOperation( OneArgOperator op ) mData[i] = std::cos( value ); break; case opTAN: - mData[i] = tan( value ); + mData[i] = std::tan( value ); break; case opASIN: - mData[i] = asin( value ); + mData[i] = std::asin( value ); break; case opACOS: - mData[i] = acos( value ); + mData[i] = std::acos( value ); break; case opATAN: - mData[i] = atan( value ); + mData[i] = std::atan( value ); break; case opSIGN: mData[i] = -value; @@ -292,7 +292,7 @@ double QgsRasterMatrix::calculateTwoArgumentOp( TwoArgOperator op, double arg1, } else { - return pow( arg1, arg2 ); + return std::pow( arg1, arg2 ); } case opEQ: return ( arg1 == arg2 ? 1.0 : 0.0 ); diff --git a/src/analysis/raster/qgsrelief.cpp b/src/analysis/raster/qgsrelief.cpp index 29a5ff89343..e1fee183771 100644 --- a/src/analysis/raster/qgsrelief.cpp +++ b/src/analysis/raster/qgsrelief.cpp @@ -560,7 +560,7 @@ bool QgsRelief::exportFrequencyDistributionToCsv( const QString &file ) //log10 transformation for all frequency values for ( int i = 0; i < 252; ++i ) { - frequency[i] = log10( frequency[i] ); + frequency[i] = std::log10( frequency[i] ); } //write out frequency values to csv file for debugging @@ -651,7 +651,7 @@ QList< QgsRelief::ReliefColor > QgsRelief::calculateOptimizedReliefClasses() //log10 transformation for all frequency values for ( int i = 0; i < 252; ++i ) { - frequency[i] = log10( frequency[i] ); + frequency[i] = std::log10( frequency[i] ); } //start with 9 uniformly distributed classes diff --git a/src/analysis/raster/qgsruggednessfilter.cpp b/src/analysis/raster/qgsruggednessfilter.cpp index c1ff676def2..dfc4808e178 100644 --- a/src/analysis/raster/qgsruggednessfilter.cpp +++ b/src/analysis/raster/qgsruggednessfilter.cpp @@ -83,6 +83,6 @@ float QgsRuggednessFilter::processNineCellWindow( float *x11, float *x21, float sum += ( *x33 - *x22 ) * ( *x33 - *x22 ); } - return sqrt( sum ); + return std::sqrt( sum ); } diff --git a/src/analysis/raster/qgsslopefilter.cpp b/src/analysis/raster/qgsslopefilter.cpp index 17789087880..db263daddf0 100644 --- a/src/analysis/raster/qgsslopefilter.cpp +++ b/src/analysis/raster/qgsslopefilter.cpp @@ -34,6 +34,6 @@ float QgsSlopeFilter::processNineCellWindow( float *x11, float *x21, float *x31, return mOutputNodataValue; } - return atan( std::sqrt( derX * derX + derY * derY ) ) * 180.0 / M_PI; + return std::atan( std::sqrt( derX * derX + derY * derY ) ) * 180.0 / M_PI; } diff --git a/src/app/dwg/qgsdwgimporter.cpp b/src/app/dwg/qgsdwgimporter.cpp index 6fbf2de2035..0c0fcc59fc3 100644 --- a/src/app/dwg/qgsdwgimporter.cpp +++ b/src/app/dwg/qgsdwgimporter.cpp @@ -1441,7 +1441,7 @@ bool QgsDwgImporter::curveFromLWPolyline( const DRW_LWPolyline &data, QgsCompoun { size_t i1 = ( i + 1 ) % vertexnum; - double a = 2.0 * atan( data.vertlist[i]->bulge ); + double a = 2.0 * std::atan( data.vertlist[i]->bulge ); double dx = data.vertlist[i1]->x - data.vertlist[i0]->x; double dy = data.vertlist[i1]->y - data.vertlist[i0]->y; double c = std::sqrt( dx * dx + dy * dy ); @@ -1552,7 +1552,7 @@ void QgsDwgImporter::addLWPolyline( const DRW_LWPolyline &data ) if ( hasBulge ) { - double a = 2.0 * atan( data.vertlist[i]->bulge ); + double a = 2.0 * std::atan( data.vertlist[i]->bulge ); double dx = p1.x() - p0.x(); double dy = p1.y() - p0.y(); double c = std::sqrt( dx * dx + dy * dy ); @@ -1753,7 +1753,7 @@ void QgsDwgImporter::addPolyline( const DRW_Polyline &data ) if ( hasBulge ) { - double a = 2.0 * atan( data.vertlist[i]->bulge ); + double a = 2.0 * std::atan( data.vertlist[i]->bulge ); double dx = p1.x() - p0.x(); double dy = p1.y() - p0.y(); double dz = p1.z() - p0.z(); diff --git a/src/app/qgsdecorationgrid.cpp b/src/app/qgsdecorationgrid.cpp index 868cbbd5164..e2c393f1e39 100644 --- a/src/app/qgsdecorationgrid.cpp +++ b/src/app/qgsdecorationgrid.cpp @@ -787,7 +787,7 @@ bool QgsDecorationGrid::getIntervalFromExtent( double *values, bool useXAxis ) if ( !qgsDoubleNear( interval, 0.0 ) ) { double interval2 = 0; - int factor = std::pow( 10, std::floor( log10( interval ) ) ); + int factor = std::pow( 10, std::floor( std::log10( interval ) ) ); if ( factor != 0 ) { interval2 = std::round( interval / factor ) * factor; diff --git a/src/app/qgsdecorationscalebar.cpp b/src/app/qgsdecorationscalebar.cpp index a98773265b9..a0b65f5d546 100644 --- a/src/app/qgsdecorationscalebar.cpp +++ b/src/app/qgsdecorationscalebar.cpp @@ -158,7 +158,7 @@ void QgsDecorationScaleBar::render( const QgsMapSettings &mapSettings, QgsRender // Work out the exponent for the number - e.g, 1234 will give 3, // and .001234 will give -3 - double myPowerOf10 = std::floor( log10( myActualSize ) ); + double myPowerOf10 = std::floor( std::log10( myActualSize ) ); // snap to integer < 10 times power of 10 if ( mSnapping ) diff --git a/src/app/qgsmeasuredialog.cpp b/src/app/qgsmeasuredialog.cpp index d096dad8abf..fba4334d918 100644 --- a/src/app/qgsmeasuredialog.cpp +++ b/src/app/qgsmeasuredialog.cpp @@ -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 = std::round( log10( 1.0 / distance ) ) + 1; + int minPlaces = std::round( std::log10( 1.0 / distance ) ) + 1; decimals = qMax( decimals, minPlaces ); } return QgsDistanceArea::formatDistance( distance, decimals, mDistanceUnits, baseUnit ); diff --git a/src/app/qgspointrotationitem.cpp b/src/app/qgspointrotationitem.cpp index 07fbbd45663..cb7405d1110 100644 --- a/src/app/qgspointrotationitem.cpp +++ b/src/app/qgspointrotationitem.cpp @@ -55,7 +55,7 @@ void QgsPointRotationItem::paint( QPainter *painter ) if ( mPixmap.width() > 0 && mPixmap.height() > 0 ) { h = std::sqrt( ( double ) mPixmap.width() * mPixmap.width() + mPixmap.height() * mPixmap.height() ) / 2; //the half of the item diagonal - dAngel = acos( mPixmap.width() / ( h * 2 ) ) * 180 / M_PI; //the diagonal angel of the original rect + dAngel = std::acos( mPixmap.width() / ( h * 2 ) ) * 180 / M_PI; //the diagonal angel of the original rect x = h * std::cos( ( painterRotation( mRotation ) - dAngel ) * M_PI / 180 ); y = h * std::sin( ( painterRotation( mRotation ) - dAngel ) * M_PI / 180 ); } diff --git a/src/core/composer/qgscomposeritem.cpp b/src/core/composer/qgscomposeritem.cpp index b8632ad532b..fb7e343ef83 100644 --- a/src/core/composer/qgscomposeritem.cpp +++ b/src/core/composer/qgscomposeritem.cpp @@ -1012,7 +1012,7 @@ void QgsComposerItem::setItemRotation( const double r, const bool adjustPosition mItemRotation = r; if ( mItemRotation >= 360.0 || mItemRotation <= -360.0 ) { - mItemRotation = fmod( mItemRotation, 360.0 ); + mItemRotation = std::fmod( mItemRotation, 360.0 ); } QgsExpressionContext context = createExpressionContext(); diff --git a/src/core/composer/qgscomposermapgrid.cpp b/src/core/composer/qgscomposermapgrid.cpp index a7a39180cde..dad47f9dd1b 100644 --- a/src/core/composer/qgscomposermapgrid.cpp +++ b/src/core/composer/qgscomposermapgrid.cpp @@ -1426,7 +1426,7 @@ QString QgsComposerMapGrid::gridAnnotationString( double value, QgsComposerMapGr ( mGridAnnotationFormat == QgsComposerMapGrid::Decimal || mGridAnnotationFormat == QgsComposerMapGrid::DecimalWithSuffix ) ) { // wrap around longitudes > 180 or < -180 degrees, so that, e.g., "190E" -> "170W" - double wrappedX = fmod( value, 360.0 ); + double wrappedX = std::fmod( value, 360.0 ); if ( wrappedX > 180.0 ) { value = wrappedX - 360.0; diff --git a/src/core/composer/qgscomposernodesitem.cpp b/src/core/composer/qgscomposernodesitem.cpp index 1075e2bdc33..722f4b15848 100644 --- a/src/core/composer/qgscomposernodesitem.cpp +++ b/src/core/composer/qgscomposernodesitem.cpp @@ -50,7 +50,7 @@ QgsComposerNodesItem::QgsComposerNodesItem( const QString &tagName, double QgsComposerNodesItem::computeDistance( QPointF pt1, QPointF pt2 ) const { - return sqrt( std::pow( pt1.x() - pt2.x(), 2 ) + std::pow( pt1.y() - pt2.y(), 2 ) ); + return std::sqrt( std::pow( pt1.x() - pt2.x(), 2 ) + std::pow( pt1.y() - pt2.y(), 2 ) ); } bool QgsComposerNodesItem::addNode( QPointF pt, diff --git a/src/core/composer/qgscomposerscalebar.cpp b/src/core/composer/qgscomposerscalebar.cpp index 91c0699cb07..32e4498c810 100644 --- a/src/core/composer/qgscomposerscalebar.cpp +++ b/src/core/composer/qgscomposerscalebar.cpp @@ -262,15 +262,15 @@ void QgsComposerScaleBar::refreshDataDefinedProperty( const QgsComposerObject::D // nextNiceNumber(4573.23, d) = 5000 (d=1) -> 4600 (d=10) -> 4580 (d=100) -> 4574 (d=1000) -> etc inline double nextNiceNumber( double a, double d = 1 ) { - double s = std::pow( 10.0, std::floor( log10( a ) ) ) / d; - return ceil( a / s ) * s; + double s = std::pow( 10.0, std::floor( std::log10( a ) ) ) / d; + return std::ceil( a / s ) * s; } // prevNiceNumber(4573.23, d) = 4000 (d=1) -> 4500 (d=10) -> 4570 (d=100) -> 4573 (d=1000) -> etc inline double prevNiceNumber( double a, double d = 1 ) { - double s = std::pow( 10.0, std::floor( log10( a ) ) ) / d; - return floor( a / s ) * s; + double s = std::pow( 10.0, std::floor( std::log10( a ) ) ) / d; + return std::floor( a / s ) * s; } void QgsComposerScaleBar::refreshSegmentMillimeters() @@ -473,7 +473,7 @@ void QgsComposerScaleBar::applyDefaultSize( QgsUnitTypes::DistanceUnit u ) } double segmentWidth = initialUnitsPerSegment / upperMagnitudeMultiplier; - int segmentMagnitude = std::floor( log10( segmentWidth ) ); + int segmentMagnitude = std::floor( std::log10( segmentWidth ) ); double unitsPerSegment = upperMagnitudeMultiplier * ( std::pow( 10.0, segmentMagnitude ) ); double multiplier = std::floor( ( widthInSelectedUnits / ( unitsPerSegment * 10.0 ) ) / 2.5 ) * 2.5; diff --git a/src/core/composer/qgscomposerutils.cpp b/src/core/composer/qgscomposerutils.cpp index 0b422f14430..c9fdfab9a40 100644 --- a/src/core/composer/qgscomposerutils.cpp +++ b/src/core/composer/qgscomposerutils.cpp @@ -42,9 +42,9 @@ void QgsComposerUtils::drawArrowHead( QPainter *p, const double x, const double QPointF p2 = QPointF( arrowHeadWidth / 2.0, arrowHeadWidth ); QPointF p1Rotated, p2Rotated; - p1Rotated.setX( p1.x() * std::cos( angleRad ) + p1.y() * -sin( angleRad ) ); + p1Rotated.setX( p1.x() * std::cos( angleRad ) + p1.y() * -std::sin( angleRad ) ); p1Rotated.setY( p1.x() * std::sin( angleRad ) + p1.y() * std::cos( angleRad ) ); - p2Rotated.setX( p2.x() * std::cos( angleRad ) + p2.y() * -sin( angleRad ) ); + p2Rotated.setX( p2.x() * std::cos( angleRad ) + p2.y() * -std::sin( angleRad ) ); p2Rotated.setY( p2.x() * std::sin( angleRad ) + p2.y() * std::cos( angleRad ) ); QPolygonF arrowHeadPoly; @@ -76,7 +76,7 @@ double QgsComposerUtils::angle( QPointF p1, QPointF p2 ) return 0; } - double angle = acos( ( -yDiff * length ) / ( length * length ) ) * 180 / M_PI; + double angle = std::acos( ( -yDiff * length ) / ( length * length ) ) * 180 / M_PI; if ( xDiff < 0 ) { return ( 360 - angle ); @@ -99,7 +99,7 @@ double QgsComposerUtils::normalizedAngle( const double angle ) double clippedAngle = angle; if ( clippedAngle >= 360.0 || clippedAngle <= -360.0 ) { - clippedAngle = fmod( clippedAngle, 360.0 ); + clippedAngle = std::fmod( clippedAngle, 360.0 ); } if ( clippedAngle < 0.0 ) { diff --git a/src/core/composer/qgscomposition.cpp b/src/core/composer/qgscomposition.cpp index 778d36c03ce..92c0c8c9b8c 100644 --- a/src/core/composer/qgscomposition.cpp +++ b/src/core/composer/qgscomposition.cpp @@ -565,7 +565,7 @@ QPointF QgsComposition::positionOnPage( QPointF position ) const else { //y coordinate is less then the end of the last page - y = fmod( position.y(), ( paperHeight() + spaceBetweenPages() ) ); + y = std::fmod( position.y(), ( paperHeight() + spaceBetweenPages() ) ); } return QPointF( position.x(), y ); } @@ -1170,7 +1170,7 @@ void QgsComposition::addItemsFromXml( const QDomElement &elem, const QDomDocumen { if ( pasteInPlacePt ) { - newLabel->setItemPosition( newLabel->pos().x(), fmod( newLabel->pos().y(), ( paperHeight() + spaceBetweenPages() ) ) ); + newLabel->setItemPosition( newLabel->pos().x(), std::fmod( newLabel->pos().y(), ( paperHeight() + spaceBetweenPages() ) ) ); newLabel->move( pasteInPlacePt->x(), pasteInPlacePt->y() ); } else @@ -1203,7 +1203,7 @@ void QgsComposition::addItemsFromXml( const QDomElement &elem, const QDomDocumen { if ( pasteInPlace ) { - newMap->setItemPosition( newMap->pos().x(), fmod( newMap->pos().y(), ( paperHeight() + spaceBetweenPages() ) ) ); + newMap->setItemPosition( newMap->pos().x(), std::fmod( newMap->pos().y(), ( paperHeight() + spaceBetweenPages() ) ) ); newMap->move( pasteInPlacePt->x(), pasteInPlacePt->y() ); } else @@ -1247,7 +1247,7 @@ void QgsComposition::addItemsFromXml( const QDomElement &elem, const QDomDocumen { if ( pasteInPlace ) { - newArrow->setItemPosition( newArrow->pos().x(), fmod( newArrow->pos().y(), ( paperHeight() + spaceBetweenPages() ) ) ); + newArrow->setItemPosition( newArrow->pos().x(), std::fmod( newArrow->pos().y(), ( paperHeight() + spaceBetweenPages() ) ) ); newArrow->move( pasteInPlacePt->x(), pasteInPlacePt->y() ); } else @@ -1275,7 +1275,7 @@ void QgsComposition::addItemsFromXml( const QDomElement &elem, const QDomDocumen { if ( pasteInPlace ) { - newScaleBar->setItemPosition( newScaleBar->pos().x(), fmod( newScaleBar->pos().y(), ( paperHeight() + spaceBetweenPages() ) ) ); + newScaleBar->setItemPosition( newScaleBar->pos().x(), std::fmod( newScaleBar->pos().y(), ( paperHeight() + spaceBetweenPages() ) ) ); newScaleBar->move( pasteInPlacePt->x(), pasteInPlacePt->y() ); } else @@ -1305,7 +1305,7 @@ void QgsComposition::addItemsFromXml( const QDomElement &elem, const QDomDocumen { if ( pasteInPlace ) { - newShape->setItemPosition( newShape->pos().x(), fmod( newShape->pos().y(), ( paperHeight() + spaceBetweenPages() ) ) ); + newShape->setItemPosition( newShape->pos().x(), std::fmod( newShape->pos().y(), ( paperHeight() + spaceBetweenPages() ) ) ); newShape->move( pasteInPlacePt->x(), pasteInPlacePt->y() ); } else @@ -1335,7 +1335,7 @@ void QgsComposition::addItemsFromXml( const QDomElement &elem, const QDomDocumen { if ( pasteInPlace ) { - newPolygon->setItemPosition( newPolygon->pos().x(), fmod( newPolygon->pos().y(), ( paperHeight() + spaceBetweenPages() ) ) ); + newPolygon->setItemPosition( newPolygon->pos().x(), std::fmod( newPolygon->pos().y(), ( paperHeight() + spaceBetweenPages() ) ) ); newPolygon->move( pasteInPlacePt->x(), pasteInPlacePt->y() ); } else @@ -1366,7 +1366,7 @@ void QgsComposition::addItemsFromXml( const QDomElement &elem, const QDomDocumen { if ( pasteInPlace ) { - newPolyline->setItemPosition( newPolyline->pos().x(), fmod( newPolyline->pos().y(), ( paperHeight() + spaceBetweenPages() ) ) ); + newPolyline->setItemPosition( newPolyline->pos().x(), std::fmod( newPolyline->pos().y(), ( paperHeight() + spaceBetweenPages() ) ) ); newPolyline->move( pasteInPlacePt->x(), pasteInPlacePt->y() ); } else @@ -1396,7 +1396,7 @@ void QgsComposition::addItemsFromXml( const QDomElement &elem, const QDomDocumen { if ( pasteInPlace ) { - newPicture->setItemPosition( newPicture->pos().x(), fmod( newPicture->pos().y(), ( paperHeight() + spaceBetweenPages() ) ) ); + newPicture->setItemPosition( newPicture->pos().x(), std::fmod( newPicture->pos().y(), ( paperHeight() + spaceBetweenPages() ) ) ); newPicture->move( pasteInPlacePt->x(), pasteInPlacePt->y() ); } else @@ -1424,7 +1424,7 @@ void QgsComposition::addItemsFromXml( const QDomElement &elem, const QDomDocumen { if ( pasteInPlace ) { - newLegend->setItemPosition( newLegend->pos().x(), fmod( newLegend->pos().y(), ( paperHeight() + spaceBetweenPages() ) ) ); + newLegend->setItemPosition( newLegend->pos().x(), std::fmod( newLegend->pos().y(), ( paperHeight() + spaceBetweenPages() ) ) ); newLegend->move( pasteInPlacePt->x(), pasteInPlacePt->y() ); } else @@ -3152,7 +3152,7 @@ void QgsComposition::computeWorldFileParameters( const QRectF &exportRegion, dou // rotation matrix double r[6]; r[0] = std::cos( alpha ); - r[1] = -sin( alpha ); + r[1] = -std::sin( alpha ); r[2] = xCenter * ( 1 - std::cos( alpha ) ) + yCenter * std::sin( alpha ); r[3] = std::sin( alpha ); r[4] = std::cos( alpha ); diff --git a/src/core/effects/qgsimageoperation.cpp b/src/core/effects/qgsimageoperation.cpp index e3bcafe9798..fe7d98f7be0 100644 --- a/src/core/effects/qgsimageoperation.cpp +++ b/src/core/effects/qgsimageoperation.cpp @@ -770,7 +770,7 @@ double *QgsImageOperation::createGaussianKernel( const int radius ) double result; for ( int i = 0; i <= radius; ++i ) { - result = coefficient * exp( i * i * expCoefficient ); + result = coefficient * std::exp( i * i * expCoefficient ); kernel[ radius - i ] = result; sum += result; if ( i > 0 ) diff --git a/src/core/expression/qgsexpressionfunction.cpp b/src/core/expression/qgsexpressionfunction.cpp index b596f679b1d..3175353e361 100644 --- a/src/core/expression/qgsexpressionfunction.cpp +++ b/src/core/expression/qgsexpressionfunction.cpp @@ -267,22 +267,22 @@ static QVariant fcnCos( const QVariantList &values, const QgsExpressionContext * static QVariant fcnTan( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent ) { double x = QgsExpressionUtils::getDoubleValue( values.at( 0 ), parent ); - return QVariant( tan( x ) ); + return QVariant( std::tan( x ) ); } static QVariant fcnAsin( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent ) { double x = QgsExpressionUtils::getDoubleValue( values.at( 0 ), parent ); - return QVariant( asin( x ) ); + return QVariant( std::asin( x ) ); } static QVariant fcnAcos( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent ) { double x = QgsExpressionUtils::getDoubleValue( values.at( 0 ), parent ); - return QVariant( acos( x ) ); + return QVariant( std::acos( x ) ); } static QVariant fcnAtan( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent ) { double x = QgsExpressionUtils::getDoubleValue( values.at( 0 ), parent ); - return QVariant( atan( x ) ); + return QVariant( std::atan( x ) ); } static QVariant fcnAtan2( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent ) { @@ -293,14 +293,14 @@ static QVariant fcnAtan2( const QVariantList &values, const QgsExpressionContext static QVariant fcnExp( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent ) { double x = QgsExpressionUtils::getDoubleValue( values.at( 0 ), parent ); - return QVariant( exp( x ) ); + return QVariant( std::exp( x ) ); } static QVariant fcnLn( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent ) { double x = QgsExpressionUtils::getDoubleValue( values.at( 0 ), parent ); if ( x <= 0 ) return QVariant(); - return QVariant( log( x ) ); + return QVariant( std::log( x ) ); } static QVariant fcnLog10( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent ) { @@ -315,7 +315,7 @@ static QVariant fcnLog( const QVariantList &values, const QgsExpressionContext * double x = QgsExpressionUtils::getDoubleValue( values.at( 1 ), parent ); if ( x <= 0 || b <= 0 ) return QVariant(); - return QVariant( log( x ) / log( b ) ); + return QVariant( std::log( x ) / std::log( b ) ); } static QVariant fcnRndF( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent ) { @@ -2656,11 +2656,11 @@ static QVariant fcnAzimuth( const QVariantList &values, const QgsExpressionConte { if ( pt1->y() < pt2->y() ) { - return atan( std::fabs( pt1->x() - pt2->x() ) / std::fabs( pt1->y() - pt2->y() ) ); + return std::atan( std::fabs( pt1->x() - pt2->x() ) / std::fabs( pt1->y() - pt2->y() ) ); } else /* ( pt1->y() > pt2->y() ) - equality case handled above */ { - return atan( std::fabs( pt1->y() - pt2->y() ) / std::fabs( pt1->x() - pt2->x() ) ) + return std::atan( std::fabs( pt1->y() - pt2->y() ) / std::fabs( pt1->x() - pt2->x() ) ) + ( M_PI / 2 ); } } @@ -2669,12 +2669,12 @@ static QVariant fcnAzimuth( const QVariantList &values, const QgsExpressionConte { if ( pt1->y() > pt2->y() ) { - return atan( std::fabs( pt1->x() - pt2->x() ) / std::fabs( pt1->y() - pt2->y() ) ) + return std::atan( std::fabs( pt1->x() - pt2->x() ) / std::fabs( pt1->y() - pt2->y() ) ) + M_PI; } else /* ( pt1->y() < pt2->y() ) - equality case handled above */ { - return atan( std::fabs( pt1->y() - pt2->y() ) / std::fabs( pt1->x() - pt2->x() ) ) + return std::atan( std::fabs( pt1->y() - pt2->y() ) / std::fabs( pt1->x() - pt2->x() ) ) + ( M_PI + ( M_PI / 2 ) ); } } diff --git a/src/core/expression/qgsexpressionnodeimpl.cpp b/src/core/expression/qgsexpressionnodeimpl.cpp index 8e33114cb78..d7528d875ef 100644 --- a/src/core/expression/qgsexpressionnodeimpl.cpp +++ b/src/core/expression/qgsexpressionnodeimpl.cpp @@ -577,7 +577,7 @@ double QgsExpressionNodeBinaryOperator::computeDouble( double x, double y ) case boDiv: return x / y; case boMod: - return fmod( x, y ); + return std::fmod( x, y ); default: Q_ASSERT( false ); return 0; diff --git a/src/core/geometry/qgscircularstring.cpp b/src/core/geometry/qgscircularstring.cpp index 5ccd632267e..07ceada9178 100644 --- a/src/core/geometry/qgscircularstring.cpp +++ b/src/core/geometry/qgscircularstring.cpp @@ -772,7 +772,7 @@ void QgsCircularString::sumUpArea( double &sum ) const bool circlePointLeftOfLine = QgsGeometryUtils::leftOfLine( p2.x(), p2.y(), p1.x(), p1.y(), p3.x(), p3.y() ) < 0; bool centerPointLeftOfLine = QgsGeometryUtils::leftOfLine( centerX, centerY, p1.x(), p1.y(), p3.x(), p3.y() ) < 0; - double cov = 0.5 - d * std::sqrt( r2 - d * d ) / ( M_PI * r2 ) - 1 / M_PI * asin( d / radius ); + double cov = 0.5 - d * std::sqrt( r2 - d * d ) / ( M_PI * r2 ) - 1 / M_PI * std::asin( d / radius ); double circleChordArea = 0; if ( circlePointLeftOfLine == centerPointLeftOfLine ) { diff --git a/src/core/geometry/qgsellipse.cpp b/src/core/geometry/qgsellipse.cpp index bfb3ddd7e5d..4b653d38201 100644 --- a/src/core/geometry/qgsellipse.cpp +++ b/src/core/geometry/qgsellipse.cpp @@ -139,7 +139,7 @@ void QgsEllipse::setAzimuth( const double azimuth ) double QgsEllipse::focusDistance() const { - return sqrt( mSemiMajorAxis * mSemiMajorAxis - mSemiMinorAxis * mSemiMinorAxis ); + return std::sqrt( mSemiMajorAxis * mSemiMajorAxis - mSemiMinorAxis * mSemiMinorAxis ); } QVector QgsEllipse::foci() const diff --git a/src/core/geometry/qgsgeometry.cpp b/src/core/geometry/qgsgeometry.cpp index 95ed2a5e49e..203d1ad68ed 100644 --- a/src/core/geometry/qgsgeometry.cpp +++ b/src/core/geometry/qgsgeometry.cpp @@ -989,7 +989,7 @@ QgsGeometry QgsGeometry::orientedMinimumBoundingBox( double &area, double &angle // constrain angle to 0 - 180 if ( angle > 180.0 ) - angle = fmod( angle, 180.0 ); + angle = std::fmod( angle, 180.0 ); return minBounds; } diff --git a/src/core/geometry/qgsgeometryutils.cpp b/src/core/geometry/qgsgeometryutils.cpp index b1670fb2cf4..8724af6500e 100644 --- a/src/core/geometry/qgsgeometryutils.cpp +++ b/src/core/geometry/qgsgeometryutils.cpp @@ -659,7 +659,7 @@ void QgsGeometryUtils::segmentizeArc( const QgsPoint &p1, const QgsPoint &p2, co double increment = tolerance; //one segment per degree if ( toleranceType == QgsAbstractGeometry::MaximumDifference ) { - double halfAngle = acos( -tolerance / radius + 1 ); + double halfAngle = std::acos( -tolerance / radius + 1 ); increment = 2 * halfAngle; } @@ -936,7 +936,7 @@ double QgsGeometryUtils::normalizedAngle( double angle ) double clippedAngle = angle; if ( clippedAngle >= M_PI * 2 || clippedAngle <= -2 * M_PI ) { - clippedAngle = fmod( clippedAngle, 2 * M_PI ); + clippedAngle = std::fmod( clippedAngle, 2 * M_PI ); } if ( clippedAngle < 0.0 ) { diff --git a/src/core/geometry/qgsgeos.cpp b/src/core/geometry/qgsgeos.cpp index 769e2d50787..14ca2d20cf2 100644 --- a/src/core/geometry/qgsgeos.cpp +++ b/src/core/geometry/qgsgeos.cpp @@ -2704,12 +2704,12 @@ int QgsGeos::geomDigits( const GEOSGeometry *geom ) GEOSCoordSeq_getX_r( geosinit.ctxt, bBoxCoordSeq, i, &t ); int digits; - digits = std::ceil( log10( std::fabs( t ) ) ); + digits = std::ceil( std::log10( std::fabs( t ) ) ); if ( digits > maxDigits ) maxDigits = digits; GEOSCoordSeq_getY_r( geosinit.ctxt, bBoxCoordSeq, i, &t ); - digits = std::ceil( log10( std::fabs( t ) ) ); + digits = std::ceil( std::log10( std::fabs( t ) ) ); if ( digits > maxDigits ) maxDigits = digits; } diff --git a/src/core/geometry/qgspoint.cpp b/src/core/geometry/qgspoint.cpp index 4038b1ee132..f7fad7bc56c 100644 --- a/src/core/geometry/qgspoint.cpp +++ b/src/core/geometry/qgspoint.cpp @@ -480,12 +480,12 @@ QPointF QgsPoint::toQPointF() const double QgsPoint::distance( double x, double y ) const { - return sqrt( ( mX - x ) * ( mX - x ) + ( mY - y ) * ( mY - y ) ); + return std::sqrt( ( mX - x ) * ( mX - x ) + ( mY - y ) * ( mY - y ) ); } double QgsPoint::distance( const QgsPoint &other ) const { - return sqrt( ( mX - other.x() ) * ( mX - other.x() ) + ( mY - other.y() ) * ( mY - other.y() ) ); + return std::sqrt( ( mX - other.x() ) * ( mX - other.x() ) + ( mY - other.y() ) * ( mY - other.y() ) ); } double QgsPoint::distanceSquared( double x, double y ) const @@ -504,7 +504,7 @@ double QgsPoint::distance3D( double x, double y, double z ) const if ( is3D() || !std::isnan( z ) ) zDistSquared = ( mZ - z ) * ( mZ - z ); - return sqrt( ( mX - x ) * ( mX - x ) + ( mY - y ) * ( mY - y ) + zDistSquared ); + return std::sqrt( ( mX - x ) * ( mX - x ) + ( mY - y ) * ( mY - y ) + zDistSquared ); } double QgsPoint::distance3D( const QgsPoint &other ) const @@ -513,7 +513,7 @@ double QgsPoint::distance3D( const QgsPoint &other ) const if ( is3D() || other.is3D() ) zDistSquared = ( mZ - other.z() ) * ( mZ - other.z() ); - return sqrt( ( mX - other.x() ) * ( mX - other.x() ) + ( mY - other.y() ) * ( mY - other.y() ) + zDistSquared ); + return std::sqrt( ( mX - other.x() ) * ( mX - other.x() ) + ( mY - other.y() ) * ( mY - other.y() ) + zDistSquared ); } double QgsPoint::distanceSquared3D( double x, double y, double z ) const @@ -550,7 +550,7 @@ double QgsPoint::inclination( const QgsPoint &other ) const } double dz = other.z() - mZ; - return ( acos( dz / distance ) * 180.0 / M_PI ); + return ( std::acos( dz / distance ) * 180.0 / M_PI ); } QgsPoint QgsPoint::project( double distance, double azimuth, double inclination ) const @@ -559,7 +559,7 @@ QgsPoint QgsPoint::project( double distance, double azimuth, double inclination double radsXy = azimuth * M_PI / 180.0; double dx = 0.0, dy = 0.0, dz = 0.0; - inclination = fmod( inclination, 360.0 ); + inclination = std::fmod( inclination, 360.0 ); if ( !qgsDoubleNear( inclination, 90.0 ) ) pType = QgsWkbTypes::addZ( pType ); diff --git a/src/core/geometry/qgsrectangle.cpp b/src/core/geometry/qgsrectangle.cpp index b9a5e903b55..75c08eec6a7 100644 --- a/src/core/geometry/qgsrectangle.cpp +++ b/src/core/geometry/qgsrectangle.cpp @@ -305,7 +305,7 @@ QString QgsRectangle::toString( int precision ) const precision = 0; if ( ( width() < 10 || height() < 10 ) && ( width() > 0 && height() > 0 ) ) { - precision = static_cast( std::ceil( -1.0 * log10( qMin( width(), height() ) ) ) ) + 1; + precision = static_cast( std::ceil( -1.0 * std::log10( qMin( width(), height() ) ) ) ) + 1; // sanity check if ( precision > 20 ) precision = 20; diff --git a/src/core/geometry/qgstriangle.cpp b/src/core/geometry/qgstriangle.cpp index bb390874106..e9bff06c876 100644 --- a/src/core/geometry/qgstriangle.cpp +++ b/src/core/geometry/qgstriangle.cpp @@ -382,9 +382,9 @@ QVector QgsTriangle::angles() const cx = vertexAt( 2 ).x(); cy = vertexAt( 2 ).y(); - double a1 = fmod( QgsGeometryUtils::angleBetweenThreePoints( cx, cy, ax, ay, bx, by ), M_PI ); - double a2 = fmod( QgsGeometryUtils::angleBetweenThreePoints( ax, ay, bx, by, cx, cy ), M_PI ); - double a3 = fmod( QgsGeometryUtils::angleBetweenThreePoints( bx, by, cx, cy, ax, ay ), M_PI ); + double a1 = std::fmod( QgsGeometryUtils::angleBetweenThreePoints( cx, cy, ax, ay, bx, by ), M_PI ); + double a2 = std::fmod( QgsGeometryUtils::angleBetweenThreePoints( ax, ay, bx, by, cx, cy ), M_PI ); + double a3 = std::fmod( QgsGeometryUtils::angleBetweenThreePoints( bx, by, cx, cy, ax, ay ), M_PI ); angles.append( ( a1 > M_PI / 2 ? a1 - M_PI / 2 : a1 ) ); angles.append( ( a2 > M_PI / 2 ? a2 - M_PI / 2 : a2 ) ); diff --git a/src/core/layout/qgslayoututils.cpp b/src/core/layout/qgslayoututils.cpp index 387ba16cd9a..1422deee6fa 100644 --- a/src/core/layout/qgslayoututils.cpp +++ b/src/core/layout/qgslayoututils.cpp @@ -27,7 +27,7 @@ double QgsLayoutUtils::normalizedAngle( const double angle, const bool allowNega double clippedAngle = angle; if ( clippedAngle >= 360.0 || clippedAngle <= -360.0 ) { - clippedAngle = fmod( clippedAngle, 360.0 ); + clippedAngle = std::fmod( clippedAngle, 360.0 ); } if ( !allowNegative && clippedAngle < 0.0 ) { diff --git a/src/core/pal/feature.cpp b/src/core/pal/feature.cpp index c0ec8a1f68e..1c2a5889c34 100644 --- a/src/core/pal/feature.cpp +++ b/src/core/pal/feature.cpp @@ -720,7 +720,7 @@ int FeaturePart::createCandidatesAlongLineNearStraightSegments( QList 1 (lower for longer segments) - double segmentAngleCost = 1 - std::fabs( fmod( currentSegmentAngle, M_PI ) - M_PI_2 ) / M_PI_2; // 0 -> 1, lower for more horizontal segments + double segmentAngleCost = 1 - std::fabs( std::fmod( currentSegmentAngle, M_PI ) - M_PI_2 ) / M_PI_2; // 0 -> 1, lower for more horizontal segments while ( currentDistanceAlongLine + labelWidth < distanceToEndOfSegment ) { diff --git a/src/core/pal/geomfunction.h b/src/core/pal/geomfunction.h index a8e0d762d70..7980a3a6e1c 100644 --- a/src/core/pal/geomfunction.h +++ b/src/core/pal/geomfunction.h @@ -65,7 +65,7 @@ namespace pal static inline double dist_euc2d( double x1, double y1, double x2, double y2 ) { - return sqrt( ( x2 - x1 ) * ( x2 - x1 ) + ( y2 - y1 ) * ( y2 - y1 ) ); + return std::sqrt( ( x2 - x1 ) * ( x2 - x1 ) + ( y2 - y1 ) * ( y2 - y1 ) ); } static inline double dist_euc2d_sq( double x1, double y1, double x2, double y2 ) diff --git a/src/core/pal/labelposition.cpp b/src/core/pal/labelposition.cpp index 74a2a390057..270f3026bdb 100644 --- a/src/core/pal/labelposition.cpp +++ b/src/core/pal/labelposition.cpp @@ -525,7 +525,7 @@ int LabelPosition::polygonIntersectionCost( PointSet *polygon ) const //effectively take the average polygon intersection cost for all label parts double totalCost = polygonIntersectionCostForParts( polygon ); int n = partCount(); - return ceil( totalCost / n ); + return std::ceil( totalCost / n ); } bool LabelPosition::intersectsWithPolygon( PointSet *polygon ) const diff --git a/src/core/qgis.h b/src/core/qgis.h index 4a1e853fd2c..4d8a9d7ea38 100644 --- a/src/core/qgis.h +++ b/src/core/qgis.h @@ -232,8 +232,8 @@ inline bool qgsDoubleNearSig( double a, double b, int significantDigits = 10 ) // has to be considered (maybe TODO) // Is there a better way? int aexp, bexp; - double ar = frexp( a, &aexp ); - double br = frexp( b, &bexp ); + double ar = std::frexp( a, &aexp ); + double br = std::frexp( b, &bexp ); return aexp == bexp && std::round( ar * std::pow( 10.0, significantDigits ) ) == std::round( br * std::pow( 10.0, significantDigits ) ); diff --git a/src/core/qgscolorramp.cpp b/src/core/qgscolorramp.cpp index 8182256b14b..b0920dac184 100644 --- a/src/core/qgscolorramp.cpp +++ b/src/core/qgscolorramp.cpp @@ -396,7 +396,7 @@ QList 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.0, std::round( ( fmod( currentHueAngle, 360.0 ) / 360.0 ) * ( safeHueMax - safeHueMin ) + safeHueMin ), 359.0 ); + h = qBound( 0.0, std::round( ( std::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 ) ); diff --git a/src/core/qgscoordinateutils.cpp b/src/core/qgscoordinateutils.cpp index 561c47837a6..319666518ae 100644 --- a/src/core/qgscoordinateutils.cpp +++ b/src/core/qgscoordinateutils.cpp @@ -45,7 +45,7 @@ int QgsCoordinateUtils::calculateCoordinatePrecision( double mapUnitsPerPixel, c // having enough decimal places to show the difference in position between adjacent pixels. // Also avoid taking the log of 0. if ( !qgsDoubleNear( mapUnitsPerPixel, 0.0 ) ) - dp = static_cast( std::ceil( -1.0 * log10( mapUnitsPerPixel ) ) ); + dp = static_cast( std::ceil( -1.0 * std::log10( mapUnitsPerPixel ) ) ); } else { diff --git a/src/core/qgsdiagramrenderer.cpp b/src/core/qgsdiagramrenderer.cpp index c65bea80449..9ca2279ec94 100644 --- a/src/core/qgsdiagramrenderer.cpp +++ b/src/core/qgsdiagramrenderer.cpp @@ -258,7 +258,7 @@ void QgsDiagramSettings::readXml( const QDomElement &elem ) barWidth = elem.attribute( QStringLiteral( "barWidth" ) ).toDouble(); if ( elem.hasAttribute( QStringLiteral( "angleOffset" ) ) ) - rotationOffset = fmod( 360.0 - elem.attribute( QStringLiteral( "angleOffset" ) ).toInt() / 16.0, 360.0 ); + rotationOffset = std::fmod( 360.0 - elem.attribute( QStringLiteral( "angleOffset" ) ).toInt() / 16.0, 360.0 ); else rotationOffset = elem.attribute( QStringLiteral( "rotationOffset" ) ).toDouble(); diff --git a/src/core/qgsdistancearea.cpp b/src/core/qgsdistancearea.cpp index a964693aef7..85a966f3a49 100644 --- a/src/core/qgsdistancearea.cpp +++ b/src/core/qgsdistancearea.cpp @@ -411,8 +411,8 @@ QgsPointXY QgsDistanceArea::computeSpheroidProject( double radians_long = DEG2RAD( p1.x() ); double b2 = POW2( b ); // spheroid_mu2 double omf = 1 - f; - double tan_u1 = omf * tan( radians_lat ); - double u1 = atan( tan_u1 ); + double tan_u1 = omf * std::tan( radians_lat ); + double u1 = std::atan( tan_u1 ); double sigma, last_sigma, delta_sigma, two_sigma_m; double sigma1, sin_alpha, alpha, cos_alphasq; double u2, A, B; @@ -428,7 +428,7 @@ QgsPointXY QgsDistanceArea::computeSpheroidProject( } sigma1 = std::atan2( tan_u1, std::cos( azimuth ) ); sin_alpha = std::cos( u1 ) * std::sin( azimuth ); - alpha = asin( sin_alpha ); + alpha = std::asin( sin_alpha ); cos_alphasq = 1.0 - POW2( sin_alpha ); u2 = POW2( std::cos( alpha ) ) * ( POW2( a ) - b2 ) / b2; // spheroid_mu2 A = 1.0 + ( u2 / 16384.0 ) * ( 4096.0 + u2 * ( -768.0 + u2 * ( 320.0 - 175.0 * u2 ) ) ); @@ -551,8 +551,8 @@ double QgsDistanceArea::computeDistanceBearing( double p2_lat = DEG2RAD( p2.y() ), p2_lon = DEG2RAD( p2.x() ); double L = p2_lon - p1_lon; - double U1 = atan( ( 1 - f ) * tan( p1_lat ) ); - double U2 = atan( ( 1 - f ) * tan( p2_lat ) ); + double U1 = std::atan( ( 1 - f ) * std::tan( p1_lat ) ); + double U2 = std::atan( ( 1 - f ) * std::tan( p2_lat ) ); double sinU1 = std::sin( U1 ), cosU1 = std::cos( U1 ); double sinU2 = std::sin( U2 ), cosU2 = std::cos( U2 ); double lambda = L; @@ -580,7 +580,7 @@ double QgsDistanceArea::computeDistanceBearing( sinSigma = std::sqrt( tu1 * tu1 + tu2 * tu2 ); cosSigma = sinU1 * sinU2 + cosU1 * cosU2 * cosLambda; sigma = std::atan2( sinSigma, cosSigma ); - alpha = asin( cosU1 * cosU2 * sinLambda / sinSigma ); + alpha = std::asin( cosU1 * cosU2 * sinLambda / sinSigma ); cosSqAlpha = std::cos( alpha ) * std::cos( alpha ); cos2SigmaM = cosSigma - 2 * sinU1 * sinU2 / cosSqAlpha; C = f / 16 * cosSqAlpha * ( 4 + f * ( 4 - 3 * cosSqAlpha ) ); @@ -797,7 +797,7 @@ double QgsDistanceArea::computePolygonFlatArea( const QList &points } // QgsDebugMsg("Area from point: " + (points[i % size]).toString(2)); area = area / 2.0; - return fabs( area ); // All areas are positive! + return std::fabs( area ); // All areas are positive! } QString QgsDistanceArea::formatDistance( double distance, int decimals, QgsUnitTypes::DistanceUnit unit, bool keepBaseUnit ) diff --git a/src/core/qgshistogram.cpp b/src/core/qgshistogram.cpp index 1500594230d..d54a561a9a4 100644 --- a/src/core/qgshistogram.cpp +++ b/src/core/qgshistogram.cpp @@ -69,7 +69,7 @@ double QgsHistogram::optimalBinWidth() const int QgsHistogram::optimalNumberBins() const { - return ceil( ( mMax - mMin ) / optimalBinWidth() ); + return std::ceil( ( mMax - mMin ) / optimalBinWidth() ); } QList QgsHistogram::binEdges( int bins ) const diff --git a/src/core/qgsmapsettingsutils.cpp b/src/core/qgsmapsettingsutils.cpp index 6bccd819a1f..d54c7772152 100644 --- a/src/core/qgsmapsettingsutils.cpp +++ b/src/core/qgsmapsettingsutils.cpp @@ -93,7 +93,7 @@ QString QgsMapSettingsUtils::worldFileContent( const QgsMapSettings &mapSettings // rotation matrix double r[6]; r[0] = std::cos( alpha ); - r[1] = -sin( alpha ); + r[1] = -std::sin( alpha ); r[2] = xCenter * ( 1 - std::cos( alpha ) ) + yCenter * std::sin( alpha ); r[3] = std::sin( alpha ); r[4] = std::cos( alpha ); diff --git a/src/core/qgspallabeling.cpp b/src/core/qgspallabeling.cpp index 20b568dac99..ac7aef85b5f 100644 --- a/src/core/qgspallabeling.cpp +++ b/src/core/qgspallabeling.cpp @@ -604,7 +604,7 @@ void QgsPalLayerSettings::readFromLayerCustomProperties( QgsVectorLayer *layer ) if ( tempAngle.isValid() ) { double oldAngle = layer->customProperty( QStringLiteral( "labeling/angleOffset" ), QVariant( 0.0 ) ).toDouble(); - angleOffset = fmod( 360 - oldAngle, 360.0 ); + angleOffset = std::fmod( 360 - oldAngle, 360.0 ); } else { @@ -824,7 +824,7 @@ void QgsPalLayerSettings::readXml( QDomElement &elem, const QgsReadWriteContext if ( placementElem.hasAttribute( QStringLiteral( "angleOffset" ) ) ) { double oldAngle = placementElem.attribute( QStringLiteral( "angleOffset" ), QStringLiteral( "0" ) ).toDouble(); - angleOffset = fmod( 360 - oldAngle, 360.0 ); + angleOffset = std::fmod( 360 - oldAngle, 360.0 ); } else { diff --git a/src/core/qgspointxy.cpp b/src/core/qgspointxy.cpp index 73c1b57b4d5..f98798337c3 100644 --- a/src/core/qgspointxy.cpp +++ b/src/core/qgspointxy.cpp @@ -61,7 +61,7 @@ QString QgsPointXY::toString( int precision ) const QString QgsPointXY::toDegreesMinutesSeconds( int precision, const bool useSuffix, const bool padded ) const { //first, limit longitude to -360 to 360 degree range - double myWrappedX = fmod( mX, 360.0 ); + double myWrappedX = std::fmod( mX, 360.0 ); //next, wrap around longitudes > 180 or < -180 degrees, so that, e.g., "190E" -> "170W" if ( myWrappedX > 180.0 ) { @@ -73,7 +73,7 @@ QString QgsPointXY::toDegreesMinutesSeconds( int precision, const bool useSuffix } //first, limit latitude to -180 to 180 degree range - double myWrappedY = fmod( mY, 180.0 ); + double myWrappedY = std::fmod( mY, 180.0 ); //next, wrap around latitudes > 90 or < -90 degrees, so that, e.g., "110S" -> "70N" if ( myWrappedY > 90.0 ) { @@ -175,7 +175,7 @@ QString QgsPointXY::toDegreesMinutesSeconds( int precision, const bool useSuffix QString QgsPointXY::toDegreesMinutes( int precision, const bool useSuffix, const bool padded ) const { //first, limit longitude to -360 to 360 degree range - double myWrappedX = fmod( mX, 360.0 ); + double myWrappedX = std::fmod( mX, 360.0 ); //next, wrap around longitudes > 180 or < -180 degrees, so that, e.g., "190E" -> "170W" if ( myWrappedX > 180.0 ) { @@ -273,12 +273,12 @@ double QgsPointXY::sqrDist( const QgsPointXY &other ) const double QgsPointXY::distance( double x, double y ) const { - return sqrt( sqrDist( x, y ) ); + return std::sqrt( sqrDist( x, y ) ); } double QgsPointXY::distance( const QgsPointXY &other ) const { - return sqrt( sqrDist( other ) ); + return std::sqrt( sqrDist( other ) ); } double QgsPointXY::azimuth( const QgsPointXY &other ) const diff --git a/src/core/qgsscalecalculator.cpp b/src/core/qgsscalecalculator.cpp index 1ebeb5706f2..4973ab400df 100644 --- a/src/core/qgsscalecalculator.cpp +++ b/src/core/qgsscalecalculator.cpp @@ -115,7 +115,7 @@ double QgsScaleCalculator::calculateGeographicDistance( const QgsRectangle &mapE // For a longitude change of 180 degrees double lat = ( mapExtent.yMaximum() + mapExtent.yMinimum() ) * 0.5; - static const double RADS = ( 4.0 * atan( 1.0 ) ) / 180.0; + static const double RADS = ( 4.0 * std::atan( 1.0 ) ) / 180.0; double a = std::pow( std::cos( lat * RADS ), 2 ); double c = 2.0 * std::atan2( std::sqrt( a ), std::sqrt( 1.0 - a ) ); static const double RA = 6378000; // [m] diff --git a/src/core/qgstolerance.cpp b/src/core/qgstolerance.cpp index 2fa487be7c8..85c46ca9bf8 100644 --- a/src/core/qgstolerance.cpp +++ b/src/core/qgstolerance.cpp @@ -109,11 +109,11 @@ double QgsTolerance::computeMapUnitPerPixel( QgsMapLayer *layer, const QgsMapSet double y = p3.sqrDist( p4 ); if ( x > y ) { - return sqrt( x ); + return std::sqrt( x ); } else { - return sqrt( y ); + return std::sqrt( y ); } } diff --git a/src/core/qgsvector.cpp b/src/core/qgsvector.cpp index ac2c48fddd8..974a0722672 100644 --- a/src/core/qgsvector.cpp +++ b/src/core/qgsvector.cpp @@ -76,7 +76,7 @@ QgsVector &QgsVector::operator-=( QgsVector other ) double QgsVector::length() const { - return sqrt( mX * mX + mY * mY ); + return std::sqrt( mX * mX + mY * mY ); } double QgsVector::x() const diff --git a/src/core/raster/qgscolorrampshader.cpp b/src/core/raster/qgscolorrampshader.cpp index 740f02d3047..aaebc1f2be3 100644 --- a/src/core/raster/qgscolorrampshader.cpp +++ b/src/core/raster/qgscolorrampshader.cpp @@ -285,8 +285,8 @@ void QgsColorRampShader::classifyColorRamp( const int classes, const int band, c QVector::const_iterator color_it = entryColors.begin(); // calculate a reasonable number of decimals to display - double maxabs = log10( qMax( std::fabs( max ), std::fabs( min ) ) ); - int nDecimals = std::round( qMax( 3.0 + maxabs - log10( max - min ), maxabs <= 15.0 ? maxabs + 0.49 : 0.0 ) ); + double maxabs = std::log10( qMax( std::fabs( max ), std::fabs( min ) ) ); + int nDecimals = std::round( qMax( 3.0 + maxabs - std::log10( max - min ), maxabs <= 15.0 ? maxabs + 0.49 : 0.0 ) ); QList colorRampItems; for ( ; value_it != entryValues.end(); ++value_it, ++color_it ) diff --git a/src/core/raster/qgshillshaderenderer.cpp b/src/core/raster/qgshillshaderenderer.cpp index 4fdf13bcd83..4fd0cfa0adb 100644 --- a/src/core/raster/qgshillshaderenderer.cpp +++ b/src/core/raster/qgshillshaderenderer.cpp @@ -210,7 +210,7 @@ QgsRasterBlock *QgsHillshadeRenderer::block( int bandNo, const QgsRectangle &ext double derX = calcFirstDerX( x11, x21, x31, x12, x22, x32, x13, x23, x33, cellXSize ); double derY = calcFirstDerY( x11, x21, x31, x12, x22, x32, x13, x23, x33, cellYSize ); - double slopeRad = atan( mZFactor * std::sqrt( derX * derX + derY * derY ) ); + double slopeRad = std::atan( mZFactor * std::sqrt( derX * derX + derY * derY ) ); double aspectRad = std::atan2( derX, -derY ); diff --git a/src/core/raster/qgsrasterchecker.cpp b/src/core/raster/qgsrasterchecker.cpp index 42cf37806ee..6b58fd39b5a 100644 --- a/src/core/raster/qgsrasterchecker.cpp +++ b/src/core/raster/qgsrasterchecker.cpp @@ -202,7 +202,7 @@ double QgsRasterChecker::tolerance( double val, int places ) { // float precision is about 7 decimal digits, double about 16 // default places = 6 - return 1. * std::pow( 10, std::round( log10( std::fabs( val ) ) - places ) ); + return 1. * std::pow( 10, std::round( std::log10( std::fabs( val ) ) - places ) ); } QString QgsRasterChecker::compareHead() diff --git a/src/core/raster/qgsrasterinterface.h b/src/core/raster/qgsrasterinterface.h index 437c03779b1..99842f27eaf 100644 --- a/src/core/raster/qgsrasterinterface.h +++ b/src/core/raster/qgsrasterinterface.h @@ -203,7 +203,7 @@ class CORE_EXPORT QgsRasterInterface //! \brief helper function to create zero padded band names virtual QString generateBandName( int bandNumber ) const { - return tr( "Band" ) + QStringLiteral( " %1" ) .arg( bandNumber, 1 + static_cast< int >( log10( static_cast< double >( bandCount() ) ) ), 10, QChar( '0' ) ); + return tr( "Band" ) + QStringLiteral( " %1" ) .arg( bandNumber, 1 + static_cast< int >( std::log10( static_cast< double >( bandCount() ) ) ), 10, QChar( '0' ) ); } /** Read block of data using given extent and size. diff --git a/src/core/simplify/effectivearea.cpp b/src/core/simplify/effectivearea.cpp index d193666b759..126064431c0 100644 --- a/src/core/simplify/effectivearea.cpp +++ b/src/core/simplify/effectivearea.cpp @@ -43,7 +43,7 @@ static void destroy_minheap( MINHEAP tree ) */ static double triarea2d( const QgsPoint &P1, const QgsPoint &P2, const QgsPoint &P3 ) { - return fabs( 0.5 * ( ( P1.x() - P2.x() ) * ( P3.y() - P2.y() ) - ( P1.y() - P2.y() ) * ( P3.x() - P2.x() ) ) ); + return std::fabs( 0.5 * ( ( P1.x() - P2.x() ) * ( P3.y() - P2.y() ) - ( P1.y() - P2.y() ) * ( P3.x() - P2.x() ) ) ); } /** diff --git a/src/core/symbology/qgsarrowsymbollayer.cpp b/src/core/symbology/qgsarrowsymbollayer.cpp index 6e33fe5e58d..f2564251beb 100644 --- a/src/core/symbology/qgsarrowsymbollayer.cpp +++ b/src/core/symbology/qgsarrowsymbollayer.cpp @@ -201,7 +201,7 @@ void QgsArrowSymbolLayer::stopRender( QgsSymbolRenderContext &context ) inline qreal euclidian_distance( QPointF po, QPointF pd ) { - return sqrt( ( po.x() - pd.x() ) * ( po.x() - pd.x() ) + ( po.y() - pd.y() ) * ( po.y() - pd.y() ) ); + return std::sqrt( ( po.x() - pd.x() ) * ( po.x() - pd.x() ) + ( po.y() - pd.y() ) * ( po.y() - pd.y() ) ); } QPolygonF straightArrow( QPointF po, QPointF pd, @@ -506,7 +506,7 @@ QPolygonF curvedArrow( QPointF po, QPointF pm, QPointF pd, pm = circlePoint( circleCenter, circleRadius, angle_m ); pd = circlePoint( circleCenter, circleRadius, angle_d ); - qreal headAngle = direction * atan( headWidth / circleRadius ); + qreal headAngle = direction * std::atan( headWidth / circleRadius ); QPainterPath path; diff --git a/src/core/symbology/qgsheatmaprenderer.cpp b/src/core/symbology/qgsheatmaprenderer.cpp index 8d013248be2..0ced32a6f34 100644 --- a/src/core/symbology/qgsheatmaprenderer.cpp +++ b/src/core/symbology/qgsheatmaprenderer.cpp @@ -203,12 +203,12 @@ double QgsHeatmapRenderer::uniformKernel( const double distance, const int bandw double QgsHeatmapRenderer::quarticKernel( const double distance, const int bandwidth ) const { - return pow( 1. - std::pow( distance / static_cast< double >( bandwidth ), 2 ), 2 ); + return std::pow( 1. - std::pow( distance / static_cast< double >( bandwidth ), 2 ), 2 ); } double QgsHeatmapRenderer::triweightKernel( const double distance, const int bandwidth ) const { - return pow( 1. - std::pow( distance / static_cast< double >( bandwidth ), 2 ), 3 ); + return std::pow( 1. - std::pow( distance / static_cast< double >( bandwidth ), 2 ), 3 ); } double QgsHeatmapRenderer::epanechnikovKernel( const double distance, const int bandwidth ) const diff --git a/src/core/symbology/qgslinesymbollayer.cpp b/src/core/symbology/qgslinesymbollayer.cpp index 771e6605823..ee7db666715 100644 --- a/src/core/symbology/qgslinesymbollayer.cpp +++ b/src/core/symbology/qgslinesymbollayer.cpp @@ -672,7 +672,7 @@ class MyLine // return angle in radians double angle() { - double a = ( mVertical ? M_PI / 2 : atan( mT ) ); + double a = ( mVertical ? M_PI / 2 : std::atan( mT ) ); if ( !mIncreasing ) a += M_PI; @@ -685,7 +685,7 @@ class MyLine if ( mVertical ) return ( mIncreasing ? QPointF( 0, interval ) : QPointF( 0, -interval ) ); - double alpha = atan( mT ); + double alpha = std::atan( mT ); double dx = std::cos( alpha ) * interval; double dy = std::sin( alpha ) * interval; return ( mIncreasing ? QPointF( dx, dy ) : QPointF( -dx, -dy ) ); diff --git a/src/core/symbology/qgssymbollayerutils.cpp b/src/core/symbology/qgssymbollayerutils.cpp index 96726c1210c..32c13eb1c29 100644 --- a/src/core/symbology/qgssymbollayerutils.cpp +++ b/src/core/symbology/qgssymbollayerutils.cpp @@ -3932,7 +3932,7 @@ QList QgsSymbolLayerUtils::prettyBreaks( double minimum, double maximum, cell = 20 * 1e-07; } - double base = std::pow( 10.0, std::floor( log10( cell ) ) ); + double base = std::pow( 10.0, std::floor( std::log10( cell ) ) ); double unit = base; if ( ( 2 * base ) - cell < h * ( cell - unit ) ) { diff --git a/src/gui/qgsadvanceddigitizingdockwidget.cpp b/src/gui/qgsadvanceddigitizingdockwidget.cpp index 885f3f55197..25c432f1b84 100644 --- a/src/gui/qgsadvanceddigitizingdockwidget.cpp +++ b/src/gui/qgsadvanceddigitizingdockwidget.cpp @@ -828,7 +828,7 @@ bool QgsAdvancedDigitizingDockWidget::applyConstraints( QgsMapMouseEvent *e ) point.x() - previousPt.x() ) - angle ) * 180 / M_PI; // modulus - angle = fmod( angle, 360.0 ); + angle = std::fmod( angle, 360.0 ); mAngleConstraint->setValue( angle ); } // --- distance diff --git a/src/gui/qgscolorwidgets.cpp b/src/gui/qgscolorwidgets.cpp index e44f654ab2a..ffa518e0194 100644 --- a/src/gui/qgscolorwidgets.cpp +++ b/src/gui/qgscolorwidgets.cpp @@ -456,10 +456,10 @@ void QgsColorWheel::paintEvent( QPaintEvent *event ) double lightness = mCurrentColor.lightnessF(); double hueRadians = ( h * M_PI / 180.0 ); double hx = std::cos( hueRadians ) * triangleRadius; - double hy = -sin( hueRadians ) * triangleRadius; - double sx = -cos( -hueRadians + ( M_PI / 3.0 ) ) * triangleRadius; - double sy = -sin( -hueRadians + ( M_PI / 3.0 ) ) * triangleRadius; - double vx = -cos( hueRadians + ( M_PI / 3.0 ) ) * triangleRadius; + double hy = -std::sin( hueRadians ) * triangleRadius; + double sx = -std::cos( -hueRadians + ( M_PI / 3.0 ) ) * triangleRadius; + double sy = -std::sin( -hueRadians + ( M_PI / 3.0 ) ) * triangleRadius; + double vx = -std::cos( hueRadians + ( M_PI / 3.0 ) ) * triangleRadius; double vy = std::sin( hueRadians + ( M_PI / 3.0 ) ) * triangleRadius; double mx = ( sx + vx ) / 2.0; double my = ( sy + vy ) / 2.0; @@ -539,31 +539,31 @@ void QgsColorWheel::setColorFromPos( const QPointF pos ) double eventAngleRadians = line.angle() * M_PI / 180.0; double hueRadians = h * M_PI / 180.0; - double rad0 = fmod( eventAngleRadians + 2.0 * M_PI - hueRadians, 2.0 * M_PI ); - double rad1 = fmod( rad0, ( ( 2.0 / 3.0 ) * M_PI ) ) - ( M_PI / 3.0 ); + double rad0 = std::fmod( eventAngleRadians + 2.0 * M_PI - hueRadians, 2.0 * M_PI ); + double rad1 = std::fmod( rad0, ( ( 2.0 / 3.0 ) * M_PI ) ) - ( M_PI / 3.0 ); double length = mWheelImage->width() / 2.0; double triangleLength = length - mWheelThickness - 1; double a = 0.5 * triangleLength; - double b = tan( rad1 ) * a; + double b = std::tan( rad1 ) * a; double r = std::sqrt( x * x + y * y ); double maxR = std::sqrt( a * a + b * b ); if ( r > maxR ) { - double dx = tan( rad1 ) * r; - double rad2 = atan( dx / maxR ); + double dx = std::tan( rad1 ) * r; + double rad2 = std::atan( dx / maxR ); rad2 = qMin( rad2, M_PI / 3.0 ); rad2 = qMax( rad2, -M_PI / 3.0 ); eventAngleRadians += rad2 - rad1; - rad0 = fmod( eventAngleRadians + 2.0 * M_PI - hueRadians, 2.0 * M_PI ); - rad1 = fmod( rad0, ( ( 2.0 / 3.0 ) * M_PI ) ) - ( M_PI / 3.0 ); - b = tan( rad1 ) * a; + rad0 = std::fmod( eventAngleRadians + 2.0 * M_PI - hueRadians, 2.0 * M_PI ); + rad1 = std::fmod( rad0, ( ( 2.0 / 3.0 ) * M_PI ) ) - ( M_PI / 3.0 ); + b = std::tan( rad1 ) * a; r = std::sqrt( a * a + b * b ); } double triangleSideLength = std::sqrt( 3.0 ) * triangleLength; - double newL = ( ( -sin( rad0 ) * r ) / triangleSideLength ) + 0.5; + double newL = ( ( -std::sin( rad0 ) * r ) / triangleSideLength ) + 0.5; double widthShare = 1.0 - ( std::fabs( newL - 0.5 ) * 2.0 ); double newS = ( ( ( std::cos( rad0 ) * r ) + ( triangleLength / 2.0 ) ) / ( 1.5 * triangleLength ) ) / widthShare; s = qMin( static_cast< int >( std::round( qMax( 0.0, newS ) * 255.0 ) ), 255 ); diff --git a/src/plugins/geometry_checker/checks/qgsgeometrycheck.cpp b/src/plugins/geometry_checker/checks/qgsgeometrycheck.cpp index d3fbd2e93ff..dbc503e6190 100644 --- a/src/plugins/geometry_checker/checks/qgsgeometrycheck.cpp +++ b/src/plugins/geometry_checker/checks/qgsgeometrycheck.cpp @@ -48,12 +48,12 @@ int QgsGeometryCheckPrecision::reducedPrecision() double QgsGeometryCheckPrecision::tolerance() { - return pow( 10, -get()->mPrecision ); + return std::pow( 10, -get()->mPrecision ); } double QgsGeometryCheckPrecision::reducedTolerance() { - return pow( 10, -get()->mReducedPrecision ); + return std::pow( 10, -get()->mReducedPrecision ); } QgsGeometryCheckError::QgsGeometryCheckError( const QgsGeometryCheck *check, diff --git a/src/plugins/georeferencer/qgsgeorefplugingui.cpp b/src/plugins/georeferencer/qgsgeorefplugingui.cpp index 0e1c3e3af98..17d6e371132 100644 --- a/src/plugins/georeferencer/qgsgeorefplugingui.cpp +++ b/src/plugins/georeferencer/qgsgeorefplugingui.cpp @@ -805,7 +805,7 @@ void QgsGeorefPluginGui::updateMouseCoordinatePrecision() // to show the difference in position between adjacent pixels. // Also avoid taking the log of 0. if ( mCanvas->mapUnitsPerPixel() != 0.0 ) - dp = static_cast( std::ceil( -1.0 * log10( mCanvas->mapUnitsPerPixel() ) ) ); + dp = static_cast( std::ceil( -1.0 * std::log10( mCanvas->mapUnitsPerPixel() ) ) ); } else dp = QgsProject::instance()->readNumEntry( QStringLiteral( "PositionPrecision" ), QStringLiteral( "/DecimalPlaces" ) ); diff --git a/src/plugins/georeferencer/qgsresidualplotitem.cpp b/src/plugins/georeferencer/qgsresidualplotitem.cpp index df94fef0e3e..72ce3907b6a 100644 --- a/src/plugins/georeferencer/qgsresidualplotitem.cpp +++ b/src/plugins/georeferencer/qgsresidualplotitem.cpp @@ -111,14 +111,14 @@ void QgsResidualPlotItem::paint( QPainter *painter, const QStyleOptionGraphicsIt int nDecPlaces; if ( scaleBarWidthUnits < 1 ) { - nDecPlaces = -floor( log10( scaleBarWidthUnits ) ); + nDecPlaces = -std::floor( std::log10( scaleBarWidthUnits ) ); scaleBarWidthUnits *= std::pow( 10.0, nDecPlaces ); scaleBarWidthUnits = ( int )( scaleBarWidthUnits + 0.5 ); scaleBarWidthUnits /= std::pow( 10.0, nDecPlaces ); } else { - nDecPlaces = ( int )log10( scaleBarWidthUnits ); + nDecPlaces = ( int )std::log10( scaleBarWidthUnits ); scaleBarWidthUnits /= std::pow( 10.0, nDecPlaces ); scaleBarWidthUnits = ( int )( scaleBarWidthUnits + 0.5 ); scaleBarWidthUnits *= std::pow( 10.0, nDecPlaces ); @@ -228,5 +228,5 @@ double QgsResidualPlotItem::dist( QPointF p1, QPointF p2 ) const { double dx = p2.x() - p1.x(); double dy = p2.y() - p1.y(); - return sqrt( dx * dx + dy * dy ); + return std::sqrt( dx * dx + dy * dy ); } diff --git a/src/providers/gdal/qgsgdalprovider.cpp b/src/providers/gdal/qgsgdalprovider.cpp index 236777ecb84..5c906c35818 100644 --- a/src/providers/gdal/qgsgdalprovider.cpp +++ b/src/providers/gdal/qgsgdalprovider.cpp @@ -959,7 +959,7 @@ QString QgsGdalProvider::generateBandName( int bandNumber ) const } if ( !bandNameValues.isEmpty() ) - return tr( "Band" ) + QStringLiteral( " %1 / %2" ) .arg( bandNumber, 1 + ( int ) log10( ( float ) bandCount() ), 10, QChar( '0' ) ).arg( bandNameValues.join( QStringLiteral( " / " ) ) ); + return tr( "Band" ) + QStringLiteral( " %1 / %2" ) .arg( bandNumber, 1 + ( int ) std::log10( ( float ) bandCount() ), 10, QChar( '0' ) ).arg( bandNameValues.join( QStringLiteral( " / " ) ) ); } } } diff --git a/src/providers/wms/qgswmsprovider.cpp b/src/providers/wms/qgswmsprovider.cpp index fac436e8316..094c9ac9190 100644 --- a/src/providers/wms/qgswmsprovider.cpp +++ b/src/providers/wms/qgswmsprovider.cpp @@ -500,7 +500,7 @@ void QgsWmsProvider::setFormatQueryItem( QUrl &url ) static bool _fuzzyContainsRect( const QRectF &r1, const QRectF &r2 ) { - double significantDigits = log10( qMax( r1.width(), r1.height() ) ); + double significantDigits = std::log10( qMax( r1.width(), r1.height() ) ); double epsilon = std::pow( 10.0, significantDigits - 5 ); // floats have 6-9 significant digits return r1.contains( r2.adjusted( epsilon, epsilon, -epsilon, -epsilon ) ); } @@ -1189,8 +1189,8 @@ void QgsWmsProvider::setupXyzCapabilities( const QString &uri ) // the whole world is projected to a square: // X going from 180 W to 180 E // Y going from ~85 N to ~85 S (=atan(sinh(pi)) ... to get a square) - QgsPointXY topLeftLonLat( -180, 180.0 / M_PI * atan( sinh( M_PI ) ) ); - QgsPointXY bottomRightLonLat( 180, 180.0 / M_PI * atan( sinh( -M_PI ) ) ); + QgsPointXY topLeftLonLat( -180, 180.0 / M_PI * std::atan( std::sinh( M_PI ) ) ); + QgsPointXY bottomRightLonLat( 180, 180.0 / M_PI * std::atan( std::sinh( -M_PI ) ) ); QgsPointXY topLeft = ct.transform( topLeftLonLat ); QgsPointXY bottomRight = ct.transform( bottomRightLonLat ); double xspan = ( bottomRight.x() - topLeft.x() ); @@ -4044,7 +4044,7 @@ static QString formatDouble( double x ) { if ( x == 0.0 ) return QStringLiteral( "0" ); - const int numberOfDecimals = qMax( 0, 19 - static_cast( std::ceil( log10( std::fabs( x ) ) ) ) ); + const int numberOfDecimals = qMax( 0, 19 - static_cast( std::ceil( std::log10( std::fabs( x ) ) ) ) ); return qgsDoubleToString( x, numberOfDecimals ); }