math.diff
src/app/legend/qgslegend.cpp (working copy) | ||
---|---|---|
1688 | 1688 |
QgsDebugMsg( "Raster units per pixel : " + QString::number( layer->rasterUnitsPerPixel() ) ); |
1689 | 1689 |
QgsDebugMsg( "MapUnitsPerPixel before : " + QString::number( mMapCanvas->mapUnitsPerPixel() ) ); |
1690 | 1690 | |
1691 |
mMapCanvas->zoomByFactor( fabs( layer->rasterUnitsPerPixel() / mMapCanvas->mapUnitsPerPixel() ) );
|
|
1691 |
mMapCanvas->zoomByFactor( qAbs( layer->rasterUnitsPerPixel() / mMapCanvas->mapUnitsPerPixel() ) );
|
|
1692 | 1692 |
mMapCanvas->refresh(); |
1693 | 1693 | |
1694 | 1694 |
QgsDebugMsg( "MapUnitsPerPixel after : " + QString::number( mMapCanvas->mapUnitsPerPixel() ) ); |
src/app/qgsdisplayangle.cpp (working copy) | ||
---|---|---|
15 | 15 | |
16 | 16 |
#include "qgsdisplayangle.h" |
17 | 17 |
#include <QSettings> |
18 | ||
19 |
#ifndef Q_OS_MACX |
|
20 | 18 |
#include <cmath> |
21 |
#else |
|
22 |
#include <math.h> |
|
23 |
#endif |
|
24 | 19 | |
25 | 20 |
QgsDisplayAngle::QgsDisplayAngle( QWidget * parent, Qt::WindowFlags f ): QDialog( parent, f ) |
26 | 21 |
{ |
src/app/qgsmaptoolsimplify.cpp (working copy) | ||
---|---|---|
446 | 446 |
} |
447 | 447 |
else |
448 | 448 |
{ // calculate perpendicular distance to line (pythagorean theorem): |
449 |
dist_to_seg = sqrt( fabs( seg_len * seg_len - proj * proj ) );
|
|
449 |
dist_to_seg = sqrt( qAbs( seg_len * seg_len - proj * proj ) );
|
|
450 | 450 |
} |
451 | 451 |
if ( max_dist < dist_to_seg ) |
452 | 452 |
{ |
src/app/qgsmaptoolnodetool.cpp (working copy) | ||
---|---|---|
21 | 21 |
#include "qgsvectordataprovider.h" |
22 | 22 |
#include "qgstolerance.h" |
23 | 23 |
#include "qgsgeometry.h" |
24 |
#include <math.h>
|
|
24 |
#include <cmath>
|
|
25 | 25 |
#include <QMouseEvent> |
26 | 26 |
#include <QMessageBox> |
27 | 27 |
#include "qgslogger.h" |
src/app/qgslabeldialog.cpp (working copy) | ||
---|---|---|
330 | 330 |
int QgsLabelDialog::itemNoForField( QString theFieldName, QStringList theFieldList ) |
331 | 331 |
{ |
332 | 332 |
//if no matches assume first item in list is blank and return that |
333 |
return std::max( 0, theFieldList.indexOf( theFieldName ) );
|
|
333 |
return qMax( 0, theFieldList.indexOf( theFieldName ) );
|
|
334 | 334 |
} |
335 | 335 | |
336 | 336 |
QgsLabelDialog::~QgsLabelDialog() |
src/app/qgsmaptoolmeasureangle.cpp (working copy) | ||
---|---|---|
22 | 22 |
#include "qgsrubberband.h" |
23 | 23 |
#include <QMouseEvent> |
24 | 24 |
#include <QSettings> |
25 | ||
26 |
#ifndef Q_OS_MACX |
|
27 | 25 |
#include <cmath> |
28 |
#else |
|
29 |
#include <math.h> |
|
30 |
#endif |
|
31 | 26 | |
32 | 27 |
QgsMapToolMeasureAngle::QgsMapToolMeasureAngle( QgsMapCanvas* canvas ): QgsMapTool( canvas ), mRubberBand( 0 ), mResultDisplay( 0 ) |
33 | 28 |
{ |
... | ... | |
57 | 52 |
double azimutOne = distArea->bearing( mAnglePoints.at( 1 ), mAnglePoints.at( 0 ) ); |
58 | 53 |
double azimutTwo = distArea->bearing( mAnglePoints.at( 1 ), point ); |
59 | 54 |
double resultAngle = azimutTwo - azimutOne; |
60 |
QgsDebugMsg( QString::number( fabs( resultAngle ) ) );
|
|
55 |
QgsDebugMsg( QString::number( qAbs( resultAngle ) ) );
|
|
61 | 56 |
QgsDebugMsg( QString::number( M_PI ) ); |
62 |
if ( fabs( resultAngle ) > M_PI )
|
|
57 |
if ( qAbs( resultAngle ) > M_PI )
|
|
63 | 58 |
{ |
64 | 59 |
if ( resultAngle < 0 ) |
65 | 60 |
{ |
src/app/qgsvectorlayerproperties.cpp (working copy) | ||
---|---|---|
141 | 141 |
for ( ; it != overlayPluginList.constEnd(); ++it ) |
142 | 142 |
{ |
143 | 143 |
QgsApplyDialog* d = ( *it )->dialog( lyr ); |
144 |
position = tabWidget->insertTab( tabWidget->count(), qobject_cast<QDialog*>( d ), QgisApp::getThemeIcon( "propertyicons/diagram.png" ), tr( "Overlay"));
|
|
144 |
position = tabWidget->insertTab( tabWidget->count(), qobject_cast<QDialog*>( d ), QgisApp::getThemeIcon( "propertyicons/diagram.png" ), tr( "Overlay" ) );
|
|
145 | 145 |
tabWidget->setCurrentIndex( position ); //ugly, but otherwise the properties dialog is a mess |
146 | 146 |
mOverlayDialogs.push_back( d ); |
147 | 147 |
} |
... | ... | |
172 | 172 |
tblAttributes->setHorizontalHeaderItem( attrEditTypeCol, new QTableWidgetItem( tr( "Edit widget" ) ) ); |
173 | 173 |
tblAttributes->setHorizontalHeaderItem( attrAliasCol, new QTableWidgetItem( tr( "Alias" ) ) ); |
174 | 174 | |
175 |
tblAttributes->horizontalHeader()->setResizeMode(1,QHeaderView::Stretch);
|
|
176 |
tblAttributes->horizontalHeader()->setResizeMode(7,QHeaderView::Stretch);
|
|
175 |
tblAttributes->horizontalHeader()->setResizeMode( 1, QHeaderView::Stretch );
|
|
176 |
tblAttributes->horizontalHeader()->setResizeMode( 7, QHeaderView::Stretch );
|
|
177 | 177 |
tblAttributes->setSelectionBehavior( QAbstractItemView::SelectRows ); |
178 | 178 |
tblAttributes->setSelectionMode( QAbstractItemView::MultiSelection ); |
179 | 179 | |
... | ... | |
805 | 805 | |
806 | 806 |
QString xMin, yMin, xMax, yMax; |
807 | 807 |
double changeoverValue = 99999; // The 'largest' 5 digit number |
808 |
if ( fabs( myExtent.xMinimum() ) > changeoverValue )
|
|
808 |
if ( qAbs( myExtent.xMinimum() ) > changeoverValue )
|
|
809 | 809 |
{ |
810 | 810 |
xMin = QString( "%1" ).arg( myExtent.xMinimum(), 0, 'f', 2 ); |
811 | 811 |
} |
... | ... | |
814 | 814 |
xMin = QString( "%1" ).arg( myExtent.xMinimum() ); |
815 | 815 |
} |
816 | 816 | |
817 |
if ( fabs( myExtent.yMinimum() ) > changeoverValue )
|
|
817 |
if ( qAbs( myExtent.yMinimum() ) > changeoverValue )
|
|
818 | 818 |
{ |
819 | 819 |
yMin = QString( "%1" ).arg( myExtent.yMinimum(), 0, 'f', 2 ); |
820 | 820 |
} |
... | ... | |
823 | 823 |
yMin = QString( "%1" ).arg( myExtent.yMinimum() ); |
824 | 824 |
} |
825 | 825 | |
826 |
if ( fabs( myExtent.xMaximum() ) > changeoverValue )
|
|
826 |
if ( qAbs( myExtent.xMaximum() ) > changeoverValue )
|
|
827 | 827 |
{ |
828 | 828 |
xMax = QString( "%1" ).arg( myExtent.xMaximum(), 0, 'f', 2 ); |
829 | 829 |
} |
... | ... | |
832 | 832 |
xMax = QString( "%1" ).arg( myExtent.xMaximum() ); |
833 | 833 |
} |
834 | 834 | |
835 |
if ( fabs( myExtent.yMaximum() ) > changeoverValue )
|
|
835 |
if ( qAbs( myExtent.yMaximum() ) > changeoverValue )
|
|
836 | 836 |
{ |
837 | 837 |
yMax = QString( "%1" ).arg( myExtent.yMaximum(), 0, 'f', 2 ); |
838 | 838 |
} |
src/app/qgspointrotationitem.cpp (working copy) | ||
---|---|---|
15 | 15 | |
16 | 16 |
#include "qgspointrotationitem.h" |
17 | 17 |
#include <QPainter> |
18 | ||
19 |
#ifndef Q_OS_MACX |
|
20 | 18 |
#include <cmath> |
21 |
#else |
|
22 |
#include <math.h> |
|
23 |
#endif |
|
24 | 19 | |
25 | 20 |
QgsPointRotationItem::QgsPointRotationItem( QgsMapCanvas* canvas ): QgsMapCanvasItem( canvas ), mOrientation( Clockwise ), mRotation( 0.0 ) |
26 | 21 |
{ |
src/plugins/grass/qgsgrassnewmapset.cpp (working copy) | ||
---|---|---|
1111 | 1111 |
double x1 = points[i].x(); |
1112 | 1112 |
double x2 = points[i+1].x(); |
1113 | 1113 | |
1114 |
if ( fabs( x2 - x1 ) > 150 )
|
|
1114 |
if ( qAbs( x2 - x1 ) > 150 )
|
|
1115 | 1115 |
{ |
1116 | 1116 |
if ( x2 < x1 ) |
1117 | 1117 |
{ |
src/plugins/grass/qgsgrassedit.cpp (working copy) | ||
---|---|---|
854 | 854 | |
855 | 855 |
for ( int i = 0; i < nlines; i++ ) |
856 | 856 |
{ |
857 |
int line = abs( mProvider->nodeLine( node, i ) );
|
|
857 |
int line = qAbs( mProvider->nodeLine( node, i ) );
|
|
858 | 858 |
int type = mProvider->readLine( NULL, NULL, line ); |
859 | 859 | |
860 | 860 |
if ( type & GV_LINES ) |
src/plugins/grass/qtermwidget/TerminalDisplay.cpp (working copy) | ||
---|---|---|
743 | 743 |
if ( lines == 0 |
744 | 744 |
|| _image == 0 |
745 | 745 |
|| !region.isValid() |
746 |
|| ( region.top() + abs( lines ) ) >= region.bottom()
|
|
746 |
|| ( region.top() + qAbs( lines ) ) >= region.bottom()
|
|
747 | 747 |
|| this->_lines <= region.height() ) return; |
748 | 748 | |
749 | 749 |
QRect scrollRect; |
750 | 750 | |
751 | 751 |
void* firstCharPos = &_image[ region.top() * this->_columns ]; |
752 |
void* lastCharPos = &_image[( region.top() + abs( lines ) ) * this->_columns ];
|
|
752 |
void* lastCharPos = &_image[( region.top() + qAbs( lines ) ) * this->_columns ];
|
|
753 | 753 | |
754 | 754 |
int top = _topMargin + ( region.top() * _fontHeight ); |
755 |
int linesToMove = region.height() - abs( lines );
|
|
755 |
int linesToMove = region.height() - qAbs( lines );
|
|
756 | 756 |
int bytesToMove = linesToMove * |
757 | 757 |
this->_columns * |
758 | 758 |
sizeof( Character ); |
... | ... | |
789 | 789 | |
790 | 790 |
//set region of the display to scroll, making sure that |
791 | 791 |
//the region aligns correctly to the character grid |
792 |
QPoint topPoint( _leftMargin , top + abs( lines )*_fontHeight );
|
|
792 |
QPoint topPoint( _leftMargin , top + qAbs( lines )*_fontHeight );
|
|
793 | 793 | |
794 | 794 |
scrollRect = QRect( topPoint , |
795 | 795 |
QSize( this->_usedColumns * _fontWidth , |
src/plugins/dxf2shp_converter/dxflib/src/dl_dxf.cpp (working copy) | ||
---|---|---|
1226 | 1226 |
double x = toReal( values[11], 0.0 ); |
1227 | 1227 |
double y = toReal( values[21], 0.0 ); |
1228 | 1228 | |
1229 |
if ( fabs( x ) < 1.0e-6 )
|
|
1229 |
if ( qAbs( x ) < 1.0e-6 )
|
|
1230 | 1230 |
{ |
1231 | 1231 |
if ( y > 0.0 ) |
1232 | 1232 |
{ |
... | ... | |
1821 | 1821 |
double dist = sqrt( pow( x2 - x1, 2 ) + pow( y2 - y1, 2 ) ) / 2.0; |
1822 | 1822 | |
1823 | 1823 |
// alpha can't be 0.0 at this point |
1824 |
radius = fabs( dist / sin( alpha / 2.0 ) );
|
|
1824 |
radius = qAbs( dist / sin( alpha / 2.0 ) );
|
|
1825 | 1825 | |
1826 |
double wu = fabs( pow( radius, 2.0 ) - pow( dist, 2.0 ) );
|
|
1826 |
double wu = qAbs( pow( radius, 2.0 ) - pow( dist, 2.0 ) );
|
|
1827 | 1827 |
double h = sqrt( wu ); |
1828 | 1828 |
double angle = acos(( x2 - x1 ) / dist ); |
1829 | 1829 | |
... | ... | |
1836 | 1836 |
angle -= M_PI / 2.0; |
1837 | 1837 |
} |
1838 | 1838 | |
1839 |
if ( fabs( alpha ) > M_PI )
|
|
1839 |
if ( qAbs( alpha ) > M_PI )
|
|
1840 | 1840 |
{ |
1841 | 1841 |
h *= -1.0; |
1842 | 1842 |
} |
... | ... | |
2470 | 2470 |
{ |
2471 | 2471 |
dw.dxfReal( 10, data.x ); |
2472 | 2472 |
dw.dxfReal( 20, data.y ); |
2473 |
if ( fabs( data.bulge ) > 1.0e-10 )
|
|
2473 |
if ( qAbs( data.bulge ) > 1.0e-10 )
|
|
2474 | 2474 |
{ |
2475 | 2475 |
dw.dxfReal( 42, data.bulge ); |
2476 | 2476 |
} |
... | ... | |
2481 | 2481 |
//dw.entityAttributes(attrib); |
2482 | 2482 |
dw.dxfString( 8, polylineLayer ); |
2483 | 2483 |
dw.coord( VERTEX_COORD_CODE, data.x, data.y ); |
2484 |
if ( fabs( data.bulge ) > 1.0e-10 )
|
|
2484 |
if ( qAbs( data.bulge ) > 1.0e-10 )
|
|
2485 | 2485 |
{ |
2486 | 2486 |
dw.dxfReal( 42, data.bulge ); |
2487 | 2487 |
} |
src/plugins/point_displacement_renderer/qgspointdisplacementrenderer.cpp (working copy) | ||
---|---|---|
25 | 25 |
#include "qgsvectorlayer.h" |
26 | 26 |
#include <QDomElement> |
27 | 27 |
#include <QPainter> |
28 | ||
29 |
#ifndef Q_OS_MACX |
|
30 | 28 |
#include <cmath> |
31 |
#else |
|
32 |
#include <math.h> |
|
33 |
#endif |
|
34 | 29 | |
35 |
QgsPointDisplacementRenderer::QgsPointDisplacementRenderer( const QString& labelAttributeName ): QgsFeatureRendererV2( "pointDisplacement" ), \ |
|
36 |
mLabelAttributeName( labelAttributeName ), mLabelIndex( -1 ), mTolerance( 0.00001 ), mCircleWidth( 0.4 ), mCircleColor( QColor( 125, 125, 125 ) ), mCircleRadiusAddition( 0 ), \ |
|
37 |
mMaxLabelScaleDenominator( -1 ) |
|
30 |
QgsPointDisplacementRenderer::QgsPointDisplacementRenderer( const QString& labelAttributeName ) |
|
31 |
: QgsFeatureRendererV2( "pointDisplacement" ) |
|
32 |
, mLabelAttributeName( labelAttributeName ) |
|
33 |
, mLabelIndex( -1 ) |
|
34 |
, mTolerance( 0.00001 ) |
|
35 |
, mCircleWidth( 0.4 ) |
|
36 |
, mCircleColor( QColor( 125, 125, 125 ) ) |
|
37 |
, mCircleRadiusAddition( 0 ) |
|
38 |
, mMaxLabelScaleDenominator( -1 ) |
|
38 | 39 |
{ |
39 | 40 |
mRenderer = QgsFeatureRendererV2::defaultRenderer( QGis::Point ); |
40 | 41 |
mCenterSymbol = new QgsMarkerSymbolV2(); //the symbol for the center of a displacement group |
... | ... | |
149 | 150 | |
150 | 151 |
QgsSymbolV2RenderContext symbolContext( context, QgsSymbolV2::MM, 1.0, selected ); |
151 | 152 |
double circleAdditionPainterUnits = symbolContext.outputLineWidth( mCircleRadiusAddition ); |
152 |
double radius = std::max(( diagonal / 2 ), labelAttributeList.size() * diagonal / 2 / M_PI ) + circleAdditionPainterUnits;
|
|
153 |
double radius = qMax(( diagonal / 2 ), labelAttributeList.size() * diagonal / 2 / M_PI ) + circleAdditionPainterUnits;
|
|
153 | 154 | |
154 | 155 |
//draw Circle |
155 | 156 |
drawCircle( radius, symbolContext, pt, symbolList.size() ); |
src/plugins/georeferencer/qgsresidualplotitem.cpp (working copy) | ||
---|---|---|
18 | 18 |
#include "qgsgeorefdatapoint.h" |
19 | 19 |
#include <QPainter> |
20 | 20 |
#include <cfloat> |
21 |
#ifndef Q_OS_MACX |
|
22 | 21 |
#include <cmath> |
23 |
#else |
|
24 |
#include <math.h> |
|
25 |
#endif |
|
26 | 22 | |
27 | 23 |
QgsResidualPlotItem::QgsResidualPlotItem( QgsComposition* c ): QgsComposerItem( c ), mConvertScaleToMapUnits( false ) |
28 | 24 |
{ |
src/plugins/georeferencer/qgsimagewarper.cpp (working copy) | ||
---|---|---|
332 | 332 |
int CPL_STDCALL QgsImageWarper::updateWarpProgress( double dfComplete, const char *pszMessage, void *pProgressArg ) |
333 | 333 |
{ |
334 | 334 |
QProgressDialog *progress = static_cast<QProgressDialog*>( pProgressArg ); |
335 |
progress->setValue( std::min( 100u, ( uint )( dfComplete*100.0 ) ) );
|
|
335 |
progress->setValue( qMin( 100u, ( uint )( dfComplete*100.0 ) ) );
|
|
336 | 336 |
qApp->processEvents(); |
337 | 337 |
// TODO: call QEventLoop manually to make "cancel" button more responsive |
338 | 338 |
if ( progress->wasCanceled() ) |
src/plugins/georeferencer/qgsgeorefplugingui.cpp (working copy) | ||
---|---|---|
1878 | 1878 |
case 3: src = QgsPoint( dX, oY + ( double )s*stepY ); break; |
1879 | 1879 |
} |
1880 | 1880 |
t.transform( src, raster, rasterToWorld ); |
1881 |
minX = std::min( raster.x(), minX );
|
|
1882 |
maxX = std::max( raster.x(), maxX );
|
|
1883 |
minY = std::min( raster.y(), minY );
|
|
1884 |
maxY = std::max( raster.y(), maxY );
|
|
1881 |
minX = qMin( raster.x(), minX );
|
|
1882 |
maxX = qMax( raster.x(), maxX );
|
|
1883 |
minY = qMin( raster.y(), minY );
|
|
1884 |
maxY = qMax( raster.y(), maxY );
|
|
1885 | 1885 |
} |
1886 | 1886 |
} |
1887 | 1887 |
return QgsRectangle( minX, minY, maxX, maxY ); |
src/plugins/georeferencer/qgsgeoreftransform.cpp (working copy) | ||
---|---|---|
23 | 23 |
#include "qgsleastsquares.h" |
24 | 24 | |
25 | 25 |
#include <cmath> |
26 |
using std::abs; |
|
27 | 26 |
using std::cos; |
28 | 27 |
using std::sin; |
29 | 28 |
using std::pow; |
... | ... | |
454 | 453 |
else |
455 | 454 |
{ |
456 | 455 |
// Guard against division by zero |
457 |
if ( abs( s ) < std::numeric_limits<double>::epsilon() )
|
|
456 |
if ( qAbs( s ) < std::numeric_limits<double>::epsilon() )
|
|
458 | 457 |
{ |
459 | 458 |
for ( int i = 0; i < nPointCount; ++i ) |
460 | 459 |
{ |
... | ... | |
479 | 478 |
return true; |
480 | 479 |
} |
481 | 480 | |
482 |
QgsGDALGeorefTransform::QgsGDALGeorefTransform( bool useTPS, unsigned int polynomialOrder ) : mPolynomialOrder( std::min( 3u, polynomialOrder ) ), mIsTPSTransform( useTPS )
|
|
481 |
QgsGDALGeorefTransform::QgsGDALGeorefTransform( bool useTPS, unsigned int polynomialOrder ) : mPolynomialOrder( qMin( 3u, polynomialOrder ) ), mIsTPSTransform( useTPS )
|
|
483 | 482 |
{ |
484 | 483 |
mGDALTransformer = NULL; |
485 | 484 |
mGDALTransformerArgs = NULL; |
src/plugins/georeferencer/qgsleastsquares.cpp (working copy) | ||
---|---|---|
245 | 245 | |
246 | 246 |
// GSL does not support a full SVD, so we artificially add a linear dependent row |
247 | 247 |
// to the matrix in case the system is underconstrained. |
248 |
uint m = std::max( 9u, ( uint )mapCoords.size() * 2u );
|
|
248 |
uint m = qMax( 9u, ( uint )mapCoords.size() * 2u );
|
|
249 | 249 |
uint n = 9; |
250 | 250 |
gsl_matrix *S = gsl_matrix_alloc( m, n ); |
251 | 251 |
src/analysis/raster/qgsrastermatrix.cpp (working copy) | ||
---|---|---|
18 | 18 |
#include "qgsrastermatrix.h" |
19 | 19 |
#include <string.h> |
20 | 20 | |
21 |
#ifndef Q_OS_MACX |
|
22 | 21 |
#include <cmath> |
23 |
#else |
|
24 |
#include <math.h> |
|
25 |
#endif |
|
26 | 22 | |
27 | 23 |
QgsRasterMatrix::QgsRasterMatrix(): mColumns( 0 ), mRows( 0 ), mData( 0 ) |
28 | 24 |
{ |
29 | 25 |
} |
30 | 26 | |
31 | 27 |
QgsRasterMatrix::QgsRasterMatrix( int nCols, int nRows, float* data, double nodataValue ): |
32 |
mColumns( nCols ), mRows( nRows ), mData( data ), mNodataValue( nodataValue ) |
|
28 |
mColumns( nCols ), mRows( nRows ), mData( data ), mNodataValue( nodataValue )
|
|
33 | 29 |
{ |
34 | 30 |
} |
35 | 31 | |
... | ... | |
163 | 159 | |
164 | 160 |
bool QgsRasterMatrix::oneArgumentOperation( OneArgOperator op ) |
165 | 161 |
{ |
166 |
if( !mData ) |
|
162 |
if ( !mData )
|
|
167 | 163 |
{ |
168 | 164 |
return false; |
169 | 165 |
} |
170 | 166 | |
171 | 167 |
int nEntries = mColumns * mRows; |
172 | 168 |
double value; |
173 |
for( int i = 0; i < nEntries; ++i ) |
|
169 |
for ( int i = 0; i < nEntries; ++i )
|
|
174 | 170 |
{ |
175 | 171 |
value = mData[i]; |
176 |
if( value != mNodataValue ) |
|
172 |
if ( value != mNodataValue )
|
|
177 | 173 |
{ |
178 |
switch( op ) |
|
174 |
switch ( op )
|
|
179 | 175 |
{ |
180 | 176 |
case opSQRT: |
181 |
if( value < 0 ) //no complex numbers
|
|
177 |
if ( value < 0 ) //no complex numbers
|
|
182 | 178 |
{ |
183 | 179 |
mData[i] = static_cast<float>( mNodataValue ); |
184 | 180 |
} |
... | ... | |
213 | 209 | |
214 | 210 |
bool QgsRasterMatrix::twoArgumentOperation( TwoArgOperator op, const QgsRasterMatrix& other ) |
215 | 211 |
{ |
216 |
if( isNumber() && other.isNumber() ) //operation on two 1x1 matrices
|
|
212 |
if ( isNumber() && other.isNumber() ) //operation on two 1x1 matrices
|
|
217 | 213 |
{ |
218 | 214 |
//operations with nodata values always generate nodata |
219 |
if( mData[0] == mNodataValue || other.number() == other.nodataValue() ) |
|
215 |
if ( mData[0] == mNodataValue || other.number() == other.nodataValue() )
|
|
220 | 216 |
{ |
221 | 217 |
mData[0] = static_cast<float>( mNodataValue ); |
222 | 218 |
return true; |
223 | 219 |
} |
224 |
switch( op ) |
|
220 |
switch ( op )
|
|
225 | 221 |
{ |
226 | 222 |
case opPLUS: |
227 | 223 |
mData[0] = static_cast<float>( number() + other.number() ); |
... | ... | |
233 | 229 |
mData[0] = static_cast<float>( number() * other.number() ); |
234 | 230 |
break; |
235 | 231 |
case opDIV: |
236 |
if( other.number() == 0 ) |
|
232 |
if ( other.number() == 0 )
|
|
237 | 233 |
{ |
238 | 234 |
mData[0] = static_cast<float>( mNodataValue ); |
239 | 235 |
} |
... | ... | |
243 | 239 |
} |
244 | 240 |
break; |
245 | 241 |
case opPOW: |
246 |
if( !testPowerValidity( mData[0], ( float ) other.number() ) ) |
|
242 |
if ( !testPowerValidity( mData[0], ( float ) other.number() ) )
|
|
247 | 243 |
{ |
248 | 244 |
mData[0] = static_cast<float>( mNodataValue ); |
249 | 245 |
} |
... | ... | |
275 | 271 |
} |
276 | 272 | |
277 | 273 |
//two matrices |
278 |
if( !isNumber() && !other.isNumber() ) |
|
274 |
if ( !isNumber() && !other.isNumber() )
|
|
279 | 275 |
{ |
280 | 276 |
float* matrix = other.mData; |
281 | 277 |
int nEntries = mColumns * mRows; |
282 | 278 |
double value1, value2; |
283 | 279 | |
284 |
for( int i = 0; i < nEntries; ++i ) |
|
280 |
for ( int i = 0; i < nEntries; ++i )
|
|
285 | 281 |
{ |
286 | 282 |
value1 = mData[i]; value2 = matrix[i]; |
287 |
if( value1 == mNodataValue || value2 == other.mNodataValue ) |
|
283 |
if ( value1 == mNodataValue || value2 == other.mNodataValue )
|
|
288 | 284 |
{ |
289 | 285 |
mData[i] = static_cast<float>( mNodataValue ); |
290 | 286 |
} |
291 | 287 |
else |
292 | 288 |
{ |
293 |
switch( op ) |
|
289 |
switch ( op )
|
|
294 | 290 |
{ |
295 | 291 |
case opPLUS: |
296 | 292 |
mData[i] = static_cast<float>( value1 + value2 ); |
... | ... | |
302 | 298 |
mData[i] = static_cast<float>( value1 * value2 ); |
303 | 299 |
break; |
304 | 300 |
case opDIV: |
305 |
if( value2 == 0 ) |
|
301 |
if ( value2 == 0 )
|
|
306 | 302 |
{ |
307 | 303 |
mData[i] = static_cast<float>( mNodataValue ); |
308 | 304 |
} |
... | ... | |
312 | 308 |
} |
313 | 309 |
break; |
314 | 310 |
case opPOW: |
315 |
if( !testPowerValidity( value1, value2 ) ) |
|
311 |
if ( !testPowerValidity( value1, value2 ) )
|
|
316 | 312 |
{ |
317 | 313 |
mData[i] = static_cast<float>( mNodataValue ); |
318 | 314 |
} |
... | ... | |
346 | 342 |
} |
347 | 343 | |
348 | 344 |
//this matrix is a single number and the other one a real matrix |
349 |
if( isNumber() ) |
|
345 |
if ( isNumber() )
|
|
350 | 346 |
{ |
351 | 347 |
float* matrix = other.mData; |
352 | 348 |
int nEntries = other.nColumns() * other.nRows(); |
... | ... | |
355 | 351 |
mData = new float[nEntries]; mColumns = other.nColumns(); mRows = other.nRows(); |
356 | 352 |
mNodataValue = other.nodataValue(); |
357 | 353 | |
358 |
if( value == mNodataValue ) |
|
354 |
if ( value == mNodataValue )
|
|
359 | 355 |
{ |
360 |
for( int i = 0; i < nEntries; ++i ) |
|
356 |
for ( int i = 0; i < nEntries; ++i )
|
|
361 | 357 |
{ |
362 | 358 |
mData[i] = static_cast<float>( mNodataValue ); |
363 | 359 |
} |
364 | 360 |
return true; |
365 | 361 |
} |
366 | 362 | |
367 |
for( int i = 0; i < nEntries; ++i ) |
|
363 |
for ( int i = 0; i < nEntries; ++i )
|
|
368 | 364 |
{ |
369 |
if( matrix[i] == other.mNodataValue ) |
|
365 |
if ( matrix[i] == other.mNodataValue )
|
|
370 | 366 |
{ |
371 | 367 |
mData[i] = static_cast<float>( mNodataValue ); |
372 | 368 |
continue; |
373 | 369 |
} |
374 | 370 | |
375 |
switch( op ) |
|
371 |
switch ( op )
|
|
376 | 372 |
{ |
377 | 373 |
case opPLUS: |
378 | 374 |
mData[i] = static_cast<float>( value + matrix[i] ); |
... | ... | |
384 | 380 |
mData[i] = static_cast<float>( value * matrix[i] ); |
385 | 381 |
break; |
386 | 382 |
case opDIV: |
387 |
if( matrix[i] == 0 ) |
|
383 |
if ( matrix[i] == 0 )
|
|
388 | 384 |
{ |
389 | 385 |
mData[i] = static_cast<float>( mNodataValue ); |
390 | 386 |
} |
... | ... | |
394 | 390 |
} |
395 | 391 |
break; |
396 | 392 |
case opPOW: |
397 |
if( !testPowerValidity( value, matrix[i] ) ) |
|
393 |
if ( !testPowerValidity( value, matrix[i] ) )
|
|
398 | 394 |
{ |
399 | 395 |
mData[i] = static_cast<float>( mNodataValue ); |
400 | 396 |
} |
... | ... | |
430 | 426 |
double value = other.number(); |
431 | 427 |
int nEntries = mColumns * mRows; |
432 | 428 | |
433 |
if( other.number() == other.mNodataValue ) |
|
429 |
if ( other.number() == other.mNodataValue )
|
|
434 | 430 |
{ |
435 |
for( int i = 0; i < nEntries; ++i ) |
|
431 |
for ( int i = 0; i < nEntries; ++i )
|
|
436 | 432 |
{ |
437 | 433 |
mData[i] = static_cast<float>( mNodataValue ); |
438 | 434 |
} |
439 | 435 |
return true; |
440 | 436 |
} |
441 | 437 | |
442 |
for( int i = 0; i < nEntries; ++i ) |
|
438 |
for ( int i = 0; i < nEntries; ++i )
|
|
443 | 439 |
{ |
444 |
if( mData[i] == mNodataValue ) |
|
440 |
if ( mData[i] == mNodataValue )
|
|
445 | 441 |
{ |
446 | 442 |
continue; |
447 | 443 |
} |
448 | 444 | |
449 |
switch( op ) |
|
445 |
switch ( op )
|
|
450 | 446 |
{ |
451 | 447 |
case opPLUS: |
452 | 448 |
mData[i] = static_cast<float>( mData[i] + value ); |
... | ... | |
458 | 454 |
mData[i] = static_cast<float>( mData[i] * value ); |
459 | 455 |
break; |
460 | 456 |
case opDIV: |
461 |
if( value == 0 ) |
|
457 |
if ( value == 0 )
|
|
462 | 458 |
{ |
463 | 459 |
mData[i] = static_cast<float>( mNodataValue ); |
464 | 460 |
} |
... | ... | |
468 | 464 |
} |
469 | 465 |
break; |
470 | 466 |
case opPOW: |
471 |
if( !testPowerValidity( mData[i], value ) ) |
|
467 |
if ( !testPowerValidity( mData[i], value ) )
|
|
472 | 468 |
{ |
473 | 469 |
mData[i] = static_cast<float>( mNodataValue ); |
474 | 470 |
} |
... | ... | |
503 | 499 | |
504 | 500 |
bool QgsRasterMatrix::testPowerValidity( double base, double power ) |
505 | 501 |
{ |
506 |
if(( base == 0 && power < 0 ) || ( power < 0 && ( power - floor( power ) ) > 0 ) ) |
|
502 |
if (( base == 0 && power < 0 ) || ( power < 0 && ( power - floor( power ) ) > 0 ) )
|
|
507 | 503 |
{ |
508 | 504 |
return false; |
509 | 505 |
} |
src/analysis/interpolation/DualEdgeTriangulation.cc (working copy) | ||
---|---|---|
383 | 383 |
//Take the higher z-Value in case of two equal points |
384 | 384 |
Point3D* newPoint = mPointVector[mPointVector.count()-1]; |
385 | 385 |
Point3D* existingPoint = mPointVector[mTwiceInsPoint]; |
386 |
existingPoint->setZ( std::max( newPoint->getZ(), existingPoint->getZ() ) );
|
|
386 |
existingPoint->setZ( qMax( newPoint->getZ(), existingPoint->getZ() ) );
|
|
387 | 387 | |
388 | 388 |
mPointVector.remove( mPointVector.count() - 1 ); |
389 | 389 |
delete newPoint; |
src/analysis/interpolation/MathUtils.h (working copy) | ||
---|---|---|
17 | 17 |
#ifndef MATHUTILS_H |
18 | 18 |
#define MATHUTILS_H |
19 | 19 | |
20 |
#ifndef Q_OS_MACX |
|
21 | 20 |
#include <cmath> |
22 |
#else |
|
23 |
#include <math.h> |
|
24 |
#endif |
|
25 | 21 |
#include "Vector3D.h" |
26 | 22 |
#include "Point3D.h" |
27 | 23 |
src/analysis/interpolation/Point3D.h (working copy) | ||
---|---|---|
17 | 17 |
#ifndef POINT3D_H |
18 | 18 |
#define POINT3D_H |
19 | 19 | |
20 |
#ifndef Q_OS_MACX |
|
21 | 20 |
#include <cmath> |
22 |
#else |
|
23 |
#include <math.h> |
|
24 |
#endif |
|
25 | 21 |
#include <iostream> |
26 | 22 | |
27 | 23 |
/**Point3D is a class to represent a three dimensional point*/ |
src/analysis/interpolation/Vector3D.h (working copy) | ||
---|---|---|
17 | 17 |
#ifndef VECTOR3D_H |
18 | 18 |
#define VECTOR3D_H |
19 | 19 | |
20 |
#ifndef Q_OS_MACX |
|
21 | 20 |
#include <cmath> |
22 |
#else |
|
23 |
#include <math.h> |
|
24 |
#endif |
|
25 | 21 | |
26 | 22 |
class ANALYSIS_EXPORT Vector3D |
27 | 23 |
/** |
src/analysis/interpolation/MathUtils.cc (working copy) | ||
---|---|---|
205 | 205 |
double a = normal.getX(); |
206 | 206 |
double b = normal.getY(); |
207 | 207 |
double c = -( normal.getX() * p2->getX() + normal.getY() * p2->getY() ); |
208 |
double distance = fabs(( a * thepoint->getX() + b * thepoint->getY() + c ) / ( sqrt( a * a + b * b ) ) );
|
|
208 |
double distance = qAbs(( a * thepoint->getX() + b * thepoint->getY() + c ) / ( sqrt( a * a + b * b ) ) );
|
|
209 | 209 |
return distance; |
210 | 210 |
} |
211 | 211 |
else |
... | ... | |
479 | 479 |
return 1; |
480 | 480 |
} |
481 | 481 |
double tmp = a; |
482 |
for ( int i = 2; i <= fabs(( double )b ); i++ )
|
|
482 |
for ( int i = 2; i <= qAbs(( double )b ); i++ )
|
|
483 | 483 |
{ |
484 | 484 | |
485 | 485 |
a *= tmp; |
src/analysis/interpolation/CloughTocherInterpolator.cc (working copy) | ||
---|---|---|
16 | 16 | |
17 | 17 |
#include "CloughTocherInterpolator.h" |
18 | 18 |
#include "qgslogger.h" |
19 |
#ifndef Q_OS_MACX |
|
19 | ||
20 | 20 |
#include <cmath> |
21 |
#else |
|
22 |
#include <math.h> |
|
23 |
#endif |
|
24 | 21 | |
25 | 22 |
double CloughTocherInterpolator::calcBernsteinPoly( int n, int i, int j, int k, double u, double v, double w ) |
26 | 23 |
{ |
src/gui/qgsmapcanvas.cpp (working copy) | ||
---|---|---|
717 | 717 |
// Don't want to interfer with mouse events |
718 | 718 | |
719 | 719 |
QgsRectangle currentExtent = mMapRenderer->extent(); |
720 |
double dx = fabs(( currentExtent.xMaximum() - currentExtent.xMinimum() ) / 4 );
|
|
721 |
double dy = fabs(( currentExtent.yMaximum() - currentExtent.yMinimum() ) / 4 );
|
|
720 |
double dx = qAbs(( currentExtent.xMaximum() - currentExtent.xMinimum() ) / 4 );
|
|
721 |
double dy = qAbs(( currentExtent.yMaximum() - currentExtent.yMinimum() ) / 4 );
|
|
722 | 722 | |
723 | 723 |
switch ( e->key() ) |
724 | 724 |
{ |
... | ... | |
1289 | 1289 |
QgsPoint start = getCoordinateTransform()->toMapCoordinates( mCanvasProperties->rubberStartPoint ); |
1290 | 1290 |
QgsPoint end = getCoordinateTransform()->toMapCoordinates( releasePoint ); |
1291 | 1291 | |
1292 |
double dx = fabs( end.x() - start.x() );
|
|
1293 |
double dy = fabs( end.y() - start.y() );
|
|
1292 |
double dx = qAbs( end.x() - start.x() );
|
|
1293 |
double dy = qAbs( end.y() - start.y() );
|
|
1294 | 1294 | |
1295 | 1295 |
// modify the extent |
1296 | 1296 |
QgsRectangle r = mMapRenderer->extent(); |
src/gui/qgsannotationitem.cpp (working copy) | ||
---|---|---|
107 | 107 |
halfSymbolSize = scaledSymbolSize() / 2.0; |
108 | 108 |
} |
109 | 109 | |
110 |
double xMinPos = std::min( -halfSymbolSize, mOffsetFromReferencePoint.x() - mFrameBorderWidth );
|
|
111 |
double xMaxPos = std::max( halfSymbolSize, mOffsetFromReferencePoint.x() + mFrameSize.width() + mFrameBorderWidth );
|
|
112 |
double yMinPos = std::min( -halfSymbolSize, mOffsetFromReferencePoint.y() - mFrameBorderWidth );
|
|
113 |
double yMaxPos = std::max( halfSymbolSize, mOffsetFromReferencePoint.y() + mFrameSize.height() + mFrameBorderWidth );
|
|
110 |
double xMinPos = qMin( -halfSymbolSize, mOffsetFromReferencePoint.x() - mFrameBorderWidth );
|
|
111 |
double xMaxPos = qMax( halfSymbolSize, mOffsetFromReferencePoint.x() + mFrameSize.width() + mFrameBorderWidth );
|
|
112 |
double yMinPos = qMin( -halfSymbolSize, mOffsetFromReferencePoint.y() - mFrameBorderWidth );
|
|
113 |
double yMaxPos = qMax( halfSymbolSize, mOffsetFromReferencePoint.y() + mFrameSize.height() + mFrameBorderWidth );
|
|
114 | 114 |
mBoundingRect = QRectF( xMinPos, yMinPos, xMaxPos - xMinPos, yMaxPos - yMinPos ); |
115 | 115 |
} |
116 | 116 | |
... | ... | |
283 | 283 | |
284 | 284 |
int cursorSensitivity = 7; |
285 | 285 | |
286 |
if ( abs( itemPos.x() ) < cursorSensitivity && abs( itemPos.y() ) < cursorSensitivity ) //move map point if position is close to the origin
|
|
286 |
if ( qAbs( itemPos.x() ) < cursorSensitivity && qAbs( itemPos.y() ) < cursorSensitivity ) //move map point if position is close to the origin
|
|
287 | 287 |
{ |
288 | 288 |
return MoveMapPosition; |
289 | 289 |
} |
290 | 290 | |
291 | 291 |
bool left, right, up, down; |
292 |
left = abs( itemPos.x() - mOffsetFromReferencePoint.x() ) < cursorSensitivity;
|
|
293 |
right = abs( itemPos.x() - ( mOffsetFromReferencePoint.x() + mFrameSize.width() ) ) < cursorSensitivity;
|
|
294 |
up = abs( itemPos.y() - mOffsetFromReferencePoint.y() ) < cursorSensitivity;
|
|
295 |
down = abs( itemPos.y() - ( mOffsetFromReferencePoint.y() + mFrameSize.height() ) ) < cursorSensitivity;
|
|
292 |
left = qAbs( itemPos.x() - mOffsetFromReferencePoint.x() ) < cursorSensitivity;
|
|
293 |
right = qAbs( itemPos.x() - ( mOffsetFromReferencePoint.x() + mFrameSize.width() ) ) < cursorSensitivity;
|
|
294 |
up = qAbs( itemPos.y() - mOffsetFromReferencePoint.y() ) < cursorSensitivity;
|
|
295 |
down = qAbs( itemPos.y() - ( mOffsetFromReferencePoint.y() + mFrameSize.height() ) ) < cursorSensitivity;
|
|
296 | 296 | |
297 | 297 |
if ( left && up ) |
298 | 298 |
{ |
src/core/qgspoint.cpp (working copy) | ||
---|---|---|
136 | 136 | |
137 | 137 |
QString QgsPoint::toDegreesMinutesSeconds( int thePrecision ) const |
138 | 138 |
{ |
139 |
int myDegreesX = int( std::abs( m_x ) );
|
|
139 |
int myDegreesX = int( qAbs( m_x ) );
|
|
140 | 140 |
float myFloatMinutesX = float(( qAbs( m_x ) - myDegreesX ) * 60 ); |
141 | 141 |
int myIntMinutesX = int( myFloatMinutesX ); |
142 | 142 |
float mySecondsX = float( myFloatMinutesX - myIntMinutesX ) * 60; |
143 | 143 | |
144 |
int myDegreesY = int( std::abs( m_y ) );
|
|
144 |
int myDegreesY = int( qAbs( m_y ) );
|
|
145 | 145 |
float myFloatMinutesY = float(( qAbs( m_y ) - myDegreesY ) * 60 ); |
146 | 146 |
int myIntMinutesY = int( myFloatMinutesY ); |
147 | 147 |
float mySecondsY = float( myFloatMinutesY - myIntMinutesY ) * 60; |
... | ... | |
220 | 220 |
{ |
221 | 221 |
//algorithm from 'graphics GEMS', A. Paeth: 'A Fast 2D Point-on-line test' |
222 | 222 |
if ( |
223 |
fabs(( b.y() - a.y() ) *( m_x - a.x() ) - ( m_y - a.y() ) *( b.x() - a.x() ) )
|
|
224 |
>= qMax( fabs( b.x() - a.x() ), fabs( b.y() - a.y() ) )
|
|
223 |
qAbs(( b.y() - a.y() ) *( m_x - a.x() ) - ( m_y - a.y() ) *( b.x() - a.x() ) )
|
|
224 |
>= qMax( qAbs( b.x() - a.x() ), qAbs( b.y() - a.y() ) )
|
|
225 | 225 |
) |
226 | 226 |
{ |
227 | 227 |
return 0; |
src/core/qgsvectorlayer.cpp (working copy) | ||
---|---|---|
668 | 668 | |
669 | 669 |
for ( int i = 0; i < pa.size(); ++i ) |
670 | 670 |
{ |
671 |
largestX = std::max( largestX, pa.point( i ).x() );
|
|
672 |
smallestX = std::min( smallestX, pa.point( i ).x() );
|
|
673 |
largestY = std::max( largestY, pa.point( i ).y() );
|
|
674 |
smallestY = std::min( smallestY, pa.point( i ).y() );
|
|
671 |
largestX = qMax( largestX, pa.point( i ).x() );
|
|
672 |
smallestX = qMin( smallestX, pa.point( i ).x() );
|
|
673 |
largestY = qMax( largestY, pa.point( i ).y() );
|
|
674 |
smallestY = qMin( smallestY, pa.point( i ).y() );
|
|
675 | 675 |
} |
676 | 676 |
QgsDebugMsg( QString( "Largest X coordinate was %1" ).arg( largestX ) ); |
677 | 677 |
QgsDebugMsg( QString( "Smallest X coordinate was %1" ).arg( smallestX ) ); |
src/core/qgsscalecalculator.cpp (working copy) | ||
---|---|---|
17 | 17 |
***************************************************************************/ |
18 | 18 |
/* $Id$ */ |
19 | 19 | |
20 |
#include <assert.h> |
|
21 |
#include <math.h> |
|
20 |
#include <cmath> |
|
22 | 21 |
#include "qgslogger.h" |
23 | 22 |
#include "qgsrectangle.h" |
24 | 23 |
#include "qgsscalecalculator.h" |
... | ... | |
84 | 83 |
delta = calculateGeographicDistance( mapExtent ); |
85 | 84 |
break; |
86 | 85 |
default: |
87 |
assert( "bad map units" );
|
|
86 |
Q_ASSERT( "bad map units" );
|
|
88 | 87 |
break; |
89 | 88 |
} |
90 | 89 |
QgsDebugMsg( "Using conversionFactor of " + QString::number( conversionFactor ) ); |
src/core/raster/qgscolorrampshader.cpp (working copy) | ||
---|---|---|
23 | 23 | |
24 | 24 |
#include "qgscolorrampshader.h" |
25 | 25 | |
26 |
#include <math.h>
|
|
26 |
#include <cmath>
|
|
27 | 27 | |
28 | 28 |
QgsColorRampShader::QgsColorRampShader( double theMinimumValue, double theMaximumValue ) : QgsRasterShaderFunction( theMinimumValue, theMaximumValue ) |
29 | 29 |
{ |
... | ... | |
63 | 63 |
{ |
64 | 64 |
//Start searching from the last index - assumtion is that neighboring pixels tend to be similar values |
65 | 65 |
myColorRampItem = mColorRampItemList.value( mCurrentColorRampItemIndex ); |
66 |
myTinyDiff = fabs( theValue - myColorRampItem.value );
|
|
66 |
myTinyDiff = qAbs( theValue - myColorRampItem.value );
|
|
67 | 67 |
//If the previous entry is less, then search closer to the top of the list (assumes mColorRampItemList is sorted) |
68 | 68 |
if ( mCurrentColorRampItemIndex != 0 && theValue <= mColorRampItemList.at( mCurrentColorRampItemIndex - 1 ).value ) |
69 | 69 |
{ |
... | ... | |
105 | 105 |
{ |
106 | 106 |
//Start searching from the last index - assumtion is that neighboring pixels tend to be similar values |
107 | 107 |
myColorRampItem = mColorRampItemList.value( mCurrentColorRampItemIndex ); |
108 |
myTinyDiff = fabs( theValue - myColorRampItem.value );
|
|
108 |
myTinyDiff = qAbs( theValue - myColorRampItem.value );
|
|
109 | 109 |
if ( theValue == myColorRampItem.value || myTinyDiff <= DOUBLE_DIFF_THRESHOLD ) |
110 | 110 |
{ |
111 | 111 |
*theReturnRedValue = myColorRampItem.color.red(); |
... | ... | |
154 | 154 |
{ |
155 | 155 |
//Start searching from the last index - assumtion is that neighboring pixels tend to be similar values |
156 | 156 |
myColorRampItem = mColorRampItemList.value( mCurrentColorRampItemIndex ); |
157 |
myTinyDiff = fabs( theValue - myColorRampItem.value );
|
|
157 |
myTinyDiff = qAbs( theValue - myColorRampItem.value );
|
|
158 | 158 |
//If the previous entry is less, then search closer to the top of the list (assumes mColorRampItemList is sorted) |
159 | 159 |
if ( mCurrentColorRampItemIndex != 0 && theValue <= mColorRampItemList.at( mCurrentColorRampItemIndex - 1 ).value ) |
160 | 160 |
{ |
src/core/raster/qgsrasterlayer.cpp (working copy) | ||
---|---|---|
819 | 819 |
{ |
820 | 820 |
double myValue = readValue( myData, myDataType, iX + ( iY * myXBlockSize ) ); |
821 | 821 | |
822 |
if ( mValidNoDataValue && ( fabs( myValue - mNoDataValue ) <= TINY_VALUE || myValue != myValue ) )
|
|
822 |
if ( mValidNoDataValue && ( qAbs( myValue - mNoDataValue ) <= TINY_VALUE || myValue != myValue ) )
|
|
823 | 823 |
{ |
824 | 824 |
continue; // NULL |
825 | 825 |
} |
... | ... | |
887 | 887 |
{ |
888 | 888 |
double myValue = readValue( myData, myDataType, iX + ( iY * myXBlockSize ) ); |
889 | 889 | |
890 |
if ( mValidNoDataValue && ( fabs( myValue - mNoDataValue ) <= TINY_VALUE || myValue != myValue ) )
|
|
890 |
if ( mValidNoDataValue && ( qAbs( myValue - mNoDataValue ) <= TINY_VALUE || myValue != myValue ) )
|
|
891 | 891 |
{ |
892 | 892 |
continue; // NULL |
893 | 893 |
} |
... | ... | |
1278 | 1278 |
for ( int myColumn = 0; myColumn < mLastViewPort.drawableAreaXDim; ++myColumn ) |
1279 | 1279 |
{ |
1280 | 1280 |
myValue = readValue( myGdalScanData, myDataType, myRow * mLastViewPort.drawableAreaXDim + myColumn ); |
1281 |
if ( mValidNoDataValue && ( fabs( myValue - mNoDataValue ) <= TINY_VALUE || myValue != myValue ) )
|
|
1281 |
if ( mValidNoDataValue && ( qAbs( myValue - mNoDataValue ) <= TINY_VALUE || myValue != myValue ) )
|
|
1282 | 1282 |
{ |
1283 | 1283 |
continue; |
1284 | 1284 |
} |
... | ... | |
1443 | 1443 |
// calculate raster pixel offsets from origin to clipped rect |
1444 | 1444 |
// we're only interested in positive offsets where the origin of the raster |
1445 | 1445 |
// is northwest of the origin of the view |
1446 |
myRasterViewPort->rectXOffsetFloat = ( theViewExtent.xMinimum() - mLayerExtent.xMinimum() ) / fabs( mGeoTransform[1] );
|
|
1447 |
myRasterViewPort->rectYOffsetFloat = ( mLayerExtent.yMaximum() - theViewExtent.yMaximum() ) / fabs( mGeoTransform[5] );
|
|
1446 |
myRasterViewPort->rectXOffsetFloat = ( theViewExtent.xMinimum() - mLayerExtent.xMinimum() ) / qAbs( mGeoTransform[1] );
|
|
1447 |
myRasterViewPort->rectYOffsetFloat = ( mLayerExtent.yMaximum() - theViewExtent.yMaximum() ) / qAbs( mGeoTransform[5] );
|
|
1448 | 1448 | |
1449 | 1449 |
if ( myRasterViewPort->rectXOffsetFloat < 0 ) |
1450 | 1450 |
{ |
... | ... | |
1512 | 1512 |
myRasterViewPort->topLeftPoint = theQgsMapToPixel.transform( myRasterExtent.xMinimum(), myRasterExtent.yMaximum() ); |
1513 | 1513 |
myRasterViewPort->bottomRightPoint = theQgsMapToPixel.transform( myRasterExtent.xMaximum(), myRasterExtent.yMinimum() ); |
1514 | 1514 | |
1515 |
myRasterViewPort->drawableAreaXDim = static_cast<int>( fabs(( myRasterViewPort->clippedWidth / theQgsMapToPixel.mapUnitsPerPixel() * mGeoTransform[1] ) ) + 0.5 );
|
|
1516 |
myRasterViewPort->drawableAreaYDim = static_cast<int>( fabs(( myRasterViewPort->clippedHeight / theQgsMapToPixel.mapUnitsPerPixel() * mGeoTransform[5] ) ) + 0.5 );
|
|
1515 |
myRasterViewPort->drawableAreaXDim = static_cast<int>( qAbs(( myRasterViewPort->clippedWidth / theQgsMapToPixel.mapUnitsPerPixel() * mGeoTransform[1] ) ) + 0.5 );
|
|
1516 |
myRasterViewPort->drawableAreaYDim = static_cast<int>( qAbs(( myRasterViewPort->clippedHeight / theQgsMapToPixel.mapUnitsPerPixel() * mGeoTransform[5] ) ) + 0.5 );
|
|
1517 | 1517 | |
1518 | 1518 |
//the drawable area can start to get very very large when you get down displaying 2x2 or smaller, this is becasue |
1519 | 1519 |
//theQgsMapToPixel.mapUnitsPerPixel() is less then 1, |
... | ... | |
1573 | 1573 | |
1574 | 1574 |
//fetch image in several parts if it is too memory consuming |
1575 | 1575 |
//also some WMS servers have a pixel limit, so it's better to make several requests |
1576 |
int totalPixelWidth = fabs(( myRasterViewPort->clippedXMax - myRasterViewPort->clippedXMin )
|
|
1576 |
int totalPixelWidth = qAbs(( myRasterViewPort->clippedXMax - myRasterViewPort->clippedXMin )
|
|
1577 | 1577 |
/ theQgsMapToPixel.mapUnitsPerPixel() * mGeoTransform[1] ) + 1; |
1578 |
int totalPixelHeight = fabs(( myRasterViewPort->clippedYMax - myRasterViewPort->clippedYMin )
|
|
1578 |
int totalPixelHeight = qAbs(( myRasterViewPort->clippedYMax - myRasterViewPort->clippedYMin )
|
|
1579 | 1579 |
/ theQgsMapToPixel.mapUnitsPerPixel() * mGeoTransform[5] ) + 1; |
1580 | 1580 |
int numParts = totalPixelWidth * totalPixelHeight / 5000000 + 1.0; |
1581 | 1581 |
int numRowsPerPart = totalPixelHeight / numParts + 1.0; |
... | ... | |
1962 | 1962 |
#endif |
1963 | 1963 |
QString v; |
1964 | 1964 | |
1965 |
if ( mValidNoDataValue && ( fabs( value - mNoDataValue ) <= TINY_VALUE || value != value ) )
|
|
1965 |
if ( mValidNoDataValue && ( qAbs( value - mNoDataValue ) <= TINY_VALUE || value != value ) )
|
|
1966 | 1966 |
{ |
1967 | 1967 |
v = tr( "null (no data)" ); |
1968 | 1968 |
} |
... | ... | |
3063 | 3063 |
// We can only use one of the mGeoTransform[], so go with the |
3064 | 3064 |
// horisontal one. |
3065 | 3065 | |
3066 |
return fabs( mGeoTransform[1] );
|
|
3066 |
return qAbs( mGeoTransform[1] );
|
|
3067 | 3067 |
} |
3068 | 3068 | |
3069 | 3069 |
/** |
... | ... | |
4516 | 4516 | |
4517 | 4517 |
if ( mValidNoDataValue && |
4518 | 4518 |
( |
4519 |
( fabs( myRedValue - mNoDataValue ) <= TINY_VALUE || myRedValue != myRedValue ) ||
|
|
4520 |
( fabs( myGreenValue - mNoDataValue ) <= TINY_VALUE || myGreenValue != myGreenValue ) ||
|
|
4521 |
( fabs( myBlueValue - mNoDataValue ) <= TINY_VALUE || myBlueValue != myBlueValue )
|
|
4519 |
( qAbs( myRedValue - mNoDataValue ) <= TINY_VALUE || myRedValue != myRedValue ) ||
|
|
4520 |
( qAbs( myGreenValue - mNoDataValue ) <= TINY_VALUE || myGreenValue != myGreenValue ) ||
|
|
4521 |
( qAbs( myBlueValue - mNoDataValue ) <= TINY_VALUE || myBlueValue != myBlueValue )
|
|
4522 | 4522 |
) |
4523 | 4523 |
) |
4524 | 4524 |
{ |
... | ... | |
4618 | 4618 |
myBlueValue = 0; |
4619 | 4619 |
myPixelValue = readValue( rasterScanLine, ( GDALDataType )myDataType, i ); |
4620 | 4620 | |
4621 |
if ( mValidNoDataValue && ( fabs( myPixelValue - mNoDataValue ) <= TINY_VALUE || myPixelValue != myPixelValue ) )
|
|
4621 |
if ( mValidNoDataValue && ( qAbs( myPixelValue - mNoDataValue ) <= TINY_VALUE || myPixelValue != myPixelValue ) )
|
|
4622 | 4622 |
{ |
4623 | 4623 |
imageScanLine[ i ] = myDefaultColor; |
4624 | 4624 |
continue; |
... | ... | |
4698 | 4698 |
myBlueValue = 0; |
4699 | 4699 |
myPixelValue = readValue( rasterScanLine, ( GDALDataType )myDataType, i ); |
4700 | 4700 | |
4701 |
if ( mValidNoDataValue && ( fabs( myPixelValue - mNoDataValue ) <= TINY_VALUE || myPixelValue != myPixelValue ) )
|
|
4701 |
if ( mValidNoDataValue && ( qAbs( myPixelValue - mNoDataValue ) <= TINY_VALUE || myPixelValue != myPixelValue ) )
|
|
4702 | 4702 |
{ |
4703 | 4703 |
imageScanLine[ i ] = myDefaultColor; |
4704 | 4704 |
continue; |
... | ... | |
4795 | 4795 |
myBlueValue = 0; |
4796 | 4796 |
myPixelValue = readValue( rasterScanLine, ( GDALDataType )myDataType, i ); |
4797 | 4797 | |
4798 |
if ( mValidNoDataValue && ( fabs( myPixelValue - mNoDataValue ) <= TINY_VALUE || myPixelValue != myPixelValue ) )
|
|
4798 |
if ( mValidNoDataValue && ( qAbs( myPixelValue - mNoDataValue ) <= TINY_VALUE || myPixelValue != myPixelValue ) )
|
|
4799 | 4799 |
{ |
4800 | 4800 |
imageScanLine[ i ] = myDefaultColor; |
4801 | 4801 |
continue; |
... | ... | |
4891 | 4891 |
{ |
4892 | 4892 |
myGrayValue = readValue( rasterScanLine, ( GDALDataType )myDataType, i ); |
4893 | 4893 | |
4894 |
if ( mValidNoDataValue && ( fabs( myGrayValue - mNoDataValue ) <= TINY_VALUE || myGrayValue != myGrayValue ) )
|
|
4894 |
if ( mValidNoDataValue && ( qAbs( myGrayValue - mNoDataValue ) <= TINY_VALUE || myGrayValue != myGrayValue ) )
|
|
4895 | 4895 |
{ |
4896 | 4896 |
imageScanLine[ i ] = myDefaultColor; |
4897 | 4897 |
continue; |
... | ... | |
4981 | 4981 |
{ |
4982 | 4982 |
myPixelValue = readValue( rasterScanLine, myDataType, i ); |
4983 | 4983 | |
4984 |
if ( mValidNoDataValue && ( fabs( myPixelValue - mNoDataValue ) <= TINY_VALUE || myPixelValue != myPixelValue ) )
|
|
4984 |
if ( mValidNoDataValue && ( qAbs( myPixelValue - mNoDataValue ) <= TINY_VALUE || myPixelValue != myPixelValue ) )
|
|
4985 | 4985 |
{ |
4986 | 4986 |
imageScanLine[ i ] = myDefaultColor; |
4987 | 4987 |
continue; |
... | ... | |
5081 | 5081 |
( theRasterViewPort->rectXOffsetFloat - |
5082 | 5082 |
theRasterViewPort->rectXOffset ) |
5083 | 5083 |
/ theQgsMapToPixel->mapUnitsPerPixel() |
5084 |
* fabs( mGeoTransform[1] )
|
|
5084 |
* qAbs( mGeoTransform[1] )
|
|
5085 | 5085 |
); |
5086 | 5086 | |
5087 | 5087 |
paintYoffset = static_cast<int>( |
5088 | 5088 |
( theRasterViewPort->rectYOffsetFloat - |
5089 | 5089 |
theRasterViewPort->rectYOffset ) |
5090 | 5090 |
/ theQgsMapToPixel->mapUnitsPerPixel() |
5091 |
* fabs( mGeoTransform[5] )
|
|
5091 |
* qAbs( mGeoTransform[5] )
|
|
5092 | 5092 |
); |
5093 | 5093 |
} |
5094 | 5094 | |
... | ... | |
5121 | 5121 |
int myPixelBoundaryY = 0; |
5122 | 5122 |
if ( theQgsMapToPixel ) |
5123 | 5123 |
{ |
5124 |
myPixelBoundaryX = static_cast<int>( theRasterViewPort->topLeftPoint.x() + 0.5 ) + static_cast<int>( fabs( mGeoTransform[1] / theQgsMapToPixel->mapUnitsPerPixel() ) ) - paintXoffset;
|
|
5125 |
myPixelBoundaryY = static_cast<int>( theRasterViewPort->topLeftPoint.y() + 0.5 ) + static_cast<int>( fabs( mGeoTransform[5] / theQgsMapToPixel->mapUnitsPerPixel() ) ) - paintYoffset;
|
|
5124 |
myPixelBoundaryX = static_cast<int>( theRasterViewPort->topLeftPoint.x() + 0.5 ) + static_cast<int>( qAbs( mGeoTransform[1] / theQgsMapToPixel->mapUnitsPerPixel() ) ) - paintXoffset;
|
|
5125 |
myPixelBoundaryY = static_cast<int>( theRasterViewPort->topLeftPoint.y() + 0.5 ) + static_cast<int>( qAbs( mGeoTransform[5] / theQgsMapToPixel->mapUnitsPerPixel() ) ) - paintYoffset;
|
|
5126 | 5126 |
} |
5127 | 5127 | |
5128 | 5128 |
//INSTANCE: 1x2 |
... | ... | |
5762 | 5762 |
( mViewPort->rectXOffsetFloat - |
5763 | 5763 |
mViewPort->rectXOffset ) |
5764 | 5764 |
/ mMapToPixel->mapUnitsPerPixel() |
5765 |
* fabs( mGeoTransform[1] )
|
|
5765 |
* qAbs( mGeoTransform[1] )
|
|
5766 | 5766 |
); |
5767 | 5767 | |
5768 | 5768 |
paintYoffset = static_cast<int>( |
5769 | 5769 |
( mViewPort->rectYOffsetFloat - |
5770 | 5770 |
mViewPort->rectYOffset ) |
5771 | 5771 |
/ mMapToPixel->mapUnitsPerPixel() |
5772 |
* fabs( mGeoTransform[5] )
|
|
5772 |
* qAbs( mGeoTransform[5] )
|
|
5773 | 5773 |
); |
5774 | 5774 | |
5775 | 5775 |
imageX = static_cast<int>( mViewPort->topLeftPoint.x() + 0.5 ); |
5776 |
imageY = static_cast<int>( mViewPort->topLeftPoint.y() + 0.5 + fabs( mGeoTransform[5] ) * mCurrentPartRasterMin / mMapToPixel->mapUnitsPerPixel() );
|
|
5776 |
imageY = static_cast<int>( mViewPort->topLeftPoint.y() + 0.5 + qAbs( mGeoTransform[5] ) * mCurrentPartRasterMin / mMapToPixel->mapUnitsPerPixel() );
|
|
5777 | 5777 |
} |
5778 | 5778 | |
5779 | 5779 |
mPainter->drawImage( imageX, |
... | ... | |
5812 | 5812 |
int overlapRows = 0; |
5813 | 5813 |
if ( mMapToPixel ) |
5814 | 5814 |
{ |
5815 |
overlapRows = mMapToPixel->mapUnitsPerPixel() / fabs( mGeoTransform[5] ) + 2;
|
|
5815 |
overlapRows = mMapToPixel->mapUnitsPerPixel() / qAbs( mGeoTransform[5] ) + 2;
|
|
5816 | 5816 |
} |
5817 | 5817 |
if ( mCurrentPartRasterMax + overlapRows >= mViewPort->clippedHeight ) |
5818 | 5818 |
{ |
... | ... | |
5829 | 5829 |
{ |
5830 | 5830 |
if ( mMapToPixel ) |
5831 | 5831 |
{ |
5832 |
ySize = fabs((( rasterYSize ) / mMapToPixel->mapUnitsPerPixel() * mGeoTransform[5] ) ) + 0.5;
|
|
5832 |
ySize = qAbs((( rasterYSize ) / mMapToPixel->mapUnitsPerPixel() * mGeoTransform[5] ) ) + 0.5;
|
|
5833 | 5833 |
} |
5834 | 5834 |
} |
5835 | 5835 |
if ( ySize < 1 || xSize < 1 ) |
... | ... | |
5875 | 5875 |
( mViewPort->rectXOffsetFloat - |
5876 | 5876 |
mViewPort->rectXOffset ) |
5877 | 5877 |
/ mMapToPixel->mapUnitsPerPixel() |
5878 |
* fabs( mGeoTransform[1] )
|
|
5878 |
* qAbs( mGeoTransform[1] )
|
|
5879 | 5879 |
); |
5880 | 5880 | |
5881 | 5881 |
paintYoffset = static_cast<int>( |
5882 | 5882 |
( mViewPort->rectYOffsetFloat - |
5883 | 5883 |
mViewPort->rectYOffset ) |
5884 | 5884 |
/ mMapToPixel->mapUnitsPerPixel() |
5885 |
* fabs( mGeoTransform[5] )
|
|
5885 |
* qAbs( mGeoTransform[5] )
|
|
5886 | 5886 |
); |
5887 | 5887 |
} |
5888 | 5888 | |
... | ... | |
5906 | 5906 |
int myPixelBoundaryY = 0; |
5907 | 5907 |
if ( mMapToPixel ) |
5908 | 5908 |
{ |
5909 |
myPixelBoundaryX = static_cast<int>( mViewPort->topLeftPoint.x() + 0.5 ) + static_cast<int>( fabs( mGeoTransform[1] / mMapToPixel->mapUnitsPerPixel() ) ) - paintXoffset;
|
|
5910 |
myPixelBoundaryY = static_cast<int>( mViewPort->topLeftPoint.y() + 0.5 ) + static_cast<int>( fabs( mGeoTransform[5] / mMapToPixel->mapUnitsPerPixel() ) ) - paintYoffset;
|
|
5909 |
myPixelBoundaryX = static_cast<int>( mViewPort->topLeftPoint.x() + 0.5 ) + static_cast<int>( qAbs( mGeoTransform[1] / mMapToPixel->mapUnitsPerPixel() ) ) - paintXoffset;
|
|
5910 |
myPixelBoundaryY = static_cast<int>( mViewPort->topLeftPoint.y() + 0.5 ) + static_cast<int>( qAbs( mGeoTransform[5] / mMapToPixel->mapUnitsPerPixel() ) ) - paintYoffset;
|
|
5911 | 5911 |
} |
5912 | 5912 | |
5913 | 5913 |
//INSTANCE: 1x2 |
src/core/qgsrectangle.cpp (working copy) | ||
---|---|---|
213 | 213 |
int precision = 0; |
214 | 214 |
if (( width() < 1 || height() < 1 ) && ( width() > 0 && height() > 0 ) ) |
215 | 215 |
{ |
216 |
precision = static_cast<int>( ceil( -1.0 * log10( std::min( width(), height() ) ) ) ) + 1;
|
|
216 |
precision = static_cast<int>( ceil( -1.0 * log10( qMin( width(), height() ) ) ) ) + 1;
|
|
217 | 217 |
// sanity check |
218 | 218 |
if ( precision > 20 ) |
219 | 219 |
precision = 20; |
src/core/renderer/qgsuniquevaluerenderer.cpp (working copy) | ||
---|---|---|
24 | 24 |
#include "qgssymbol.h" |
25 | 25 |
#include "qgssymbologyutils.h" |
26 | 26 |
#include "qgslogger.h" |
27 |
#include <math.h>
|
|
27 |
#include <cmath>
|
|
28 | 28 |
#include <QDomNode> |
29 | 29 |
#include <QPainter> |
30 | 30 |
#include <QImage> |
... | ... | |
123 | 123 |
{ |
124 | 124 |
//first find out the value for the scale classification attribute |
125 | 125 |
const QgsAttributeMap& attrs = f.attributeMap(); |
126 |
fieldScale = sqrt( fabs( attrs[symbol->scaleClassificationField()].toDouble() ) );
|
|
126 |
fieldScale = sqrt( qAbs( attrs[symbol->scaleClassificationField()].toDouble() ) );
|
|
127 | 127 |
} |
128 | 128 |
if ( symbol->rotationClassificationField() >= 0 ) |
129 | 129 |
{ |
src/core/renderer/qgsgraduatedsymbolrenderer.cpp (working copy) | ||
---|---|---|
25 | 25 |
#include "qgsvectordataprovider.h" |
26 | 26 |
#include "qgsvectorlayer.h" |
27 | 27 |
#include "qgsrendercontext.h" |
28 |
#include <math.h>
|
|
28 |
#include <cmath>
|
|
29 | 29 |
#include <QDomNode> |
30 | 30 |
#include <QDomElement> |
31 | 31 |
#include <QImage> |
... | ... | |
145 | 145 |
{ |
146 | 146 |
//first find out the value for the scale classification attribute |
147 | 147 |
const QgsAttributeMap& attrs = f.attributeMap(); |
148 |
fieldScale = sqrt( fabs( attrs[theSymbol->scaleClassificationField()].toDouble() ) );
|
|
148 |
fieldScale = sqrt( qAbs( attrs[theSymbol->scaleClassificationField()].toDouble() ) );
|
|
149 | 149 |
QgsDebugMsgLevel( QString( "Feature has field scale factor %1" ).arg( fieldScale ), 3 ); |
150 | 150 |
} |
151 | 151 |
if ( theSymbol->rotationClassificationField() >= 0 ) |
src/core/renderer/qgssinglesymbolrenderer.cpp (working copy) | ||
---|---|---|
30 | 30 |
#include <QImage> |
31 | 31 |
#include <QPainter> |
32 | 32 |
#include <QString> |
33 |
#include <math.h>
|
|
33 |
#include <cmath>
|
|
34 | 34 | |
35 | 35 |
QgsSingleSymbolRenderer::QgsSingleSymbolRenderer( QGis::GeometryType type ) |
36 | 36 |
{ |
... | ... | |
141 | 141 |
{ |
142 | 142 |
//first find out the value for the scale classification attribute |
143 | 143 |
const QgsAttributeMap& attrs = f.attributeMap(); |
144 |
fieldScale = sqrt( fabs( attrs[ mSymbol0->scaleClassificationField()].toDouble() ) );
|
|
144 |
fieldScale = sqrt( qAbs( attrs[ mSymbol0->scaleClassificationField()].toDouble() ) );
|
|
145 | 145 |
QgsDebugMsgLevel( QString( "Feature has field scale factor %1" ).arg( fieldScale ), 3 ); |
146 | 146 |
} |
147 | 147 |
if ( mSymbol0->rotationClassificationField() >= 0 ) |
src/core/qgspallabeling.cpp (working copy) | ||
---|---|---|
402 | 402 |
} |
403 | 403 |
QgsPoint ptSize = xform->toMapCoordinates( w, h ); |
404 | 404 | |
405 |
labelX = fabs( ptSize.x() - ptZero.x() );
|
|
406 |
labelY = fabs( ptSize.y() - ptZero.y() );
|
|
405 |
labelX = qAbs( ptSize.x() - ptZero.x() );
|
|
406 |
labelY = qAbs( ptSize.y() - ptZero.y() );
|
|
407 | 407 |
} |
408 | 408 | |
409 | 409 | |
... | ... | |
570 | 570 | |
571 | 571 |
if ( distance != 0 ) |
572 | 572 |
{ |
573 |
feat->setDistLabel( fabs( ptOne.x() - ptZero.x() )* distance * vectorScaleFactor );
|
|
573 |
feat->setDistLabel( qAbs( ptOne.x() - ptZero.x() )* distance * vectorScaleFactor );
|
|
574 | 574 |
} |
575 | 575 | |
576 | 576 |
//add parameters for data defined labeling to QgsPalGeometry |
src/core/qgsdistancearea.cpp (working copy) | ||
---|---|---|
494 | 494 |
double tu2 = 0; |
495 | 495 | |
496 | 496 |
int iterLimit = 20; |
497 |
while ( fabs( lambda - lambdaP ) > 1e-12 && --iterLimit > 0 )
|
|
497 |
while ( qAbs( lambda - lambdaP ) > 1e-12 && --iterLimit > 0 )
|
|
498 | 498 |
{ |
499 | 499 |
sinLambda = sin( lambda ); |
500 | 500 |
cosLambda = cos( lambda ); |
... | ... | |
665 | 665 |
} |
666 | 666 |
// QgsDebugMsg("Area from point: " + (points[i % size]).toString(2)); |
667 | 667 |
area = area / 2.0; |
668 |
return fabs( area ); // All areas are positive!
|
|
668 |
return qAbs( area ); // All areas are positive!
|
|
669 | 669 |
} |
670 | 670 | |
671 | 671 |
QString QgsDistanceArea::textUnit( double value, int decimals, QGis::UnitType u, bool isArea, bool keepBaseUnit ) |
... | ... | |
682 | 682 |
{ |
683 | 683 |
unitLabel = QObject::tr( " m2" ); |
684 | 684 |
} |
685 |
else if ( fabs( value ) > 1000000.0 )
|
|
685 |
else if ( qAbs( value ) > 1000000.0 )
|
|
686 | 686 |
{ |
687 | 687 |
unitLabel = QObject::tr( " km2" ); |
688 | 688 |
value = value / 1000000.0; |
689 | 689 |
} |
690 |
else if ( fabs( value ) > 10000.0 )
|
|
690 |
else if ( qAbs( value ) > 10000.0 )
|
|
691 | 691 |
{ |
692 | 692 |
unitLabel = QObject::tr( " ha" ); |
693 | 693 |
value = value / 10000.0; |
... | ... | |
699 | 699 |
} |
700 | 700 |
else |
701 | 701 |
{ |
702 |
if ( keepBaseUnit || fabs( value ) == 0.0 )
|
|
702 |
if ( keepBaseUnit || qAbs( value ) == 0.0 )
|
|
703 | 703 |
{ |
704 | 704 |
unitLabel = QObject::tr( " m" ); |
705 | 705 |
} |
706 |
else if ( fabs( value ) > 1000.0 )
|
|
706 |
else if ( qAbs( value ) > 1000.0 )
|
|
707 | 707 |
{ |
708 | 708 |
unitLabel = QObject::tr( " km" ); |
709 | 709 |
value = value / 1000; |
710 | 710 |
} |
711 |
else if ( fabs( value ) < 0.01 )
|
|
711 |
else if ( qAbs( value ) < 0.01 )
|
|
712 | 712 |
{ |
713 | 713 |
unitLabel = QObject::tr( " mm" ); |
714 | 714 |
value = value * 1000; |
715 | 715 |
} |
716 |
else if ( fabs( value ) < 0.1 )
|
|
716 |
else if ( qAbs( value ) < 0.1 )
|
|
717 | 717 |
{ |
718 | 718 |
unitLabel = QObject::tr( " cm" ); |
719 | 719 |
value = value * 100; |
... | ... | |
727 | 727 |
case QGis::Feet: |
728 | 728 |
if ( isArea ) |
729 | 729 |
{ |
730 |
if ( keepBaseUnit || fabs( value ) <= ( 528.0*528.0 ) )
|
|
730 |
if ( keepBaseUnit || qAbs( value ) <= ( 528.0*528.0 ) )
|
|
731 | 731 |
{ |
732 | 732 |
unitLabel = QObject::tr( " sq ft" ); |
733 | 733 |
} |
... | ... | |
739 | 739 |
} |
740 | 740 |
else |
741 | 741 |
{ |
742 |
if ( fabs( value ) <= 528.0 || keepBaseUnit )
|
|
742 |
if ( qAbs( value ) <= 528.0 || keepBaseUnit )
|
|
743 | 743 |
{ |
744 |
if ( fabs( value ) == 1.0 )
|
|
744 |
if ( qAbs( value ) == 1.0 )
|
|
745 | 745 |
{ |
746 | 746 |
unitLabel = QObject::tr( " foot" ); |
747 | 747 |
} |
... | ... | |
764 | 764 |
} |
765 | 765 |
else |
766 | 766 |
{ |
767 |
if ( fabs( value ) == 1.0 )
|
|
767 |
if ( qAbs( value ) == 1.0 )
|
|
768 | 768 |
unitLabel = QObject::tr( " degree" ); |
769 | 769 |
else |
770 | 770 |
unitLabel = QObject::tr( " degrees" ); |
src/core/qgssearchtreenode.cpp (working copy) | ||
---|---|---|
28 | 28 |
#include <QSettings> |
29 | 29 |
#include <iostream> |
30 | 30 | |
31 |
#ifndef Q_OS_MACX |
|
32 | 31 |
#include <cmath> |
33 |
#else |
|
34 |
#include <math.h> |
|
35 |
#endif |
|
36 | 32 | |
37 | ||
38 | ||
39 | 33 |
#define EVAL_STR(x) (x.length() ? x : "(empty)") |
40 | 34 | |
41 | 35 |
QgsSearchTreeNode::QgsSearchTreeNode( QgsSearchTreeNode::Type t ) |
src/core/qgsmaprenderer.cpp (working copy) | ||
---|---|---|
104 | 104 |
{ |
105 | 105 |
// Use abs() on the extent to avoid the case where the extent is |
106 | 106 |
// symmetrical about 0. |
107 |
double xMean = ( fabs( extent.xMinimum() ) + fabs( extent.xMaximum() ) ) * 0.5;
|
|
108 |
double yMean = ( fabs( extent.yMinimum() ) + fabs( extent.yMaximum() ) ) * 0.5;
|
|
107 |
double xMean = ( qAbs( extent.xMinimum() ) + qAbs( extent.xMaximum() ) ) * 0.5;
|
|
108 |
double yMean = ( qAbs( extent.yMinimum() ) + qAbs( extent.yMaximum() ) ) * 0.5;
|
|
109 | 109 | |
110 | 110 |
double xRange = extent.width() / xMean; |
111 | 111 |
double yRange = extent.height() / yMean; |
... | ... | |
388 | 388 |
QgsMapToPixel rasterMapToPixel; |
389 | 389 |
QgsMapToPixel bk_mapToPixel; |
390 | 390 | |
391 |
if ( ml->type() == QgsMapLayer::RasterLayer && fabs( rasterScaleFactor - 1.0 ) > 0.000001 )
|
|
391 |
if ( ml->type() == QgsMapLayer::RasterLayer && qAbs( rasterScaleFactor - 1.0 ) > 0.000001 )
|
|
392 | 392 |
{ |
393 | 393 |
scaleRaster = true; |
394 | 394 |
} |
src/core/spatialindex/tools/Tools.cc (working copy) | ||
---|---|---|
640 | 640 |
rl * blockSize |
641 | 641 |
) |
642 | 642 |
{ |
643 |
unsigned long l = std::max( bufferLength, rl * blockSize );
|
|
643 |
unsigned long l = qMax( bufferLength, rl * blockSize );
|
|
644 | 644 | |
645 | 645 |
byte* tmp; |
646 | 646 |
try |
... | ... | |
717 | 717 |
); |
718 | 718 | |
719 | 719 |
// maximum resident set size |
720 |
m_peakMemory = std::max( m_peakMemory, m_tmpRU.ru_maxrss );
|
|
720 |
m_peakMemory = qMax( m_peakMemory, m_tmpRU.ru_maxrss );
|
|
721 | 721 | |
722 | 722 |
// total memory |
723 |
m_totalMemory = std::max( m_totalMemory, m_tmpRU.ru_ixrss + m_tmpRU.ru_idrss + m_tmpRU.ru_isrss + m_tmpRU.ru_maxrss );
|
|
723 |
m_totalMemory = qMax( m_totalMemory, m_tmpRU.ru_ixrss + m_tmpRU.ru_idrss + m_tmpRU.ru_isrss + m_tmpRU.ru_maxrss );
|
|
724 | 724 |
} |
725 | 725 | |
726 | 726 |
void Tools::ResourceUsage::stop() |
... | ... | |
757 | 757 |
m_writeIO += ru.ru_oublock - m_tmpRU.ru_oublock; |
758 | 758 | |
759 | 759 |
// maximum resident set size |
760 |
m_peakMemory = std::max( m_peakMemory, ru.ru_maxrss );
|
|
760 |
m_peakMemory = qMax( m_peakMemory, ru.ru_maxrss );
|
|
761 | 761 | |
762 | 762 |
// total memory |
763 |
m_totalMemory = std::max( m_totalMemory, ru.ru_ixrss + ru.ru_idrss + ru.ru_isrss + ru.ru_maxrss );
|
|
763 |
m_totalMemory = qMax( m_totalMemory, ru.ru_ixrss + ru.ru_idrss + ru.ru_isrss + ru.ru_maxrss );
|
|
764 | 764 | |
765 | 765 |
// page faults |
766 | 766 |
m_pageFaults += ru.ru_majflt - m_tmpRU.ru_majflt; |
src/core/spatialindex/tools/ExternalSort.cc (working copy) | ||
---|---|---|
212 | 212 |
// if there are no more records in the file, do nothing. |
213 | 213 |
} |
214 | 214 | |
215 |
cMaxRun = std::max( cRun, cMaxRun );
|
|
215 |
cMaxRun = qMax( cRun, cMaxRun );
|
|
216 | 216 |
cRun++; |
217 | 217 |
if ( cRun == runs.size() ) cRun = 0; |
218 | 218 |
} |
src/core/spatialindex/rtree/RTree.cc (working copy) | ||
---|---|---|
639 | 639 | |
640 | 640 |
for ( unsigned long cChild = 0; cChild < e.m_pNode->m_children; cChild++ ) |
641 | 641 |
{ |
642 |
tmpRegion.m_pLow[cDim] = std::min( tmpRegion.m_pLow[cDim], e.m_pNode->m_ptrMBR[cChild]->m_pLow[cDim] );
|
|
643 |
tmpRegion.m_pHigh[cDim] = std::max( tmpRegion.m_pHigh[cDim], e.m_pNode->m_ptrMBR[cChild]->m_pHigh[cDim] );
|
|
642 |
tmpRegion.m_pLow[cDim] = qMin( tmpRegion.m_pLow[cDim], e.m_pNode->m_ptrMBR[cChild]->m_pLow[cDim] );
|
|
643 |
tmpRegion.m_pHigh[cDim] = qMax( tmpRegion.m_pHigh[cDim], e.m_pNode->m_ptrMBR[cChild]->m_pHigh[cDim] );
|
|
644 | 644 |
} |
645 | 645 |
} |
646 | 646 |
src/core/spatialindex/rtree/Node.cc (working copy) | ||
---|---|---|
326 | 326 | |
327 | 327 |
for ( unsigned long cChild = 0; cChild < m_children; cChild++ ) |
328 | 328 |
{ |
329 |
m_nodeMBR.m_pLow[cDim] = std::min( m_nodeMBR.m_pLow[cDim], m_ptrMBR[cChild]->m_pLow[cDim] );
|
|
330 |
m_nodeMBR.m_pHigh[cDim] = std::max( m_nodeMBR.m_pHigh[cDim], m_ptrMBR[cChild]->m_pHigh[cDim] );
|
|
329 |
m_nodeMBR.m_pLow[cDim] = qMin( m_nodeMBR.m_pLow[cDim], m_ptrMBR[cChild]->m_pLow[cDim] );
|
|
330 |
m_nodeMBR.m_pHigh[cDim] = qMax( m_nodeMBR.m_pHigh[cDim], m_ptrMBR[cChild]->m_pHigh[cDim] );
|
|
331 | 331 |
} |
332 | 332 |
} |
333 | 333 |
} |