Remove redundant math constant defines

Since we use _USE_MATH_DEFINES for windows builds, these are
not required
This commit is contained in:
Nyall Dawson 2017-08-26 03:25:02 +10:00
parent 07a570fd05
commit 7f447374cd
15 changed files with 5 additions and 65 deletions

View File

@ -11,7 +11,6 @@
class QgsSymbolLayer
{

View File

@ -20,10 +20,6 @@
#define NO_DATA -9999
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
QgsKernelDensityEstimation::QgsKernelDensityEstimation( const QgsKernelDensityEstimation::Parameters &parameters, const QString &outputFile, const QString &outputFormat )
: mSource( parameters.source )
, mOutputFile( outputFile )

View File

@ -38,12 +38,6 @@
# define DRW_POSIX
#endif
#ifndef M_PI
#define M_PI 3.141592653589793238462643
#endif
#ifndef M_PI_2
#define M_PI_2 1.57079632679489661923
#endif
#define M_PIx2 6.283185307179586 // 2*PI
#define ARAD 57.29577951308232

View File

@ -152,8 +152,7 @@ void QgsDecorationNorthArrowDialog::drawNorthArrow()
myQPainter.rotate( rotation );
//work out how to shift the image so that it appears in the center of the canvas
//(x cos a + y sin a - x, -x sin a + y cos a - y)
const double PI = 3.14159265358979323846;
double myRadiansDouble = ( PI / 180 ) * rotation;
double myRadiansDouble = ( M_PI / 180 ) * rotation;
int xShift = static_cast<int>( (
( centerXDouble * std::cos( myRadiansDouble ) ) +
( centerYDouble * std::sin( myRadiansDouble ) )

View File

@ -36,8 +36,6 @@
#include <limits>
#include <cmath>
#define PI 3.14159265
QgsAngleMagnetWidget::QgsAngleMagnetWidget( const QString &label, QWidget *parent )
: QWidget( parent )
{
@ -152,7 +150,7 @@ void QgsMapToolRotateFeature::canvasMoveEvent( QgsMapMouseEvent *e )
{
const double XDistance = e->pos().x() - mStPoint.x();
const double YDistance = e->pos().y() - mStPoint.y();
double rotation = std::atan2( YDistance, XDistance ) * ( 180 / PI );
double rotation = std::atan2( YDistance, XDistance ) * ( 180 / M_PI );
if ( mRotationWidget )
{
@ -297,7 +295,7 @@ void QgsMapToolRotateFeature::canvasReleaseEvent( QgsMapMouseEvent *e )
double XDistance = mInitialPos.x() - mAnchorPoint->x();
double YDistance = mInitialPos.y() - mAnchorPoint->y() ;
mRotationOffset = std::atan2( YDistance, XDistance ) * ( 180 / PI );
mRotationOffset = std::atan2( YDistance, XDistance ) * ( 180 / M_PI );
createRotationWidget();
if ( e->modifiers() & Qt::ShiftModifier )
@ -349,7 +347,7 @@ void QgsMapToolRotateFeature::applyRotation( double rotation )
}
//calculations for affine transformation
double angle = -1 * mRotation * ( PI / 180 );
double angle = -1 * mRotation * ( M_PI / 180 );
QgsPointXY anchorPoint = toLayerCoordinates( vlayer, mStartPointMapCoords );
double a = std::cos( angle );
double b = -1 * std::sin( angle );

View File

@ -24,10 +24,6 @@ email : jpalmer at linz dot govt dot nz
#include <cmath>
#include <QMouseEvent>
#ifndef M_PI
#define M_PI 3.1415926535897931159979634685
#endif
const int RADIUS_SEGMENTS = 40;
QgsMapToolSelectRadius::QgsMapToolSelectRadius( QgsMapCanvas *canvas )

View File

@ -373,7 +373,7 @@ QgsVector calcMotion( const QgsPoint &a, const QgsPoint &b, const QgsPoint &c,
// wonderful nasty hack which has survived through JOSM -> id -> QGIS
// to deal with almost-straight segments (angle is closer to 180 than to 90/270).
if ( dotProduct < -0.707106781186547 )
if ( dotProduct < -M_SQRT1_2 )
dotProduct += 1.0;
QgsVector new_v = p + q;

View File

@ -44,10 +44,6 @@
#include <cmath>
#include <cfloat>
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
using namespace pal;
FeaturePart::FeaturePart( QgsLabelFeature *feat, const GEOSGeometry *geom )

View File

@ -38,10 +38,6 @@
#include <cmath>
#include <cfloat>
#ifndef M_PI
#define M_PI 3.1415926535897931159979634685
#endif
using namespace pal;
LabelPosition::LabelPosition( int id, double x1, double y1, double w, double h, double alpha, double cost, FeaturePart *feature, bool isReversed, Quadrant quadrant )

View File

@ -37,18 +37,6 @@
#include "qgslogger.h"
#include <cfloat>
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#ifndef M_PI_2
#define M_PI_2 1.57079632679489661923
#endif
#ifndef M_SQRT2
#define M_SQRT2 1.41421356237309504880
#endif
void pal::Util::sort( void **items, int N, bool ( *greater )( void *l, void *r ) )
{

View File

@ -34,11 +34,6 @@
#include "qgsunittypes.h"
#include "qgsexception.h"
// MSVC compiler doesn't have defined M_PI in math.h
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#define DEG2RAD(x) ((x)*M_PI/180)
#define RAD2DEG(r) (180.0 * (r) / M_PI)
#define POW2(x) ((x)*(x))

View File

@ -24,10 +24,6 @@
#include "qgsproperty.h"
#include <cmath>
#ifndef M_SQRT2
#define M_SQRT2 1.41421356237309504880
#endif
QgsPointClusterRenderer::QgsPointClusterRenderer()
: QgsPointDistanceRenderer( QStringLiteral( "pointCluster" ) )
{

View File

@ -25,10 +25,6 @@
#include <QPainter>
#include <cmath>
#ifndef M_SQRT2
#define M_SQRT2 1.41421356237309504880
#endif
QgsPointDisplacementRenderer::QgsPointDisplacementRenderer( const QString &labelAttributeName )
: QgsPointDistanceRenderer( QStringLiteral( "pointDisplacement" ), labelAttributeName )
, mPlacement( Ring )

View File

@ -27,10 +27,6 @@
#include <cmath>
#ifndef M_SQRT2
#define M_SQRT2 1.41421356237309504880
#endif
QgsPointDistanceRenderer::QgsPointDistanceRenderer( const QString &rendererName, const QString &labelAttributeName )
: QgsFeatureRenderer( rendererName )
, mLabelAttributeName( labelAttributeName )

View File

@ -15,11 +15,6 @@
#ifndef QGSSYMBOLLAYER_H
#define QGSSYMBOLLAYER_H
// MSVC compiler doesn't have defined M_PI in math.h
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#define DEG2RAD(x) ((x)*M_PI/180)
#define DEFAULT_SCALE_METHOD QgsSymbol::ScaleDiameter