From e09e24eddbd49cd802ac1334f229f1698ea0b755 Mon Sep 17 00:00:00 2001 From: Thomas Knudsen Date: Fri, 7 Jul 2017 17:14:28 +0200 Subject: obs_api revision and improvements: new namespace etc. (#530) * obs_api revision and improvements: new namespace etc. * Minor corrections: use unused functions, add missing prototype, added fwd/invcoord to PJ * Minor correction: MSVC barfs on va_arg type specification. Trying once more with added parens * Reverting paren correction, which appears to be a non-solution * Significant improvements to the OBS_API, plus a number of corrections, mostly in test code, to reflect API changes * Added two missing prototypes * Adding the proj_transform function and some related checks * Improvements to proj_transform etc. based on suggestions from Even Rouault * Reducing the libc include footprint of proj.h - again based on suggestions from Even Rouault * A few minor corrections * Eliminate a MSVC warning about non-initialized usage. Not an actual issue, as another check has locked the path, but at least this should calm down MSVC * Improved support for the errno reset/restore paradigm * Introduced the internal header proj_internal.h; Moved most non-API stuff from pj_obs_api.c to pj_internal.c * Adding proj_internal.h to HEADERS_LIBPROJ to solve build problems * Correcting a few pj...proj blunders in PJ_pipeline.c * Correcting a few additional blunders in PJ_pipeline.c * Changed angle-brackets to quotation marks in includes of proj_internal.h * Some minor build system repairs * Some PJ_CONTEXT usage simplifications following suggestions by Kristian Evers @kbevers * Added version numbering to proj.h - Fixes #529 * remove proj_errno_restore macro, provide function implementation * Add proj_get_definition. Fixes #538 * Added library specific deallocator proj_buffer_free, eliminating a potential cross heap issues on Windows. Thx to Even Rouault for spotting this * Got rid of a meaningless cast in proj_buffer_free * Added some missing functions to proj.def (again spotted by @rouault); removed some not-yet-implemented material from proj.h * Renamed proj_get_definition/proj_buffer_free to proj_definition_create/proj_definition_destroy, for symmetry and clarity * Renaming the definition handlers to proj_definition_retrieve / proj_free * Renaming proj_free to proj_release --- src/PJ_vgridshift.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/PJ_vgridshift.c') diff --git a/src/PJ_vgridshift.c b/src/PJ_vgridshift.c index 72d97517..e790cd4d 100644 --- a/src/PJ_vgridshift.c +++ b/src/PJ_vgridshift.c @@ -1,5 +1,5 @@ #define PJ_LIB__ -#include +#include "proj_internal.h" #include PROJ_HEAD(vgridshift, "Vertical grid shift"); @@ -73,7 +73,7 @@ static PJ_OBS reverse_obs(PJ_OBS obs, PJ *P) { PJ *PROJECTION(vgridshift) { if (!pj_param(P->ctx, P->params, "tgrids").i) { - pj_log_error(P, "vgridshift: +grids parameter missing."); + proj_log_error(P, "vgridshift: +grids parameter missing."); return freeup_msg(P, -1); } @@ -83,7 +83,7 @@ PJ *PROJECTION(vgridshift) { /* Was gridlist compiled properly? */ if ( pj_ctx_get_errno(P->ctx) ) { - pj_log_error(P, "vgridshift: could not find required grid(s)."); + proj_log_error(P, "vgridshift: could not find required grid(s)."); pj_dalloc(P->gridlist); P->gridlist = NULL; return freeup_msg(P, -38); @@ -113,32 +113,32 @@ int pj_vgridshift_selftest (void) { double dist; /* fail on purpose: +grids parameter it mandatory*/ - P = pj_create("+proj=vgridshift"); + P = proj_create(0, "+proj=vgridshift"); if (0!=P) return 99; /* fail on purpose: open non-existing grid */ - P = pj_create("+proj=vgridshift +grids=nonexistinggrid.gtx"); + P = proj_create(0, "+proj=vgridshift +grids=nonexistinggrid.gtx"); if (0!=P) return 999; /* Failure most likely means the grid is missing */ - P = pj_create ("+proj=vgridshift +grids=egm96_15.gtx +ellps=GRS80"); + P = proj_create (0, "+proj=vgridshift +grids=egm96_15.gtx +ellps=GRS80"); if (0==P) return 10; - a = pj_obs_null; - a.coo.lpz.lam = TORAD(12.5); - a.coo.lpz.phi = TORAD(55.5); + a = proj_obs_null; + a.coo.lpz.lam = PJ_TORAD(12.5); + a.coo.lpz.phi = PJ_TORAD(55.5); - dist = pj_roundtrip (P, PJ_FWD, 1, a); + dist = proj_roundtrip (P, PJ_FWD, 1, a); if (dist > 0.00000001) return 1; expect = a; expect.coo.lpz.z = -36.021305084228515625; - b = pj_trans(P, PJ_FWD, a); - if (pj_xyz_dist(expect.coo.xyz, b.coo.xyz) > 1e-10) + b = proj_trans_obs(P, PJ_FWD, a); + if (proj_xyz_dist(expect.coo.xyz, b.coo.xyz) > 1e-10) return 2; -- cgit v1.2.3