From 30b2919c8125ddfbcad460d5e7b3fdd6b04f7410 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Tue, 17 Dec 2019 09:05:44 +1000 Subject: [PATCH] Make custom projection validation button work on proj < 6 --- src/app/qgscustomprojectiondialog.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/app/qgscustomprojectiondialog.cpp b/src/app/qgscustomprojectiondialog.cpp index 334e4b404eaa..115fd9ddd7a2 100644 --- a/src/app/qgscustomprojectiondialog.cpp +++ b/src/app/qgscustomprojectiondialog.cpp @@ -515,7 +515,23 @@ void QgsCustomProjectionDialog::validateCurrent() proj_log_func( context, nullptr, nullptr ); proj_context_destroy( context ); context = nullptr; +#else + projCtx pContext = pj_ctx_alloc(); + projPJ proj = pj_init_plus_ctx( pContext, projDef.toLocal8Bit().data() ); + if ( proj ) + { + QMessageBox::information( this, tr( "Custom Coordinate Reference System" ), + tr( "This proj projection definition is valid." ) ); + } + else + { + QMessageBox::warning( this, tr( "Custom Coordinate Reference System" ), + tr( "This proj projection definition is not valid" ) ); + } + + pj_free( proj ); + pj_ctx_free( pContext ); #endif }