Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
DBL_EPSILON -> numeric_limits
  • Loading branch information
nyalldawson committed Jun 16, 2018
1 parent eabd5c3 commit 47e7a10
Show file tree
Hide file tree
Showing 13 changed files with 77 additions and 77 deletions.
2 changes: 1 addition & 1 deletion python/core/auto_generated/qgis.sip.in
Expand Up @@ -100,7 +100,7 @@ Returns a string representation of a double
:param precision: number of decimal places to retain
%End

bool qgsDoubleNear( double a, double b, double epsilon = 4 * DBL_EPSILON );
bool qgsDoubleNear( double a, double b, double epsilon = 4 * std::numeric_limits<double>::epsilon() );
%Docstring
Compare two doubles (but allow some difference)

Expand Down
16 changes: 8 additions & 8 deletions src/core/geometry/qgsgeos.cpp
Expand Up @@ -310,17 +310,17 @@ void QgsGeos::subdivideRecursive( const GEOSGeometry *currentPart, int maxNodes,

if ( height <= 0 )
{
halfClipRect1.setYMinimum( halfClipRect1.yMinimum() - DBL_EPSILON );
halfClipRect2.setYMinimum( halfClipRect2.yMinimum() - DBL_EPSILON );
halfClipRect1.setYMaximum( halfClipRect1.yMaximum() + DBL_EPSILON );
halfClipRect2.setYMaximum( halfClipRect2.yMaximum() + DBL_EPSILON );
halfClipRect1.setYMinimum( halfClipRect1.yMinimum() - std::numeric_limits<double>::epsilon() );
halfClipRect2.setYMinimum( halfClipRect2.yMinimum() - std::numeric_limits<double>::epsilon() );
halfClipRect1.setYMaximum( halfClipRect1.yMaximum() + std::numeric_limits<double>::epsilon() );
halfClipRect2.setYMaximum( halfClipRect2.yMaximum() + std::numeric_limits<double>::epsilon() );
}
if ( width <= 0 )
{
halfClipRect1.setXMinimum( halfClipRect1.xMinimum() - DBL_EPSILON );
halfClipRect2.setXMinimum( halfClipRect2.xMinimum() - DBL_EPSILON );
halfClipRect1.setXMaximum( halfClipRect1.xMaximum() + DBL_EPSILON );
halfClipRect2.setXMaximum( halfClipRect2.xMaximum() + DBL_EPSILON );
halfClipRect1.setXMinimum( halfClipRect1.xMinimum() - std::numeric_limits<double>::epsilon() );
halfClipRect2.setXMinimum( halfClipRect2.xMinimum() - std::numeric_limits<double>::epsilon() );
halfClipRect1.setXMaximum( halfClipRect1.xMaximum() + std::numeric_limits<double>::epsilon() );
halfClipRect2.setXMaximum( halfClipRect2.xMaximum() + std::numeric_limits<double>::epsilon() );
}

geos::unique_ptr clipPart1( GEOSClipByRect_r( geosinit.ctxt, currentPart, halfClipRect1.xMinimum(), halfClipRect1.yMinimum(), halfClipRect1.xMaximum(), halfClipRect1.yMaximum() ) );
Expand Down
2 changes: 1 addition & 1 deletion src/core/geometry/qgspolygon.cpp
Expand Up @@ -260,7 +260,7 @@ double QgsPolygon::pointDistanceToBoundary( double x, double y ) const
( x < ( bX - aX ) * ( y - aY ) / ( bY - aY ) + aX ) )
inside = !inside;

minimumDistance = std::min( minimumDistance, QgsGeometryUtils::sqrDistToLine( x, y, aX, aY, bX, bY, minDistX, minDistY, 4 * DBL_EPSILON ) );
minimumDistance = std::min( minimumDistance, QgsGeometryUtils::sqrDistToLine( x, y, aX, aY, bX, bY, minDistX, minDistY, 4 * std::numeric_limits<double>::epsilon() ) );
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/qgis.h
Expand Up @@ -248,7 +248,7 @@ inline QString qgsDoubleToString( double a, int precision = 17 )
* \param b second double
* \param epsilon maximum difference allowable between doubles
*/
inline bool qgsDoubleNear( double a, double b, double epsilon = 4 * DBL_EPSILON )
inline bool qgsDoubleNear( double a, double b, double epsilon = 4 * std::numeric_limits<double>::epsilon() )
{
const double diff = a - b;
return diff > -epsilon && diff <= epsilon;
Expand Down
4 changes: 2 additions & 2 deletions tests/src/core/testqgsdistancearea.cpp
Expand Up @@ -234,14 +234,14 @@ void TestQgsDistanceArea::collections()
double result = myDa.measureLength( lines );
QGSCOMPARENEAR( result, 12006159, 1 );
result = myDa.measureArea( lines );
QGSCOMPARENEAR( result, 0, 4 * DBL_EPSILON );
QGSCOMPARENEAR( result, 0, 4 * std::numeric_limits<double>::epsilon() );

//collection of polygons
QgsGeometry polys( QgsGeometryFactory::geomFromWkt( QStringLiteral( "GeometryCollection( Polygon((0 36.53, 5.76 -48.16, 0 25.54, 0 36.53)), Polygon((10 20, 15 20, 15 10, 10 20)) )" ) ).release() );
result = myDa.measureArea( polys );
QGSCOMPARENEAR( result, 670434859475LL, 1 );
result = myDa.measureLength( polys );
QGSCOMPARENEAR( result, 0, 4 * DBL_EPSILON );
QGSCOMPARENEAR( result, 0, 4 * std::numeric_limits<double>::epsilon() );

//mixed collection
QgsGeometry mixed( QgsGeometryFactory::geomFromWkt( QStringLiteral( "GeometryCollection( LineString(0 36.53, 5.76 -48.16), LineString(0 25.54, 24.20 36.70), Polygon((0 36.53, 5.76 -48.16, 0 25.54, 0 36.53)), Polygon((10 20, 15 20, 15 10, 10 20)) )" ) ).release() );
Expand Down
38 changes: 19 additions & 19 deletions tests/src/core/testqgsgeometry.cpp
Expand Up @@ -681,8 +681,8 @@ void TestQgsGeometry::point()
//toQPointF
QgsPoint p11a( 5.0, 9.0 );
QPointF result = p11a.toQPointF();
QGSCOMPARENEAR( result.x(), 5.0, 4 * DBL_EPSILON );
QGSCOMPARENEAR( result.y(), 9.0, 4 * DBL_EPSILON );
QGSCOMPARENEAR( result.x(), 5.0, 4 * std::numeric_limits<double>::epsilon() );
QGSCOMPARENEAR( result.y(), 9.0, 4 * std::numeric_limits<double>::epsilon() );

//to/from WKB
QgsPoint p12( QgsWkbTypes::PointZM, 1.0, 2.0, 3.0, -4.0 );
Expand Down Expand Up @@ -4199,26 +4199,26 @@ void TestQgsGeometry::lineString()
l35.setPoints( QgsPointSequence() << QgsPoint( 5, 10 ) );
QVERIFY( l35.closestSegment( QgsPoint( 5, 10 ), p, v ) < 0 );
l35.setPoints( QgsPointSequence() << QgsPoint( 5, 10 ) << QgsPoint( 10, 10 ) );
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 4, 11 ), p, v, &leftOf ), 2.0, 4 * DBL_EPSILON );
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 4, 11 ), p, v, &leftOf ), 2.0, 4 * std::numeric_limits<double>::epsilon() );
QCOMPARE( p, QgsPoint( 5, 10 ) );
QCOMPARE( v, QgsVertexId( 0, 0, 1 ) );
QCOMPARE( leftOf, -1 );
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 8, 11 ), p, v, &leftOf ), 1.0, 4 * DBL_EPSILON );
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 8, 11 ), p, v, &leftOf ), 1.0, 4 * std::numeric_limits<double>::epsilon() );
QCOMPARE( p, QgsPoint( 8, 10 ) );
QCOMPARE( v, QgsVertexId( 0, 0, 1 ) );
QCOMPARE( leftOf, -1 );
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 8, 9 ), p, v, &leftOf ), 1.0, 4 * DBL_EPSILON );
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 8, 9 ), p, v, &leftOf ), 1.0, 4 * std::numeric_limits<double>::epsilon() );
QCOMPARE( p, QgsPoint( 8, 10 ) );
QCOMPARE( v, QgsVertexId( 0, 0, 1 ) );
QCOMPARE( leftOf, 1 );
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 11, 9 ), p, v, &leftOf ), 2.0, 4 * DBL_EPSILON );
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 11, 9 ), p, v, &leftOf ), 2.0, 4 * std::numeric_limits<double>::epsilon() );
QCOMPARE( p, QgsPoint( 10, 10 ) );
QCOMPARE( v, QgsVertexId( 0, 0, 1 ) );
QCOMPARE( leftOf, 1 );
l35.setPoints( QgsPointSequence() << QgsPoint( 5, 10 )
<< QgsPoint( 10, 10 )
<< QgsPoint( 10, 15 ) );
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 11, 12 ), p, v, &leftOf ), 1.0, 4 * DBL_EPSILON );
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 11, 12 ), p, v, &leftOf ), 1.0, 4 * std::numeric_limits<double>::epsilon() );
QCOMPARE( p, QgsPoint( 10, 12 ) );
QCOMPARE( v, QgsVertexId( 0, 0, 2 ) );
QCOMPARE( leftOf, 1 );
Expand All @@ -4227,7 +4227,7 @@ void TestQgsGeometry::lineString()
<< QgsPoint( 6, 4 )
<< QgsPoint( 4, 4 )
<< QgsPoint( 5, 5 ) );
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 2.35, 4 ), p, v, &leftOf ), 2.7225, 4 * DBL_EPSILON );
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 2.35, 4 ), p, v, &leftOf ), 2.7225, 4 * std::numeric_limits<double>::epsilon() );
QCOMPARE( p, QgsPoint( 4, 4 ) );
QCOMPARE( v, QgsVertexId( 0, 0, 2 ) );
QCOMPARE( leftOf, -1 );
Expand All @@ -4236,7 +4236,7 @@ void TestQgsGeometry::lineString()
<< QgsPoint( 4, 4 )
<< QgsPoint( 6, 4 )
<< QgsPoint( 5, 5 ) );
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 2.35, 4 ), p, v, &leftOf ), 2.7225, 4 * DBL_EPSILON );
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 2.35, 4 ), p, v, &leftOf ), 2.7225, 4 * std::numeric_limits<double>::epsilon() );
QCOMPARE( p, QgsPoint( 4, 4 ) );
QCOMPARE( v, QgsVertexId( 0, 0, 1 ) );
QCOMPARE( leftOf, 1 );
Expand All @@ -4245,7 +4245,7 @@ void TestQgsGeometry::lineString()
<< QgsPoint( 6, 4 )
<< QgsPoint( 4, 4 )
<< QgsPoint( 5, 5 ) );
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 3.5, 2 ), p, v, &leftOf ), 4.250000, 4 * DBL_EPSILON );
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 3.5, 2 ), p, v, &leftOf ), 4.250000, 4 * std::numeric_limits<double>::epsilon() );
QCOMPARE( p, QgsPoint( 4, 4 ) );
QCOMPARE( v, QgsVertexId( 0, 0, 2 ) );
QCOMPARE( leftOf, -1 );
Expand All @@ -4254,7 +4254,7 @@ void TestQgsGeometry::lineString()
<< QgsPoint( 4, 4 )
<< QgsPoint( 6, 4 )
<< QgsPoint( 5, 5 ) );
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 3.5, 2 ), p, v, &leftOf ), 4.250000, 4 * DBL_EPSILON );
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 3.5, 2 ), p, v, &leftOf ), 4.250000, 4 * std::numeric_limits<double>::epsilon() );
QCOMPARE( p, QgsPoint( 4, 4 ) );
QCOMPARE( v, QgsVertexId( 0, 0, 1 ) );
QCOMPARE( leftOf, 1 );
Expand All @@ -4263,7 +4263,7 @@ void TestQgsGeometry::lineString()
<< QgsPoint( 1, 4 )
<< QgsPoint( 2, 2 )
<< QgsPoint( 1, 1 ) );
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 1, 0 ), p, v, &leftOf ), 1, 4 * DBL_EPSILON );
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 1, 0 ), p, v, &leftOf ), 1, 4 * std::numeric_limits<double>::epsilon() );
QCOMPARE( p, QgsPoint( 1, 1 ) );
QCOMPARE( v, QgsVertexId( 0, 0, 1 ) );
QCOMPARE( leftOf, -1 );
Expand All @@ -4272,7 +4272,7 @@ void TestQgsGeometry::lineString()
<< QgsPoint( 2, 2 )
<< QgsPoint( 1, 4 )
<< QgsPoint( 1, 1 ) );
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 1, 0 ), p, v, &leftOf ), 1, 4 * DBL_EPSILON );
QGSCOMPARENEAR( l35.closestSegment( QgsPoint( 1, 0 ), p, v, &leftOf ), 1, 4 * std::numeric_limits<double>::epsilon() );
QCOMPARE( p, QgsPoint( 1, 1 ) );
QCOMPARE( v, QgsVertexId( 0, 0, 1 ) );
QCOMPARE( leftOf, 1 );
Expand All @@ -4287,13 +4287,13 @@ void TestQgsGeometry::lineString()
QCOMPARE( area, 1.0 );
l36.setPoints( QgsPointSequence() << QgsPoint( 5, 10 ) << QgsPoint( 10, 10 ) );
l36.sumUpArea( area );
QGSCOMPARENEAR( area, -24, 4 * DBL_EPSILON );
QGSCOMPARENEAR( area, -24, 4 * std::numeric_limits<double>::epsilon() );
l36.setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 2, 0 ) << QgsPoint( 2, 2 ) );
l36.sumUpArea( area );
QGSCOMPARENEAR( area, -22, 4 * DBL_EPSILON );
QGSCOMPARENEAR( area, -22, 4 * std::numeric_limits<double>::epsilon() );
l36.setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 2, 0 ) << QgsPoint( 2, 2 ) << QgsPoint( 0, 2 ) );
l36.sumUpArea( area );
QGSCOMPARENEAR( area, -18, 4 * DBL_EPSILON );
QGSCOMPARENEAR( area, -18, 4 * std::numeric_limits<double>::epsilon() );

//boundingBox - test that bounding box is updated after every modification to the line string
QgsLineString l37;
Expand Down Expand Up @@ -4342,8 +4342,8 @@ void TestQgsGeometry::lineString()
QGSCOMPARENEAR( l38.vertexAngle( QgsVertexId( 0, 0, 1 ) ), 1.5708, 0.0001 );
( void )l38.vertexAngle( QgsVertexId( 0, 0, 2 ) ); //no crash
l38.setPoints( QgsPointSequence() << QgsPoint( 0, 0 ) << QgsPoint( 0, 1 ) );
QGSCOMPARENEAR( l38.vertexAngle( QgsVertexId( 0, 0, 0 ) ), 0.0, 4 * DBL_EPSILON );
QGSCOMPARENEAR( l38.vertexAngle( QgsVertexId( 0, 0, 1 ) ), 0.0, 4 * DBL_EPSILON );
QGSCOMPARENEAR( l38.vertexAngle( QgsVertexId( 0, 0, 0 ) ), 0.0, 4 * std::numeric_limits<double>::epsilon() );
QGSCOMPARENEAR( l38.vertexAngle( QgsVertexId( 0, 0, 1 ) ), 0.0, 4 * std::numeric_limits<double>::epsilon() );
l38.setPoints( QgsPointSequence() << QgsPoint( 1, 0 ) << QgsPoint( 0, 0 ) );
QGSCOMPARENEAR( l38.vertexAngle( QgsVertexId( 0, 0, 0 ) ), 4.71239, 0.0001 );
QGSCOMPARENEAR( l38.vertexAngle( QgsVertexId( 0, 0, 1 ) ), 4.71239, 0.0001 );
Expand Down Expand Up @@ -10927,7 +10927,7 @@ void TestQgsGeometry::compoundCurve()
<< QgsPoint( 1, 1 ) );
double lsArea = 0.0;
ls.sumUpArea( lsArea );
QGSCOMPARENEAR( ccArea, lsArea, 4 * DBL_EPSILON );
QGSCOMPARENEAR( ccArea, lsArea, 4 * std::numeric_limits<double>::epsilon() );


//addVertex
Expand Down
12 changes: 6 additions & 6 deletions tests/src/core/testqgsgeometryimport.cpp
Expand Up @@ -85,8 +85,8 @@ void TestQgsGeometryImport::pointWkt()
QCOMPARE( geom.wkbType(), QgsWkbTypes::Point );
QgsPointXY point = geom.asPoint();

QGSCOMPARENEAR( point.x(), x, 4 * DBL_EPSILON );
QGSCOMPARENEAR( point.y(), y, 4 * DBL_EPSILON );
QGSCOMPARENEAR( point.x(), x, 4 * std::numeric_limits<double>::epsilon() );
QGSCOMPARENEAR( point.y(), y, 4 * std::numeric_limits<double>::epsilon() );
}

void TestQgsGeometryImport::pointWkb_data()
Expand All @@ -113,8 +113,8 @@ void TestQgsGeometryImport::pointWkb()
QgsPointXY point = geom.asPoint();

QCOMPARE( geom.wkbType(), QgsWkbTypes::Point );
QGSCOMPARENEAR( point.x(), x, 4 * DBL_EPSILON );
QGSCOMPARENEAR( point.y(), y, 4 * DBL_EPSILON );
QGSCOMPARENEAR( point.x(), x, 4 * std::numeric_limits<double>::epsilon() );
QGSCOMPARENEAR( point.y(), y, 4 * std::numeric_limits<double>::epsilon() );
}

void TestQgsGeometryImport::pointGeos_data()
Expand All @@ -140,8 +140,8 @@ void TestQgsGeometryImport::pointGeos()

QgsPointXY geomPt = geom.asPoint();

QGSCOMPARENEAR( x, geomPt.x(), 4 * DBL_EPSILON );
QGSCOMPARENEAR( y, geomPt.y(), 4 * DBL_EPSILON );
QGSCOMPARENEAR( x, geomPt.x(), 4 * std::numeric_limits<double>::epsilon() );
QGSCOMPARENEAR( y, geomPt.y(), 4 * std::numeric_limits<double>::epsilon() );
}

void TestQgsGeometryImport::linestringWkt_data()
Expand Down
14 changes: 7 additions & 7 deletions tests/src/core/testqgsgeometryutils.cpp
Expand Up @@ -211,8 +211,8 @@ void TestQgsGeometryUtils::testSegmentMidPoint()
midPoint, radius, left );

QVERIFY( ok );
QGSCOMPARENEAR( midPoint.x(), expectedX, 4 * DBL_EPSILON );
QGSCOMPARENEAR( midPoint.y(), expectedY, 4 * DBL_EPSILON );
QGSCOMPARENEAR( midPoint.x(), expectedX, 4 * std::numeric_limits<double>::epsilon() );
QGSCOMPARENEAR( midPoint.y(), expectedY, 4 * std::numeric_limits<double>::epsilon() );
}

void TestQgsGeometryUtils::testSegmentMidPointCenter()
Expand Down Expand Up @@ -266,7 +266,7 @@ void TestQgsGeometryUtils::testCircleLength()
QFETCH( double, y3 );
QFETCH( double, expected );

QGSCOMPARENEAR( expected, QgsGeometryUtils::circleLength( x1, y1, x2, y2, x3, y3 ), 4 * DBL_EPSILON );
QGSCOMPARENEAR( expected, QgsGeometryUtils::circleLength( x1, y1, x2, y2, x3, y3 ), 4 * std::numeric_limits<double>::epsilon() );
}

void TestQgsGeometryUtils::testNormalizedAngle_data()
Expand Down Expand Up @@ -323,7 +323,7 @@ void TestQgsGeometryUtils::testLineAngle()

double lineAngle = QgsGeometryUtils::lineAngle( x1, y1, x2, y2 ) * 180 / M_PI;
if ( expected > -99999 )
QGSCOMPARENEAR( lineAngle, expected, 4 * DBL_EPSILON );
QGSCOMPARENEAR( lineAngle, expected, 4 * std::numeric_limits<double>::epsilon() );
}

void TestQgsGeometryUtils::testLinePerpendicularAngle_data()
Expand Down Expand Up @@ -530,9 +530,9 @@ void TestQgsGeometryUtils::testCircleCenterRadius()

double radius, centerX, centerY;
QgsGeometryUtils::circleCenterRadius( QgsPoint( x1, y1 ), QgsPoint( x2, y2 ), QgsPoint( x3, y3 ), radius, centerX, centerY );
QGSCOMPARENEAR( expectedRadius, radius, 4 * DBL_EPSILON );
QGSCOMPARENEAR( expectedCenterX, centerX, 4 * DBL_EPSILON );
QGSCOMPARENEAR( expectedCenterY, centerY, 4 * DBL_EPSILON );
QGSCOMPARENEAR( expectedRadius, radius, 4 * std::numeric_limits<double>::epsilon() );
QGSCOMPARENEAR( expectedCenterX, centerX, 4 * std::numeric_limits<double>::epsilon() );
QGSCOMPARENEAR( expectedCenterY, centerY, 4 * std::numeric_limits<double>::epsilon() );
}

//QgsGeometryUtils::sqrDistToLine
Expand Down
16 changes: 8 additions & 8 deletions tests/src/core/testqgslayout.cpp
Expand Up @@ -841,9 +841,9 @@ void TestQgsLayout::georeference()
t = exporter.computeGeoTransform( map );
QGSCOMPARENEAR( t[0], 1925.0, 1.0 );
QGSCOMPARENEAR( t[1], 0.211719, 0.0001 );
QGSCOMPARENEAR( t[2], 0.0, 4 * DBL_EPSILON );
QGSCOMPARENEAR( t[2], 0.0, 4 * std::numeric_limits<double>::epsilon() );
QGSCOMPARENEAR( t[3], 3050, 1 );
QGSCOMPARENEAR( t[4], 0.0, 4 * DBL_EPSILON );
QGSCOMPARENEAR( t[4], 0.0, 4 * std::numeric_limits<double>::epsilon() );
QGSCOMPARENEAR( t[5], -0.211694, 0.0001 );
t.reset();

Expand All @@ -852,29 +852,29 @@ void TestQgsLayout::georeference()
t = exporter.computeGeoTransform();
QGSCOMPARENEAR( t[0], 1925.0, 1.0 );
QGSCOMPARENEAR( t[1], 0.211719, 0.0001 );
QGSCOMPARENEAR( t[2], 0.0, 4 * DBL_EPSILON );
QGSCOMPARENEAR( t[2], 0.0, 4 * std::numeric_limits<double>::epsilon() );
QGSCOMPARENEAR( t[3], 3050, 1 );
QGSCOMPARENEAR( t[4], 0.0, 4 * DBL_EPSILON );
QGSCOMPARENEAR( t[4], 0.0, 4 * std::numeric_limits<double>::epsilon() );
QGSCOMPARENEAR( t[5], -0.211694, 0.0001 );
t.reset();

// specify extent
t = exporter.computeGeoTransform( map, QRectF( 70, 100, 50, 60 ) );
QGSCOMPARENEAR( t[0], 2100.0, 1.0 );
QGSCOMPARENEAR( t[1], 0.211864, 0.0001 );
QGSCOMPARENEAR( t[2], 0.0, 4 * DBL_EPSILON );
QGSCOMPARENEAR( t[2], 0.0, 4 * std::numeric_limits<double>::epsilon() );
QGSCOMPARENEAR( t[3], 2800, 1 );
QGSCOMPARENEAR( t[4], 0.0, 4 * DBL_EPSILON );
QGSCOMPARENEAR( t[4], 0.0, 4 * std::numeric_limits<double>::epsilon() );
QGSCOMPARENEAR( t[5], -0.211864, 0.0001 );
t.reset();

// specify dpi
t = exporter.computeGeoTransform( map, QRectF(), 75 );
QGSCOMPARENEAR( t[0], 1925.0, 1 );
QGSCOMPARENEAR( t[1], 0.847603, 0.0001 );
QGSCOMPARENEAR( t[2], 0.0, 4 * DBL_EPSILON );
QGSCOMPARENEAR( t[2], 0.0, 4 * std::numeric_limits<double>::epsilon() );
QGSCOMPARENEAR( t[3], 3050.0, 1 );
QGSCOMPARENEAR( t[4], 0.0, 4 * DBL_EPSILON );
QGSCOMPARENEAR( t[4], 0.0, 4 * std::numeric_limits<double>::epsilon() );
QGSCOMPARENEAR( t[5], -0.846774, 0.0001 );
t.reset();

Expand Down

0 comments on commit 47e7a10

Please sign in to comment.