From 48b3bd9afe0ffccf06b2c8dceef1b636834ba876 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 26 May 2020 15:49:03 +0200 Subject: Implement wink2 inverse by generic inversion of forward method - Move the generic method initiated from adams_ws2 to a pj_generic_inverse_2d() method - Use it in adams_ws2 - Use it in wink2 Fixes https://github.com/qgis/QGIS/issues/35512 --- src/projections/wink2.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/projections/wink2.cpp') diff --git a/src/projections/wink2.cpp b/src/projections/wink2.cpp index 7fd08649..d457f842 100644 --- a/src/projections/wink2.cpp +++ b/src/projections/wink2.cpp @@ -6,7 +6,7 @@ #include "proj.h" #include "proj_internal.h" -PROJ_HEAD(wink2, "Winkel II") "\n\tPCyl, Sph, no inv\n\tlat_1="; +PROJ_HEAD(wink2, "Winkel II") "\n\tPCyl, Sph\n\tlat_1="; namespace { // anonymous namespace struct pj_opaque { @@ -41,6 +41,16 @@ static PJ_XY wink2_s_forward (PJ_LP lp, PJ *P) { /* Spheroidal, forwar return xy; } +static PJ_LP wink2_s_inverse(PJ_XY xy, PJ *P) +{ + PJ_LP lpInit; + + lpInit.phi = xy.y; + lpInit.lam = xy.x; + + return pj_generic_inverse_2d(xy, P, lpInit); +} + PJ *PROJECTION(wink2) { struct pj_opaque *Q = static_cast(pj_calloc (1, sizeof (struct pj_opaque))); @@ -50,8 +60,8 @@ PJ *PROJECTION(wink2) { static_cast(P->opaque)->cosphi1 = cos(pj_param(P->ctx, P->params, "rlat_1").f); P->es = 0.; - P->inv = nullptr; P->fwd = wink2_s_forward; + P->inv = wink2_s_inverse; return P; } -- cgit v1.2.3