diff options
| author | Thomas Knudsen <busstoptaktik@users.noreply.github.com> | 2016-11-12 16:51:21 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-11-12 16:51:21 +0100 |
| commit | 26e65892728d6bfb010677091b0a464d7c7ebc76 (patch) | |
| tree | 7720fadfcd5f3ca416ca4ea26c94013b3b1801df /src/proj_api.h | |
| parent | 7986e36875f729d7ef3767a97f732ba39fa1b57d (diff) | |
| download | PROJ-26e65892728d6bfb010677091b0a464d7c7ebc76.tar.gz PROJ-26e65892728d6bfb010677091b0a464d7c7ebc76.zip | |
Pipeline plus api - in continuation of the Genereic Coordinates pull request (#445)
This commit reflects continued work on the new rationalized API with
geodetic extensions (see rationale in proj.h). It also reflects the
parallel work on the transformation pipeline reimplementation, by
introducing the PJ_cart cartesian/ellipsoidal converter.
See example/pj_obs_api_test.c for demo example code
Diffstat (limited to 'src/proj_api.h')
| -rw-r--r-- | src/proj_api.h | 102 |
1 files changed, 66 insertions, 36 deletions
diff --git a/src/proj_api.h b/src/proj_api.h index 24a6f053..706e35ab 100644 --- a/src/proj_api.h +++ b/src/proj_api.h @@ -25,45 +25,77 @@ * DEALINGS IN THE SOFTWARE. *****************************************************************************/ + + + /* + * This version number should be updated with every release! The format of + * PJ_VERSION is + * + * * Before version 4.10.0: PJ_VERSION=MNP where M, N, and P are the major, + * minor, and patch numbers; e.g., PJ_VERSION=493 for version 4.9.3. + * + * * Version 4.10.0 and later: PJ_VERSION=MMMNNNPP later where MMM, NNN, PP + * are the major, minor, and patch numbers (the minor and patch numbers + * are padded with leading zeros if necessary); e.g., PJ_VERSION=401000 + * for version 4.10.0. + */ + #ifndef PJ_VERSION + #define PJ_VERSION 493 + #endif + + +/* If we're not asked for PJ_VERSION only, give them everything */ +#ifndef PROJ_API_INCLUDED_FOR_PJ_VERSION_ONLY /* General projections header file */ #ifndef PROJ_API_H #define PROJ_API_H -/* standard inclusions */ -#include <math.h> -#include <stdlib.h> - #ifdef __cplusplus extern "C" { #endif -/* - * This version number should be updated with every release! The format of - * PJ_VERSION is - * - * * Before version 4.10.0: PJ_VERSION=MNP where M, N, and P are the major, - * minor, and patch numbers; e.g., PJ_VERSION=493 for version 4.9.3. - * - * * Version 4.10.0 and later: PJ_VERSION=MMMNNNPP later where MMM, NNN, PP - * are the major, minor, and patch numbers (the minor and patch numbers - * are padded with leading zeros if necessary); e.g., PJ_VERSION=401000 - * for version 4.10.0. - */ -#define PJ_VERSION 493 + +/* standard inclusions */ +#include <math.h> +#include <stdlib.h> + /* pj_init() and similar functions can be used with a non-C locale */ /* Can be detected too at runtime if the symbol pj_atof exists */ #define PJ_LOCALE_SAFE 1 extern char const pj_release[]; /* global release id string */ +extern int pj_errno; /* global error return code */ #define RAD_TO_DEG 57.295779513082321 #define DEG_TO_RAD .017453292519943296 -extern int pj_errno; /* global error return code */ +#if defined(PROJECTS_H) || defined(PROJ_H) +#define PROJ_API_H_NOT_INVOKED_AS_PRIMARY_API +#endif + + + +#ifndef PROJ_H +/* In proj.h these macros are replaced by the enumeration pj_debug_level */ +#define PJ_LOG_NONE 0 +#define PJ_LOG_ERROR 1 +#define PJ_LOG_DEBUG_MAJOR 2 +#define PJ_LOG_DEBUG_MINOR 3 +#endif + -#if !defined(PROJECTS_H) +#ifdef PROJ_API_H_NOT_INVOKED_AS_PRIMARY_API + /* These make the function declarations below conform with classic proj */ + typedef PJ *projPJ; /* projPJ is a pointer to PJ */ + typedef projCtx_t *projCtx; /* projCtx is a pointer to projCtx_t */ +# define projXY XY +# define projLP LP +# define projXYZ XYZ +# define projLPZ LPZ +#else + /* i.e. proj_api invoked as primary API */ typedef struct { double u, v; } projUV; typedef struct { double u, v, w; } projUVW; typedef void *projPJ; @@ -72,15 +104,12 @@ extern int pj_errno; /* global error return code */ #define projXYZ projUVW #define projLPZ projUVW typedef void *projCtx; -#else - typedef PJ *projPJ; - typedef projCtx_t *projCtx; -# define projXY XY -# define projLP LP -# define projXYZ XYZ -# define projLPZ LPZ #endif + + + +/* If included *after* proj.h finishes, we have alternative names */ /* file reading api, like stdio */ typedef int *PAFile; typedef struct projFileAPI_t { @@ -91,14 +120,20 @@ typedef struct projFileAPI_t { void (*FClose)(PAFile); } projFileAPI; + + /* procedure prototypes */ +projCtx pj_get_default_ctx(void); +projCtx pj_get_ctx( projPJ ); + projXY pj_fwd(projLP, projPJ); projLP pj_inv(projXY, projPJ); projXYZ pj_fwd3d(projLPZ, projPJ); projLPZ pj_inv3d(projXYZ, projPJ); + int pj_transform( projPJ src, projPJ dst, long point_count, int point_offset, double *x, double *y, double *z ); int pj_datum_transform( projPJ src, projPJ dst, long point_count, int point_offset, @@ -128,6 +163,8 @@ projPJ pj_init_ctx( projCtx, int, char ** ); projPJ pj_init_plus_ctx( projCtx, const char * ); char *pj_get_def(projPJ, int); projPJ pj_latlong_from_proj( projPJ ); + + void *pj_malloc(size_t); void pj_dalloc(void *); void *pj_calloc (size_t n, size_t size); @@ -139,8 +176,8 @@ void pj_acquire_lock(void); void pj_release_lock(void); void pj_cleanup_lock(void); -projCtx pj_get_default_ctx(void); -projCtx pj_get_ctx( projPJ ); +int pj_run_selftests (int verbosity); + void pj_set_ctx( projPJ, projCtx ); projCtx pj_ctx_alloc(void); void pj_ctx_free( projCtx ); @@ -168,17 +205,10 @@ char *pj_ctx_fgets(projCtx ctx, char *line, int size, PAFile file); PAFile pj_open_lib(projCtx, const char *, const char *); -int pj_run_selftests (int verbosity); - - -#define PJ_LOG_NONE 0 -#define PJ_LOG_ERROR 1 -#define PJ_LOG_DEBUG_MAJOR 2 -#define PJ_LOG_DEBUG_MINOR 3 #ifdef __cplusplus } #endif #endif /* ndef PROJ_API_H */ - +#endif /* ndef PROJ_API_INCLUDED_FOR_PJ_VERSION_ONLY */ |
