diff options
| author | Thomas Knudsen <busstoptaktik@users.noreply.github.com> | 2017-11-06 10:02:05 +0100 |
|---|---|---|
| committer | Kristian Evers <kristianevers@gmail.com> | 2017-11-06 10:02:05 +0100 |
| commit | 8eb82852f5f7d23994839ba5d032edc76eab2250 (patch) | |
| tree | bf821a8723776d36f5c4287ea362bb35e8a26675 /src/pj_internal.c | |
| parent | 1739a927f576ab4dd9e03653bf5e9cf8c0c0ac18 (diff) | |
| download | PROJ-8eb82852f5f7d23994839ba5d032edc76eab2250.tar.gz PROJ-8eb82852f5f7d23994839ba5d032edc76eab2250.zip | |
Eliminate the last traces of PJ_OBS (#643)
PJ_OBS eliminated, API adjusted to reflect that we now have only one 4D data type.
2 new API functions added to determine output types of a PJ.
Diffstat (limited to 'src/pj_internal.c')
| -rw-r--r-- | src/pj_internal.c | 121 |
1 files changed, 7 insertions, 114 deletions
diff --git a/src/pj_internal.c b/src/pj_internal.c index 19dd6409..efa9bd1f 100644 --- a/src/pj_internal.c +++ b/src/pj_internal.c @@ -30,7 +30,7 @@ *****************************************************************************/ #define PJ_INTERNAL_C #include "proj_internal.h" -#include <projects.h> +#include "projects.h" #include <geodesic.h> #include <stddef.h> @@ -38,34 +38,6 @@ #include <errno.h> - - -/* Used for zero-initializing new objects */ -const PJ_COORD proj_coord_null = {{0, 0, 0, 0}}; -const PJ_OBS proj_obs_null = { - {{0, 0, 0, 0}} -}; - - - -/* Initialize PJ_OBS struct */ -PJ_OBS proj_obs (double x, double y, double z, double t) { - PJ_OBS res; - res.coo = proj_coord (x, y, z, t); - return res; -} - - - - - - - - - - - - enum pj_io_units pj_left (PJ *P) { enum pj_io_units u = P->inverted? P->right: P->left; if (u==PJ_IO_UNITS_RADIANS) @@ -80,29 +52,6 @@ enum pj_io_units pj_right (PJ *P) { return PJ_IO_UNITS_METERS; } -/* Apply the transformation P to the coordinate coo */ -PJ_OBS proj_trans_obs (PJ *P, PJ_DIRECTION direction, PJ_OBS obs) { - if (0==P) - return obs; - - if (P->inverted) - direction = -direction; - - switch (direction) { - case PJ_FWD: - return pj_fwdobs (obs, P); - case PJ_INV: - return pj_invobs (obs, P); - case PJ_IDENT: - return obs; - default: - break; - } - - proj_errno_set (P, EINVAL); - return proj_obs_error (); -} - /* Work around non-constness of MSVC HUGE_VAL by providing functions rather than constants */ PJ_COORD proj_coord_error (void) { @@ -111,60 +60,10 @@ PJ_COORD proj_coord_error (void) { return c; } -PJ_OBS proj_obs_error (void) { - PJ_OBS obs; - obs.coo = proj_coord_error (); - return obs; -} - - -PJ_OBS pj_fwdobs (PJ_OBS obs, PJ *P) { - if (0!=P->fwdobs) { - obs = P->fwdobs (obs, P); - return obs; - } - if (0!=P->fwd3d) { - obs.coo.xyz = pj_fwd3d (obs.coo.lpz, P); - return obs; - } - if (0!=P->fwd) { - obs.coo.xy = pj_fwd (obs.coo.lp, P); - return obs; - } - proj_errno_set (P, EINVAL); - return proj_obs_error (); -} - - -PJ_OBS pj_invobs (PJ_OBS obs, PJ *P) { - if (0!=P->invobs) { - obs = P->invobs (obs, P); - return obs; - } - if (0!=P->inv3d) { - obs.coo.lpz = pj_inv3d (obs.coo.xyz, P); - return obs; - } - if (0!=P->inv) { - obs.coo.lp = pj_inv (obs.coo.xy, P); - return obs; - } - proj_errno_set (P, EINVAL); - return proj_obs_error (); -} - - - -PJ_COORD pj_fwdcoord (PJ_COORD coo, PJ *P) { - if (0!=P->fwdcoord) - return P->fwdcoord (coo, P); - if (0!=P->fwdobs) { - PJ_OBS obs = proj_obs_null; - obs.coo = coo; - obs = P->fwdobs (obs, P); - return obs.coo; - } +PJ_COORD pj_fwd4d (PJ_COORD coo, PJ *P) { + if (0!=P->fwd4d) + return P->fwd4d (coo, P); if (0!=P->fwd3d) { coo.xyz = pj_fwd3d (coo.lpz, P); return coo; @@ -178,15 +77,9 @@ PJ_COORD pj_fwdcoord (PJ_COORD coo, PJ *P) { } -PJ_COORD pj_invcoord (PJ_COORD coo, PJ *P) { - if (0!=P->invcoord) - return P->invcoord (coo, P); - if (0!=P->invobs) { - PJ_OBS obs = proj_obs_null; - obs.coo = coo; - obs = P->invobs (obs, P); - return obs.coo; - } +PJ_COORD pj_inv4d (PJ_COORD coo, PJ *P) { + if (0!=P->inv4d) + return P->inv4d (coo, P); if (0!=P->inv3d) { coo.lpz = pj_inv3d (coo.xyz, P); return coo; |
