Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #44688 from rouault/fix_build
qgserror.cpp: fix build in QGISDEBUG mode
  • Loading branch information
rouault committed Aug 13, 2021
2 parents 32c2cea + e7bd600 commit 5126d6e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/core/qgserror.cpp
Expand Up @@ -51,7 +51,7 @@ QString QgsError::message( QgsErrorMessage::Format format ) const
QString str;

#ifdef QGISDEBUG
const QString srcUrl;
QString srcUrl;
#endif

#if defined(QGISDEBUG) && defined(QGS_GIT_REMOTE_URL)
Expand Down
45 changes: 24 additions & 21 deletions tests/src/core/testqgsogrutils.cpp
Expand Up @@ -722,30 +722,33 @@ void TestQgsOgrUtils::convertStyleString()
void TestQgsOgrUtils::ogrCrsConversion()
{
// test conversion utilities for OGR srs objects
{
const QgsCoordinateReferenceSystem crs1( QStringLiteral( "EPSG:3111" ) );
OGRSpatialReferenceH srs = QgsOgrUtils::crsToOGRSpatialReference( crs1 );
QVERIFY( srs );
const QgsCoordinateReferenceSystem crs2( QgsOgrUtils::OGRSpatialReferenceToCrs( srs ) );
// round trip should be lossless
QCOMPARE( crs1, crs2 );
OSRRelease( srs );

const QgsCoordinateReferenceSystem crs1( QStringLiteral( "EPSG:3111" ) );
OGRSpatialReferenceH srs = QgsOgrUtils::crsToOGRSpatialReference( crs1 );
QVERIFY( srs );
const QgsCoordinateReferenceSystem crs2( QgsOgrUtils::OGRSpatialReferenceToCrs( srs ) );
// round trip should be lossless
QCOMPARE( crs1, crs2 );
OSRRelease( srs );
srs = nullptr;
#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(3,4,0)
QVERIFY( std::isnan( crs2.coordinateEpoch() ) );
#endif
}

#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(3,4,0)
QVERIFY( std::isnan( crs2.coordinateEpoch() ) );

// test conversion with a coordinate epoch, should work on GDAL 3.4+
crs1 = QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:4326" ) );
crs1.setCoordinateEpoch( 2020.7 );
srs = QgsOgrUtils::crsToOGRSpatialReference( crs1 );
QVERIFY( srs );
crs2 = QgsCoordinateReferenceSystem( QgsOgrUtils::OGRSpatialReferenceToCrs( srs ) );
// round trip should be lossless
QCOMPARE( crs1, crs2 );
QCOMPARE( crs2.coordinateEpoch(), 2020.7 );
OSRRelease( srs );
srs = nullptr;
{
// test conversion with a coordinate epoch, should work on GDAL 3.4+
QgsCoordinateReferenceSystem crs1( QStringLiteral( "EPSG:4326" ) );
crs1.setCoordinateEpoch( 2020.7 );
OGRSpatialReferenceH srs = QgsOgrUtils::crsToOGRSpatialReference( crs1 );
QVERIFY( srs );
const QgsCoordinateReferenceSystem crs2( QgsOgrUtils::OGRSpatialReferenceToCrs( srs ) );
// round trip should be lossless
QCOMPARE( crs1, crs2 );
QCOMPARE( crs2.coordinateEpoch(), 2020.7 );
OSRRelease( srs );
}
#endif
}

Expand Down

0 comments on commit 5126d6e

Please sign in to comment.