mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-18 00:03:05 -04:00
use qRound() fro round() (followup ad437bfdffd)
This commit is contained in:
parent
b3a6172ff7
commit
88bc309c63
@ -51,10 +51,6 @@
|
||||
#include <cmath>
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define round(x) ((x) >= 0 ? floor((x)+0.5) : floor((x)-0.5))
|
||||
#endif
|
||||
|
||||
#define FONT_WORKAROUND_SCALE 10 //scale factor for upscaling fontsize and downscaling painter
|
||||
|
||||
|
||||
@ -808,7 +804,7 @@ bool QgsDecorationGrid::getIntervalFromExtent( double* values, bool useXAxis )
|
||||
int factor = pow( 10, floor( log10( interval ) ) );
|
||||
if ( factor != 0 )
|
||||
{
|
||||
interval2 = round( interval / factor ) * factor;
|
||||
interval2 = qRound( interval / factor ) * factor;
|
||||
QgsDebugMsg( QString( "interval2: %1" ).arg( interval2 ) );
|
||||
if ( interval2 != 0 )
|
||||
interval = interval2;
|
||||
|
@ -43,10 +43,6 @@ email : tim@linfiniti.com
|
||||
#include <cassert>
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define round(x) ((x) >= 0 ? floor((x)+0.5) : floor((x)-0.5))
|
||||
#endif
|
||||
|
||||
const double QgsDecorationNorthArrow::PI = 3.14159265358979323846;
|
||||
// const double QgsNorthArrowPlugin::DEG2RAD = 0.0174532925199433;
|
||||
const double QgsDecorationNorthArrow::TOL = 1e-8;
|
||||
@ -298,7 +294,7 @@ bool QgsDecorationNorthArrow::calculateNorthDirection()
|
||||
}
|
||||
// And set the angle of the north arrow. Perhaps do something
|
||||
// different if goodDirn = false.
|
||||
mRotationInt = static_cast<int>( round( fmod( 360.0 - angle * 180.0 / PI, 360.0 ) ) );
|
||||
mRotationInt = qRound( fmod( 360.0 - angle * 180.0 / PI, 360.0 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -48,11 +48,6 @@ email : sbr00pwb@users.sourceforge.net
|
||||
#include <cmath>
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define round(x) ((x) >= 0 ? floor((x)+0.5) : floor((x)-0.5))
|
||||
#endif
|
||||
|
||||
|
||||
QgsDecorationScaleBar::QgsDecorationScaleBar( QObject* parent )
|
||||
: QgsDecorationItem( parent )
|
||||
{
|
||||
@ -164,7 +159,7 @@ void QgsDecorationScaleBar::render( QPainter * theQPainter )
|
||||
if ( mSnapping )
|
||||
{
|
||||
double scaler = pow( 10.0, myPowerOf10 );
|
||||
myActualSize = round( myActualSize / scaler ) * scaler;
|
||||
myActualSize = qRound( myActualSize / scaler ) * scaler;
|
||||
myScaleBarWidth = myActualSize / myMapUnitsPerPixelDouble;
|
||||
}
|
||||
|
||||
|
@ -214,7 +214,7 @@ int QgsComposition::pixelFontSize( double pointSize ) const
|
||||
{
|
||||
//in QgsComposition, one unit = one mm
|
||||
double sizeMillimeters = pointSize * 0.3527;
|
||||
return ( sizeMillimeters + 0.5 ); //round to nearest mm
|
||||
return qRound( sizeMillimeters ); //round to nearest mm
|
||||
}
|
||||
|
||||
double QgsComposition::pointFontSize( int pixelSize ) const
|
||||
|
@ -64,7 +64,7 @@ QPoint QgsMapTool::toCanvasCoordinates( const QgsPoint& point )
|
||||
{
|
||||
double x = point.x(), y = point.y();
|
||||
mCanvas->getCoordinateTransform()->transformInPlace( x, y );
|
||||
return QPoint(( int )( x + 0.5 ), ( int )( y + 0.5 ) ); // round the values
|
||||
return QPoint( qRound( x ), qRound( y ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -50,10 +50,6 @@
|
||||
//other includes
|
||||
#include <cmath>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define round(x) ((x) >= 0 ? floor((x)+0.5) : floor((x)-0.5))
|
||||
#endif
|
||||
|
||||
QgsQuickPrint::QgsQuickPrint()
|
||||
{
|
||||
mPageSize = QPrinter::A4;
|
||||
@ -813,7 +809,7 @@ void QgsQuickPrint::renderPrintScaleBar( QPainter * thepPainter,
|
||||
if ( mySnappingFlag )
|
||||
{
|
||||
double scaler = pow( 10.0, myPowerOf10 );
|
||||
myActualSize = round( myActualSize / scaler ) * scaler;
|
||||
myActualSize = qRound( myActualSize / scaler ) * scaler;
|
||||
myScaleBarWidth = myActualSize / myMapUnitsPerPixelDouble;
|
||||
}
|
||||
|
||||
|
@ -50,11 +50,6 @@ extern "C"
|
||||
#include <grass/Vect.h>
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define round(x) ((x) >= 0 ? floor((x)+0.5) : floor((x)-0.5))
|
||||
#endif
|
||||
|
||||
|
||||
class QgsGrassEditLayer : public QgsMapCanvasItem
|
||||
{
|
||||
public:
|
||||
@ -1718,8 +1713,7 @@ void QgsGrassEdit::displayElement( int line, const QPen & pen, int size, QPainte
|
||||
point.setX( mPoints->x[i] );
|
||||
point.setY( mPoints->y[i] );
|
||||
point = transformLayerToCanvas( point );
|
||||
pointArray.setPoint( i, static_cast<int>( round( point.x() ) ),
|
||||
static_cast<int>( round( point.y() ) ) );
|
||||
pointArray.setPoint( i, qRound( point.x() ), qRound( point.y() ) );
|
||||
}
|
||||
|
||||
myPainter->setPen( pen );
|
||||
@ -1846,8 +1840,8 @@ void QgsGrassEdit::displayIcon( double x, double y, const QPen & pen,
|
||||
|
||||
point = transformLayerToCanvas( point );
|
||||
|
||||
int px = static_cast<int>( round( point.x() ) );
|
||||
int py = static_cast<int>( round( point.y() ) );
|
||||
int px = qRound( point.x() );
|
||||
int py = qRound( point.y() );
|
||||
int m = ( size - 1 ) / 2;
|
||||
|
||||
QPainter *myPainter;
|
||||
|
Loading…
x
Reference in New Issue
Block a user