|
| 1 | +/****************************************************************************** |
| 2 | + * $Id: proj_api.h 2160 2012-02-15 23:51:45Z warmerdam $ |
| 3 | + * |
| 4 | + * Project: PROJ.4 |
| 5 | + * Purpose: Public (application) include file for PROJ.4 API, and constants. |
| 6 | + * Author: Frank Warmerdam, <[email protected]> |
| 7 | + * |
| 8 | + ****************************************************************************** |
| 9 | + * Copyright (c) 2001, Frank Warmerdam <[email protected]> |
| 10 | + * |
| 11 | + * Permission is hereby granted, free of charge, to any person obtaining a |
| 12 | + * copy of this software and associated documentation files (the "Software"), |
| 13 | + * to deal in the Software without restriction, including without limitation |
| 14 | + * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 15 | + * and/or sell copies of the Software, and to permit persons to whom the |
| 16 | + * Software is furnished to do so, subject to the following conditions: |
| 17 | + * |
| 18 | + * The above copyright notice and this permission notice shall be included |
| 19 | + * in all copies or substantial portions of the Software. |
| 20 | + * |
| 21 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 22 | + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 23 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 24 | + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 25 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 26 | + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 27 | + * DEALINGS IN THE SOFTWARE. |
| 28 | + *****************************************************************************/ |
| 29 | + |
| 30 | +/* General projections header file */ |
| 31 | +#ifndef PROJ_API_H |
| 32 | +#define PROJ_API_H |
| 33 | + |
| 34 | +/* standard inclusions */ |
| 35 | +#include <math.h> |
| 36 | +#include <stdlib.h> |
| 37 | + |
| 38 | +#ifdef __cplusplus |
| 39 | +extern "C" { |
| 40 | +#endif |
| 41 | + |
| 42 | +/* Try to update this every version! */ |
| 43 | +#define PJ_VERSION 480 |
| 44 | + |
| 45 | +extern char const pj_release[]; /* global release id string */ |
| 46 | + |
| 47 | +#define RAD_TO_DEG 57.29577951308232 |
| 48 | +#define DEG_TO_RAD .0174532925199432958 |
| 49 | + |
| 50 | + |
| 51 | +extern int pj_errno; /* global error return code */ |
| 52 | + |
| 53 | +#if !defined(PROJECTS_H) |
| 54 | + typedef struct { double u, v; } projUV; |
| 55 | + typedef void *projPJ; |
| 56 | + #define projXY projUV |
| 57 | + #define projLP projUV |
| 58 | + typedef void *projCtx; |
| 59 | +#else |
| 60 | + typedef PJ *projPJ; |
| 61 | + typedef projCtx_t *projCtx; |
| 62 | +# define projXY XY |
| 63 | +# define projLP LP |
| 64 | +#endif |
| 65 | + |
| 66 | +/* procedure prototypes */ |
| 67 | + |
| 68 | +projXY pj_fwd(projLP, projPJ); |
| 69 | +projLP pj_inv(projXY, projPJ); |
| 70 | + |
| 71 | +int pj_transform( projPJ src, projPJ dst, long point_count, int point_offset, |
| 72 | + double *x, double *y, double *z ); |
| 73 | +int pj_datum_transform( projPJ src, projPJ dst, long point_count, int point_offset, |
| 74 | + double *x, double *y, double *z ); |
| 75 | +int pj_geocentric_to_geodetic( double a, double es, |
| 76 | + long point_count, int point_offset, |
| 77 | + double *x, double *y, double *z ); |
| 78 | +int pj_geodetic_to_geocentric( double a, double es, |
| 79 | + long point_count, int point_offset, |
| 80 | + double *x, double *y, double *z ); |
| 81 | +int pj_compare_datums( projPJ srcdefn, projPJ dstdefn ); |
| 82 | +int pj_apply_gridshift( projCtx, const char *, int, |
| 83 | + long point_count, int point_offset, |
| 84 | + double *x, double *y, double *z ); |
| 85 | +void pj_deallocate_grids(void); |
| 86 | +void pj_clear_initcache(void); |
| 87 | +int pj_is_latlong(projPJ); |
| 88 | +int pj_is_geocent(projPJ); |
| 89 | +void pj_get_spheroid_defn(projPJ defn, double *major_axis, double *eccentricity_squared); |
| 90 | +void pj_pr_list(projPJ); |
| 91 | +void pj_free(projPJ); |
| 92 | +void pj_set_finder( const char *(*)(const char *) ); |
| 93 | +void pj_set_searchpath ( int count, const char **path ); |
| 94 | +projPJ pj_init(int, char **); |
| 95 | +projPJ pj_init_plus(const char *); |
| 96 | +projPJ pj_init_ctx( projCtx, int, char ** ); |
| 97 | +projPJ pj_init_plus_ctx( projCtx, const char * ); |
| 98 | +char *pj_get_def(projPJ, int); |
| 99 | +projPJ pj_latlong_from_proj( projPJ ); |
| 100 | +void *pj_malloc(size_t); |
| 101 | +void pj_dalloc(void *); |
| 102 | +char *pj_strerrno(int); |
| 103 | +int *pj_get_errno_ref(void); |
| 104 | +const char *pj_get_release(void); |
| 105 | +void pj_acquire_lock(void); |
| 106 | +void pj_release_lock(void); |
| 107 | +void pj_cleanup_lock(void); |
| 108 | + |
| 109 | +projCtx pj_get_default_ctx(void); |
| 110 | +projCtx pj_get_ctx( projPJ ); |
| 111 | +void pj_set_ctx( projPJ, projCtx ); |
| 112 | +projCtx pj_ctx_alloc(void); |
| 113 | +void pj_ctx_free( projCtx ); |
| 114 | +int pj_ctx_get_errno( projCtx ); |
| 115 | +void pj_ctx_set_errno( projCtx, int ); |
| 116 | +void pj_ctx_set_debug( projCtx, int ); |
| 117 | +void pj_ctx_set_logger( projCtx, void (*)(void *, int, const char *) ); |
| 118 | +void pj_ctx_set_app_data( projCtx, void * ); |
| 119 | +void *pj_ctx_get_app_data( projCtx ); |
| 120 | + |
| 121 | +void pj_log( projCtx ctx, int level, const char *fmt, ... ); |
| 122 | +void pj_stderr_logger( void *, int, const char * ); |
| 123 | + |
| 124 | +#define PJ_LOG_NONE 0 |
| 125 | +#define PJ_LOG_ERROR 1 |
| 126 | +#define PJ_LOG_DEBUG_MAJOR 2 |
| 127 | +#define PJ_LOG_DEBUG_MINOR 3 |
| 128 | + |
| 129 | +#ifdef __cplusplus |
| 130 | +} |
| 131 | +#endif |
| 132 | + |
| 133 | +#endif /* ndef PROJ_API_H */ |
| 134 | + |
0 commit comments