mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-15 00:02:52 -04:00
Add more missing std:: prefixes
This commit is contained in:
parent
891d612e95
commit
c19418c447
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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 )
|
||||
|
@ -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?
|
||||
|
@ -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?
|
||||
}
|
||||
|
@ -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 );
|
||||
|
@ -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
|
||||
|
@ -83,6 +83,6 @@ float QgsRuggednessFilter::processNineCellWindow( float *x11, float *x21, float
|
||||
sum += ( *x33 - *x22 ) * ( *x33 - *x22 );
|
||||
}
|
||||
|
||||
return sqrt( sum );
|
||||
return std::sqrt( sum );
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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 )
|
||||
|
@ -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 );
|
||||
|
@ -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 );
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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 )
|
||||
{
|
||||
|
@ -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 );
|
||||
|
@ -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 )
|
||||
|
@ -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 ) );
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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 )
|
||||
{
|
||||
|
@ -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<QgsPoint> QgsEllipse::foci() const
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 )
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 );
|
||||
|
@ -305,7 +305,7 @@ QString QgsRectangle::toString( int precision ) const
|
||||
precision = 0;
|
||||
if ( ( width() < 10 || height() < 10 ) && ( width() > 0 && height() > 0 ) )
|
||||
{
|
||||
precision = static_cast<int>( std::ceil( -1.0 * log10( qMin( width(), height() ) ) ) ) + 1;
|
||||
precision = static_cast<int>( std::ceil( -1.0 * std::log10( qMin( width(), height() ) ) ) ) + 1;
|
||||
// sanity check
|
||||
if ( precision > 20 )
|
||||
precision = 20;
|
||||
|
@ -382,9 +382,9 @@ QVector<double> 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 ) );
|
||||
|
@ -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 )
|
||||
{
|
||||
|
@ -720,7 +720,7 @@ int FeaturePart::createCandidatesAlongLineNearStraightSegments( QList<LabelPosit
|
||||
|
||||
//calculate some cost penalties
|
||||
double segmentCost = 1.0 - ( distanceToEndOfSegment - distanceToStartOfSegment ) / longestSegmentLength; // 0 -> 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 )
|
||||
{
|
||||
|
@ -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 )
|
||||
|
@ -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
|
||||
|
@ -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 ) );
|
||||
|
@ -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.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 ) );
|
||||
|
@ -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<int>( std::ceil( -1.0 * log10( mapUnitsPerPixel ) ) );
|
||||
dp = static_cast<int>( std::ceil( -1.0 * std::log10( mapUnitsPerPixel ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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<QgsPointXY> &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 )
|
||||
|
@ -69,7 +69,7 @@ double QgsHistogram::optimalBinWidth() const
|
||||
|
||||
int QgsHistogram::optimalNumberBins() const
|
||||
{
|
||||
return ceil( ( mMax - mMin ) / optimalBinWidth() );
|
||||
return std::ceil( ( mMax - mMin ) / optimalBinWidth() );
|
||||
}
|
||||
|
||||
QList<double> QgsHistogram::binEdges( int bins ) const
|
||||
|
@ -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 );
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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]
|
||||
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -285,8 +285,8 @@ void QgsColorRampShader::classifyColorRamp( const int classes, const int band, c
|
||||
QVector<QColor>::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<QgsColorRampShader::ColorRampItem> colorRampItems;
|
||||
for ( ; value_it != entryValues.end(); ++value_it, ++color_it )
|
||||
|
@ -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 );
|
||||
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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.
|
||||
|
@ -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() ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
@ -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 ) );
|
||||
|
@ -3932,7 +3932,7 @@ QList<double> 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 ) )
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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 );
|
||||
|
@ -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,
|
||||
|
@ -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<int>( std::ceil( -1.0 * log10( mCanvas->mapUnitsPerPixel() ) ) );
|
||||
dp = static_cast<int>( std::ceil( -1.0 * std::log10( mCanvas->mapUnitsPerPixel() ) ) );
|
||||
}
|
||||
else
|
||||
dp = QgsProject::instance()->readNumEntry( QStringLiteral( "PositionPrecision" ), QStringLiteral( "/DecimalPlaces" ) );
|
||||
|
@ -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 );
|
||||
}
|
||||
|
@ -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( " / " ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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<int>( std::ceil( log10( std::fabs( x ) ) ) ) );
|
||||
const int numberOfDecimals = qMax( 0, 19 - static_cast<int>( std::ceil( std::log10( std::fabs( x ) ) ) ) );
|
||||
return qgsDoubleToString( x, numberOfDecimals );
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user