Skip to content

Commit

Permalink
More proj6 test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed May 13, 2019
1 parent fcf59bb commit 4db0f5b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
10 changes: 2 additions & 8 deletions src/core/qgscoordinatereferencesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -787,15 +787,8 @@ bool QgsCoordinateReferenceSystem::createFromProj4( const QString &proj4String )
// +x_0=600000 +y_0=2200000 +a=6378249.2 +b=6356515.000000472 +units=m +no_defs
//
QString myProj4String = proj4String.trimmed();
#if PROJ_VERSION_MAJOR>=6
if ( !myProj4String.contains( QStringLiteral( "+type=crs" ) ) )
{
myProj4String += QStringLiteral( " +type=crs" );
}
#else
myProj4String.remove( QStringLiteral( "+type=crs" ) );
myProj4String = myProj4String.trimmed();
#endif

// hack!
#if PROJ_VERSION_MAJOR>=6
Expand All @@ -809,7 +802,8 @@ bool QgsCoordinateReferenceSystem::createFromProj4( const QString &proj4String )
// broken on proj <= 6.1.0
#if PROJ_VERSION_MAJOR>=6
// first, try to use proj to do this for us...
QgsProjUtils::proj_pj_unique_ptr crs( proj_create( QgsProjContext::get(), proj4String.toLatin1().constData() ) );
const QString projCrsString = myProj4String + ( myProj4String.contains( QStringLiteral( "+type=crs" ) ) ? QString() : QStringLiteral( " +type=crs" ) );
QgsProjUtils::proj_pj_unique_ptr crs( proj_create( QgsProjContext::get(), projCrsString.toLatin1().constData() ) );
if ( crs )
{
//crs = QgsProjUtils::crsToSingleCrs( crs.get() ) ;
Expand Down
4 changes: 1 addition & 3 deletions tests/src/core/testqgscoordinatetransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,7 @@ void TestQgsCoordinateTransform::scaleFactor()
QFETCH( double, factor );

QgsCoordinateTransform ct( sourceCrs, destCrs, QgsProject::instance() );

// qDebug() << QString::number(ct.scaleFactor( rect ), 'g', 17) ;
QVERIFY( qgsDoubleNear( ct.scaleFactor( rect ), factor ) );
QGSCOMPARENEAR( ct.scaleFactor( rect ), factor, 0.00000001 );
}

void TestQgsCoordinateTransform::scaleFactor_data()
Expand Down

0 comments on commit 4db0f5b

Please sign in to comment.