aboutsummaryrefslogtreecommitdiff
path: root/src/pj_internal.c
diff options
context:
space:
mode:
authorKristian Evers <kristianevers@gmail.com>2018-01-31 10:56:11 +0100
committerKristian Evers <kristianevers@gmail.com>2018-01-31 10:56:11 +0100
commite979bce36ccd2bc52cabc0b1192bc0f8d4ed6f33 (patch)
treed085407ddc842f25142b48c42e1e0ad978a2ea44 /src/pj_internal.c
parentb6c3d16dae36ed2dfd09e231c5171482553ff2d7 (diff)
downloadPROJ-e979bce36ccd2bc52cabc0b1192bc0f8d4ed6f33.tar.gz
PROJ-e979bce36ccd2bc52cabc0b1192bc0f8d4ed6f33.zip
Add pj_has_inverse().
With the introduction of the "inverted" flag on PJ objects you can no longer rely on checking that the inv, inv3d and inv4d functions are available on said PJ object. The function is used internally a few places and otherwise exposed in proj_api.h to ensure that users of the old programming interface can safely check if an operation has an inverse.
Diffstat (limited to 'src/pj_internal.c')
-rw-r--r--src/pj_internal.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/pj_internal.c b/src/pj_internal.c
index deb0c054..6bb33d64 100644
--- a/src/pj_internal.c
+++ b/src/pj_internal.c
@@ -119,7 +119,14 @@ chained calls starting out with a call to its 3D interface.
return proj_coord_error ();
}
-
+/**************************************************************************************/
+int pj_has_inverse(PJ *P) {
+/***************************************************************************************
+Check if a a PJ has an inverse.
+***************************************************************************************/
+ return ( (P->inverted && (P->fwd || P->fwd3d || P->fwd4d) ) ||
+ ( P->inv || P->inv3d || P->inv4d) );
+}
/* Move P to a new context - or to the default context if 0 is specified */