diff options
| author | Kristian Evers <kristianevers@gmail.com> | 2018-03-11 22:28:47 +0100 |
|---|---|---|
| committer | Kristian Evers <kristianevers@gmail.com> | 2018-03-11 22:28:47 +0100 |
| commit | 79fa26dcf4cccc16ab95f46ac3f7f6e87767680c (patch) | |
| tree | 18027c321e76e51529c7623e7eb7e48a7043a949 | |
| parent | cf3066e1967d54148756c65a813abd0e935f7ba9 (diff) | |
| download | PROJ-79fa26dcf4cccc16ab95f46ac3f7f6e87767680c.tar.gz PROJ-79fa26dcf4cccc16ab95f46ac3f7f6e87767680c.zip | |
Make sure that transient errors are returned correctly
The prepare/finalize steps in pj_fwd*/pj_inv* now checks the error level
of the PJ object before returning the coordinate. If an error is
detected proj_coord_error() is returned.
| -rw-r--r-- | src/pj_fwd.c | 19 | ||||
| -rw-r--r-- | src/pj_inv.c | 18 | ||||
| -rw-r--r-- | test/gie/4D-API_cs2cs-style.gie | 11 |
3 files changed, 47 insertions, 1 deletions
diff --git a/src/pj_fwd.c b/src/pj_fwd.c index b2e6afd5..af0aae20 100644 --- a/src/pj_fwd.c +++ b/src/pj_fwd.c @@ -200,6 +200,12 @@ XY pj_fwd(LP lp, PJ *P) { if (!P->skip_fwd_finalize) coo = fwd_finalize (P, coo); + + if (proj_errno(P)) { + proj_errno_reset(P); + return proj_coord_error().xy; + } + return coo.xy; } @@ -208,7 +214,6 @@ XY pj_fwd(LP lp, PJ *P) { XYZ pj_fwd3d(LPZ lpz, PJ *P) { PJ_COORD coo = {{0,0,0,0}}; coo.lpz = lpz; - if (!P->skip_fwd_prepare) coo = fwd_prepare (P, coo); if (HUGE_VAL==coo.v[0]) @@ -230,6 +235,12 @@ XYZ pj_fwd3d(LPZ lpz, PJ *P) { if (!P->skip_fwd_finalize) coo = fwd_finalize (P, coo); + + if (proj_errno(P)) { + proj_errno_reset(P); + return proj_coord_error().xyz; + } + return coo.xyz; } @@ -257,5 +268,11 @@ PJ_COORD pj_fwd4d (PJ_COORD coo, PJ *P) { if (!P->skip_fwd_finalize) coo = fwd_finalize (P, coo); + + if (proj_errno(P)) { + proj_errno_reset(P); + return proj_coord_error(); + } + return coo; } diff --git a/src/pj_inv.c b/src/pj_inv.c index 1e84ff30..f9f11f56 100644 --- a/src/pj_inv.c +++ b/src/pj_inv.c @@ -198,6 +198,12 @@ LP pj_inv(XY xy, PJ *P) { if (!P->skip_inv_finalize) coo = inv_finalize (P, coo); + + if (proj_errno(P)) { + proj_errno_reset(P); + return proj_coord_error().lp; + } + return coo.lp; } @@ -228,6 +234,12 @@ LPZ pj_inv3d (XYZ xyz, PJ *P) { if (!P->skip_inv_finalize) coo = inv_finalize (P, coo); + + if (proj_errno(P)) { + proj_errno_reset(P); + return proj_coord_error().lpz; + } + return coo.lpz; } @@ -255,5 +267,11 @@ PJ_COORD pj_inv4d (PJ_COORD coo, PJ *P) { if (!P->skip_inv_finalize) coo = inv_finalize (P, coo); + + if (proj_errno(P)) { + proj_errno_reset(P); + return proj_coord_error(); + } + return coo; } diff --git a/test/gie/4D-API_cs2cs-style.gie b/test/gie/4D-API_cs2cs-style.gie index 66da0633..73170bab 100644 --- a/test/gie/4D-API_cs2cs-style.gie +++ b/test/gie/4D-API_cs2cs-style.gie @@ -186,4 +186,15 @@ tolerance 20 cm accept 7.438632495 46.951082877 expect 2600000.0 1200000.0 ------------------------------------------------------------------------------- + +operation +proj=geos +lon_0=0.00 +lat_0=0.00 +a=6378169.00 +b=6356583.80 +h=35785831.0 +accept 85.05493299 46.5261074 +expect failure + +accept 85.05493299 46.5261074 0 +expect failure + +accept 85.05493299 46.5261074 0 0 +expect failure + </gie> |
