Skip to content

Commit

Permalink
Remove code paths for proj >= 6.0 < 6.3
Browse files Browse the repository at this point in the history
We no longer support building with these versions
  • Loading branch information
nyalldawson committed Feb 20, 2020
1 parent 572ff9b commit b2f37bb
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 29 deletions.
9 changes: 1 addition & 8 deletions src/core/qgsdatumtransform.cpp
Expand Up @@ -46,12 +46,9 @@ QList<QgsDatumTransform::TransformDetails> QgsDatumTransform::operations( const
// See https://lists.osgeo.org/pipermail/proj/2019-May/008604.html
proj_operation_factory_context_set_spatial_criterion( pjContext, operationContext, PROJ_SPATIAL_CRITERION_PARTIAL_INTERSECTION );

#if PROJ_VERSION_MAJOR>6 || (PROJ_VERSION_MAJOR==6 && PROJ_VERSION_MINOR>=2)
if ( includeSuperseded )
proj_operation_factory_context_set_discard_superseded( pjContext, operationContext, false );
#else
Q_UNUSED( includeSuperseded )
#endif

if ( PJ_OBJ_LIST *ops = proj_create_operations( pjContext, source.projObject(), destination.projObject(), operationContext ) )
{
int count = proj_list_get_count( ops );
Expand Down Expand Up @@ -355,10 +352,8 @@ QgsDatumTransform::TransformDetails QgsDatumTransform::transformDetailsFromPj( P
details.bounds.setYMaximum( northLat );
}

#if PROJ_VERSION_MAJOR>6 || (PROJ_VERSION_MAJOR==6 && PROJ_VERSION_MINOR>=2)
details.remarks = QString( proj_get_remarks( op ) );
details.scope = QString( proj_get_scope( op ) );
#endif

for ( int j = 0; j < proj_coordoperation_get_grid_used_count( pjContext, op ); ++j )
{
Expand All @@ -382,7 +377,6 @@ QgsDatumTransform::TransformDetails QgsDatumTransform::transformDetailsFromPj( P
details.grids.append( gridDetails );
}

#if PROJ_VERSION_MAJOR>6 || (PROJ_VERSION_MAJOR==6 && PROJ_VERSION_MINOR>=2)
for ( int j = 0; j < proj_concatoperation_get_step_count( pjContext, op ); ++j )
{
QgsProjUtils::proj_pj_unique_ptr step( proj_concatoperation_get_step( pjContext, op, j ) );
Expand All @@ -402,7 +396,6 @@ QgsDatumTransform::TransformDetails QgsDatumTransform::transformDetailsFromPj( P
details.operationDetails.append( singleOpDetails );
}
}
#endif

return details;
}
Expand Down
2 changes: 0 additions & 2 deletions src/core/qgsprojutils.cpp
Expand Up @@ -266,7 +266,6 @@ QList<QgsDatumTransform::GridDetails> QgsProjUtils::gridsUsed( const QString &pr
const QString gridName = match.captured( 1 );
QgsDatumTransform::GridDetails grid;
grid.shortName = gridName;
#if PROJ_VERSION_MAJOR>6 || (PROJ_VERSION_MAJOR==6 && PROJ_VERSION_MINOR>=2)
const char *fullName = nullptr;
const char *packageName = nullptr;
const char *url = nullptr;
Expand All @@ -280,7 +279,6 @@ QList<QgsDatumTransform::GridDetails> QgsProjUtils::gridsUsed( const QString &pr
grid.directDownload = directDownload;
grid.openLicense = openLicense;
grid.isAvailable = available;
#endif
grids.append( grid );
}
return grids;
Expand Down
19 changes: 2 additions & 17 deletions src/gui/qgscoordinateoperationwidget.cpp
Expand Up @@ -70,17 +70,11 @@ QgsCoordinateOperationWidget::QgsCoordinateOperationWidget( QWidget *parent )
#if PROJ_VERSION_MAJOR>=6
// proj 6 doesn't provide deprecated operations
mHideDeprecatedCheckBox->setVisible( false );

#if PROJ_VERSION_MAJOR>6 || PROJ_VERSION_MINOR>=2
mShowSupersededCheckBox->setVisible( true );
#else
mAllowFallbackCheckBox->setVisible( false );
mShowSupersededCheckBox->setVisible( false );
#endif

mLabelDstDescription->hide();
#else
mShowSupersededCheckBox->setVisible( false );
mAllowFallbackCheckBox->setVisible( false );
QgsSettings settings;
mHideDeprecatedCheckBox->setChecked( settings.value( QStringLiteral( "Windows/DatumTransformDialog/hideDeprecated" ), true ).toBool() );
#endif
Expand Down Expand Up @@ -257,7 +251,6 @@ void QgsCoordinateOperationWidget::loadAvailableOperations()
QStringList areasOfUse;
QStringList authorityCodes;

#if PROJ_VERSION_MAJOR > 6 || PROJ_VERSION_MINOR >= 2
QStringList opText;
for ( const QgsDatumTransform::SingleOperationDetails &singleOpDetails : transform.operationDetails )
{
Expand Down Expand Up @@ -311,7 +304,6 @@ void QgsCoordinateOperationWidget::loadAvailableOperations()
for ( int k = 0; k < opText.count(); ++k )
opText[k] = QStringLiteral( "<li>%1</li>" ).arg( opText.at( k ) );
}
#endif

if ( !transform.areaOfUse.isEmpty() && !areasOfUse.contains( transform.areaOfUse ) )
areasOfUse << transform.areaOfUse;
Expand All @@ -321,7 +313,6 @@ void QgsCoordinateOperationWidget::loadAvailableOperations()
if ( !id.isEmpty() && !authorityCodes.contains( id ) )
authorityCodes << id;

#if PROJ_VERSION_MAJOR > 6 || PROJ_VERSION_MINOR >= 2
const QColor disabled = palette().color( QPalette::Disabled, QPalette::Text );
const QColor active = palette().color( QPalette::Active, QPalette::Text );

Expand All @@ -334,13 +325,7 @@ void QgsCoordinateOperationWidget::loadAvailableOperations()
+ ( !authorityCodes.empty() ? QStringLiteral( "<p><b>%1</b>: %2</p>" ).arg( tr( "Identifiers" ), authorityCodes.join( QStringLiteral( ", " ) ) ) : QString() )
+ ( !missingMessage.isEmpty() ? QStringLiteral( "<p><b style=\"color: red\">%1</b></p>" ).arg( missingMessage ) : QString() )
+ QStringLiteral( "<p><code style=\"color: %1\">%2</code></p>" ).arg( codeColor.name(), transform.proj );
#else
const QString toolTipString = QStringLiteral( "<b>%1</b>%2%3%4<p><code>%5</code></p>" ).arg( transform.name,
( !transform.areaOfUse.isEmpty() ? QStringLiteral( "<p><b>%1</b>: %2</p>" ).arg( tr( "Area of use" ), transform.areaOfUse ) : QString() ),
( !id.isEmpty() ? QStringLiteral( "<p><b>%1</b>: %2</p>" ).arg( tr( "Identifier" ), id ) : QString() ),
( !missingMessage.isEmpty() ? QStringLiteral( "<p><b style=\"color: red\">%1</b></p>" ).arg( missingMessage ) : QString() ),
transform.proj );
#endif

item->setToolTip( toolTipString );
mCoordinateOperationTableWidget->setRowCount( row + 1 );
mCoordinateOperationTableWidget->setItem( row, 0, item.release() );
Expand Down
2 changes: 0 additions & 2 deletions tests/src/core/testqgsprojutils.cpp
Expand Up @@ -115,11 +115,9 @@ void TestQgsProjUtils::gridsUsed()
const QList< QgsDatumTransform::GridDetails > grids = QgsProjUtils::gridsUsed( QStringLiteral( "+proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +inv +proj=hgridshift +grids=GDA94_GDA2020_conformal_and_distortion.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1" ) );
QCOMPARE( grids.count(), 1 );
QCOMPARE( grids.at( 0 ).shortName, QStringLiteral( "GDA94_GDA2020_conformal_and_distortion.gsb" ) );
#if PROJ_VERSION_MINOR>=2
QCOMPARE( grids.at( 0 ).packageName, QStringLiteral( "proj-datumgrid-oceania" ) );
QVERIFY( grids.at( 0 ).directDownload );
#endif
#endif
}

QGSTEST_MAIN( TestQgsProjUtils )
Expand Down

0 comments on commit b2f37bb

Please sign in to comment.