diff options
Diffstat (limited to 'src/proj_internal.h')
| -rw-r--r-- | src/proj_internal.h | 123 |
1 files changed, 87 insertions, 36 deletions
diff --git a/src/proj_internal.h b/src/proj_internal.h index 79b1da10..32aaa1ec 100644 --- a/src/proj_internal.h +++ b/src/proj_internal.h @@ -33,10 +33,6 @@ #error "proj_internal.h can only be included from a C++ file" #endif -#ifndef ACCEPT_USE_OF_DEPRECATED_PROJ_API_H -#define ACCEPT_USE_OF_DEPRECATED_PROJ_API_H -#endif - #ifdef _MSC_VER # ifndef _CRT_SECURE_NO_DEPRECATE # define _CRT_SECURE_NO_DEPRECATE @@ -66,10 +62,6 @@ #include "proj.h" -#ifdef PROJ_API_H -#error proj_internal.h must be included before proj_api.h -#endif - #ifdef PROJ_RENAME_SYMBOLS #include "proj_symbol_rename.h" #endif @@ -248,8 +240,6 @@ struct PJ_AREA { double north_lat_degree; }; -struct projCtx_t; -typedef struct projCtx_t projCtx_t; /***************************************************************************** @@ -360,7 +350,7 @@ struct PJconsts { **************************************************************************************/ - projCtx_t *ctx = nullptr; + PJ_CONTEXT *ctx = nullptr; const char *descr = nullptr; /* From pj_list.h or individual PJ_*.c file */ paralist *params = nullptr; /* Parameter list */ char *def_full = nullptr; /* Full textual definition (usually 0 - set by proj_pj_info) */ @@ -401,7 +391,7 @@ struct PJconsts { PJ_OPERATOR inv4d = nullptr; PJ_DESTRUCTOR destructor = nullptr; - void (*reassign_context)(PJ*, projCtx_t *) = nullptr; + void (*reassign_context)(PJ*, PJ_CONTEXT*) = nullptr; /************************************************************************************* @@ -626,7 +616,7 @@ struct FACTORS { #define PJD_ERR_INVALID_X_OR_Y -15 #define PJD_ERR_WRONG_FORMAT_DMS_VALUE -16 #define PJD_ERR_NON_CONV_INV_MERI_DIST -17 -#define PJD_ERR_NON_CON_INV_PHI2 -18 +#define PJD_ERR_NON_CONV_SINHPSI2TANPHI -18 #define PJD_ERR_ACOS_ASIN_ARG_TOO_LARGE -19 #define PJD_ERR_TOLERANCE_CONDITION -20 #define PJD_ERR_CONIC_LAT_EQUAL -21 @@ -716,12 +706,11 @@ struct projFileApiCallbackAndData }; /* proj thread context */ -struct projCtx_t { +struct pj_ctx{ int last_errno = 0; int debug_level = 0; void (*logger)(void *, int, const char *) = nullptr; void *logger_app_data = nullptr; - struct projFileAPI_t *fileapi_legacy = nullptr; // for proj_api.h legacy API struct projCppContext* cpp_context = nullptr; /* internal context for C++ code */ int use_proj4_init_rules = -1; /* -1 = unknown, 0 = no, 1 = yes */ int epsg_file_exists = -1; /* -1 = unknown, 0 = no, 1 = yes */ @@ -753,18 +742,18 @@ struct projCtx_t { int pipelineInitRecursiongCounter = 0; // to avoid potential infinite recursion in pipeline.cpp - projCtx_t() = default; - projCtx_t(const projCtx_t&); - ~projCtx_t(); + pj_ctx() = default; + pj_ctx(const pj_ctx&); + ~pj_ctx(); - projCtx_t& operator= (const projCtx_t&) = delete; + pj_ctx& operator= (const pj_ctx&) = delete; projCppContext* get_cpp_context(); void safeAutoCloseDbIfNeeded(); void set_search_paths(const std::vector<std::string>& search_paths_in); void set_ca_bundle_path(const std::string& ca_bundle_path_in); - static projCtx_t createDefault(); + static pj_ctx createDefault(); }; /* Generate pj_list external or make list from include file */ @@ -812,40 +801,41 @@ PJ *pj_projection_specific_setup_##name (PJ *P) /* procedure prototypes */ double PROJ_DLL dmstor(const char *, char **); -double dmstor_ctx(projCtx_t *ctx, const char *, char **); +double dmstor_ctx(PJ_CONTEXT *ctx, const char *, char **); void PROJ_DLL set_rtodms(int, int); char PROJ_DLL *rtodms(char *, double, int, int); double PROJ_DLL adjlon(double); -double aacos(projCtx_t *,double); -double aasin(projCtx_t *,double); +double aacos(PJ_CONTEXT *,double); +double aasin(PJ_CONTEXT *,double); double asqrt(double); double aatan2(double, double); -PROJVALUE PROJ_DLL pj_param(projCtx_t *ctx, paralist *, const char *); +PROJVALUE PROJ_DLL pj_param(PJ_CONTEXT *ctx, paralist *, const char *); paralist PROJ_DLL *pj_param_exists (paralist *list, const char *parameter); paralist PROJ_DLL *pj_mkparam(const char *); paralist *pj_mkparam_ws (const char *str, const char **next_str); -int PROJ_DLL pj_ell_set(projCtx_t *ctx, paralist *, double *, double *); -int pj_datum_set(projCtx_t *,paralist *, PJ *); +int PROJ_DLL pj_ell_set(PJ_CONTEXT *ctx, paralist *, double *, double *); +int pj_datum_set(PJ_CONTEXT *,paralist *, PJ *); int pj_angular_units_set(paralist *, PJ *); paralist *pj_clone_paralist( const paralist* ); paralist *pj_search_initcache( const char *filekey ); void pj_insert_initcache( const char *filekey, const paralist *list); -paralist *pj_expand_init(projCtx_t *ctx, paralist *init); +paralist *pj_expand_init(PJ_CONTEXT *ctx, paralist *init); -void *pj_dealloc_params (projCtx_t *ctx, paralist *start, int errlev); +void *free_params (PJ_CONTEXT *ctx, paralist *start, int errlev); double *pj_enfn(double); double pj_mlfn(double, double, double, const double *); -double pj_inv_mlfn(projCtx_t *, double, double, const double *); +double pj_inv_mlfn(PJ_CONTEXT *, double, double, const double *); double pj_qsfn(double, double, double); double pj_tsfn(double, double, double); double pj_msfn(double, double, double); -double PROJ_DLL pj_phi2(projCtx_t *, const double, const double); +double PROJ_DLL pj_phi2(PJ_CONTEXT *, const double, const double); +double pj_sinhpsi2tanphi(PJ_CONTEXT *, const double, const double); double pj_qsfn_(double, PJ *); double *pj_authset(double); double pj_authlat(double, double *); @@ -858,10 +848,10 @@ int pj_factors(PJ_LP, const PJ *, double, struct FACTORS *); void *proj_mdist_ini(double); double proj_mdist(double, double, double, const void *); -double proj_inv_mdist(projCtx_t *ctx, double, const void *); +double proj_inv_mdist(PJ_CONTEXT *ctx, double, const void *); void *pj_gauss_ini(double, double, double *,double *); -PJ_LP pj_gauss(projCtx_t *, PJ_LP, const void *); -PJ_LP pj_inv_gauss(projCtx_t *, PJ_LP, const void *); +PJ_LP pj_gauss(PJ_CONTEXT *, PJ_LP, const void *); +PJ_LP pj_inv_gauss(PJ_CONTEXT *, PJ_LP, const void *); struct PJ_DATUMS PROJ_DLL *pj_get_datums_ref( void ); @@ -872,7 +862,7 @@ double PROJ_DLL pj_atof( const char* nptr ); double pj_strtod( const char *nptr, char **endptr ); void pj_freeup_plain (PJ *P); -PJ* pj_init_ctx_with_allow_init_epsg( projCtx_t *ctx, int argc, char **argv, int allow_init_epsg ); +PJ* pj_init_ctx_with_allow_init_epsg( PJ_CONTEXT *ctx, int argc, char **argv, int allow_init_epsg ); std::string PROJ_DLL pj_add_type_crs_if_needed(const std::string& str); std::string pj_double_quote_string_param_if_needed(const std::string& str); @@ -909,7 +899,68 @@ void pj_clear_vgridshift_knowngrids_cache(); PJ_LP pj_generic_inverse_2d(PJ_XY xy, PJ *P, PJ_LP lpInitial); -/* classic public API */ -#include "proj_api.h" + + + +/*****************************************************************************/ +/* */ +/* proj_api.h */ +/* */ +/* The rest of this header file includes what used to be "proj_api.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 + +#define RAD_TO_DEG 57.295779513082321 +#define DEG_TO_RAD .017453292519943296 + + + + +extern char const PROJ_DLL pj_release[]; /* global release id string */ + +#ifndef PROJ_INTERNAL_H +/* replaced by enum proj_log_level in proj_internal.h */ +#define PJ_LOG_NONE 0 +#define PJ_LOG_ERROR 1 +#define PJ_LOG_DEBUG_MAJOR 2 +#define PJ_LOG_DEBUG_MINOR 3 +#endif + + +/* procedure prototypes */ + +PJ_CONTEXT PROJ_DLL *pj_get_default_ctx(void); +PJ_CONTEXT *pj_get_ctx( PJ *); + +PJ_XY PROJ_DLL pj_fwd(PJ_LP, PJ *); +PJ_LP PROJ_DLL pj_inv(PJ_XY, PJ *); + +PJ_XYZ pj_fwd3d(PJ_LPZ, PJ *); +PJ_LPZ pj_inv3d(PJ_XYZ, PJ *); + + +void pj_clear_initcache(void); +void PROJ_DLL pj_pr_list(PJ *); /* used by proj.cpp */ +char *pj_get_def(PJ *, int); +int pj_has_inverse(PJ *); + + +char *pj_strdup(const char *str); +const char PROJ_DLL *pj_get_release(void); +void pj_acquire_lock(void); +void pj_release_lock(void); +void pj_cleanup_lock(void); + +void pj_log( PJ_CONTEXT * ctx, int level, const char *fmt, ... ); +void pj_stderr_logger( void *, int, const char * ); + +int pj_find_file(PJ_CONTEXT * ctx, const char *short_filename, + char* out_full_filename, size_t out_full_filename_size); + + #endif /* ndef PROJ_INTERNAL_H */ |
