From cf9401abeeb15be0d4d886e4aabbce6c19245fd2 Mon Sep 17 00:00:00 2001 From: Kristian Evers Date: Wed, 6 Sep 2017 16:31:02 +0200 Subject: Add PJ_FACTORS bit flags to proj.h --- src/proj.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/proj.h') diff --git a/src/proj.h b/src/proj.h index 1d6191fd..3b4a1a67 100644 --- a/src/proj.h +++ b/src/proj.h @@ -304,6 +304,10 @@ struct PJ_FACTORS { int code; /* info as to analytics, see following */ }; +#define PJ_IS_ANAL_XL_YL 01 /* derivatives of lon analytic */ +#define PJ_IS_ANAL_XP_YP 02 /* derivatives of lat analytic */ +#define PJ_IS_ANAL_HK 04 /* h and k analytic */ +#define PJ_IS_ANAL_CONV 010 /* convergence analytic */ struct PJ_INFO { char release[64]; /* Release info. Version + date */ -- cgit v1.2.3 From fe86f34556dfc4613347c41bb14e8ac025282627 Mon Sep 17 00:00:00 2001 From: Kristian Evers Date: Wed, 13 Sep 2017 11:57:03 +0200 Subject: Add typedef for transformation direction enum --- src/proj.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/proj.h') diff --git a/src/proj.h b/src/proj.h index 3b4a1a67..c2eb3523 100644 --- a/src/proj.h +++ b/src/proj.h @@ -367,35 +367,35 @@ PJ *proj_destroy (PJ *P); /* Apply transformation to observation - in forward or inverse direction */ -enum proj_direction { +enum PJ_DIRECTION { PJ_FWD = 1, /* Forward */ PJ_IDENT = 0, /* Do nothing */ PJ_INV = -1 /* Inverse */ }; +typedef enum PJ_DIRECTION PJ_DIRECTION; - -PJ_OBS proj_trans_obs (PJ *P, enum proj_direction direction, PJ_OBS obs); -PJ_COORD proj_trans_coord (PJ *P, enum proj_direction direction, PJ_COORD coord); +PJ_OBS proj_trans_obs (PJ *P, PJ_DIRECTION direction, PJ_OBS obs); +PJ_COORD proj_trans_coord (PJ *P, PJ_DIRECTION direction, PJ_COORD coord); size_t proj_transform ( PJ *P, - enum proj_direction direction, + PJ_DIRECTION direction, double *x, size_t sx, size_t nx, double *y, size_t sy, size_t ny, double *z, size_t sz, size_t nz, double *t, size_t st, size_t nt ); -int proj_transform_obs (PJ *P, enum proj_direction direction, size_t n, PJ_OBS *obs); -int proj_transform_coord (PJ *P, enum proj_direction direction, size_t n, PJ_COORD *coord); +int proj_transform_obs (PJ *P, PJ_DIRECTION direction, size_t n, PJ_OBS *obs); +int proj_transform_coord (PJ *P, PJ_DIRECTION direction, size_t n, PJ_COORD *coord); /* Initializers */ PJ_COORD proj_coord (double x, double y, double z, double t); PJ_OBS proj_obs (double x, double y, double z, double t, double o, double p, double k, int id, unsigned int flags); /* Measure internal consistency - in forward or inverse direction */ -double proj_roundtrip (PJ *P, enum proj_direction direction, int n, PJ_OBS obs); +double proj_roundtrip (PJ *P, PJ_DIRECTION direction, int n, PJ_OBS obs); /* Geodesic distance between two points with angular 2D coordinates */ double proj_lp_dist (PJ *P, LP a, LP b); -- cgit v1.2.3 From e2faff822f2161d1a45b515d71edde54a19c48cb Mon Sep 17 00:00:00 2001 From: Kristian Evers Date: Wed, 13 Sep 2017 13:05:04 +0200 Subject: make PJ* P argument of proj_lp_dist const --- src/proj.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/proj.h') diff --git a/src/proj.h b/src/proj.h index c2eb3523..943c500f 100644 --- a/src/proj.h +++ b/src/proj.h @@ -398,7 +398,7 @@ PJ_OBS proj_obs (double x, double y, double z, double t, double o, double p, double proj_roundtrip (PJ *P, PJ_DIRECTION direction, int n, PJ_OBS obs); /* Geodesic distance between two points with angular 2D coordinates */ -double proj_lp_dist (PJ *P, LP a, LP b); +double proj_lp_dist (const PJ *P, LP a, LP b); /* Euclidean distance between two points with linear 2D coordinates */ double proj_xy_dist (XY a, XY b); @@ -415,8 +415,8 @@ void proj_errno_restore (PJ *P, int err); PJ_DERIVS proj_derivatives(const PJ *P, const LP lp); -PJ_FACTORS proj_factors(const PJ *P, const LP lp); - +PJ_FACTORS proj_factors(const PJ *P, const LP lp); + /* Info functions - get information about various PROJ.4 entities */ PJ_INFO proj_info(void); PJ_PROJ_INFO proj_pj_info(const PJ *P); -- cgit v1.2.3 From 6b07474e9427d53134e77f0bdf3ced7812d080c4 Mon Sep 17 00:00:00 2001 From: Kristian Evers Date: Wed, 13 Sep 2017 13:27:14 +0200 Subject: Introduce PJ_DEFAULT_CTX constant that improves code readability --- src/proj.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/proj.h') diff --git a/src/proj.h b/src/proj.h index 943c500f..badde4cc 100644 --- a/src/proj.h +++ b/src/proj.h @@ -355,10 +355,12 @@ typedef struct projCtx_t PJ_CONTEXT; /* Functionality for handling thread contexts */ +#define PJ_DEFAULT_CTX 0 PJ_CONTEXT *proj_context_create (void); void proj_context_destroy (PJ_CONTEXT *ctx); + /* Manage the transformation definition object PJ */ PJ *proj_create (PJ_CONTEXT *ctx, const char *definition); PJ *proj_create_argv (PJ_CONTEXT *ctx, int argc, char **argv); -- cgit v1.2.3 From 9755994609973ee5325530052a241f85469da864 Mon Sep 17 00:00:00 2001 From: Kristian Evers Date: Wed, 13 Sep 2017 13:41:00 +0200 Subject: Make proj_destroy and proj_context_destroy behave in the same way. --- src/proj.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/proj.h') diff --git a/src/proj.h b/src/proj.h index badde4cc..e1990e34 100644 --- a/src/proj.h +++ b/src/proj.h @@ -357,7 +357,7 @@ typedef struct projCtx_t PJ_CONTEXT; /* Functionality for handling thread contexts */ #define PJ_DEFAULT_CTX 0 PJ_CONTEXT *proj_context_create (void); -void proj_context_destroy (PJ_CONTEXT *ctx); +PJ_CONTEXT *proj_context_destroy (PJ_CONTEXT *ctx); -- cgit v1.2.3 From 33175ead05bf03853ab8a33372602160cf69d745 Mon Sep 17 00:00:00 2001 From: Kristian Evers Date: Thu, 21 Sep 2017 21:10:07 +0200 Subject: Use FACTORS and DERIVS structs from projects.h instead of duplicating them in proj.h --- src/proj.h | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) (limited to 'src/proj.h') diff --git a/src/proj.h b/src/proj.h index e1990e34..140ba320 100644 --- a/src/proj.h +++ b/src/proj.h @@ -182,11 +182,11 @@ typedef union PJ_TRIPLET PJ_TRIPLET; union PJ_COORD; typedef union PJ_COORD PJ_COORD; -struct PJ_DERIVS; -typedef struct PJ_DERIVS PJ_DERIVS; +struct DERIVS; +typedef struct DERIVS PJ_DERIVS; -struct PJ_FACTORS; -typedef struct PJ_FACTORS PJ_FACTORS; +struct FACTORS; +typedef struct FACTORS PJ_FACTORS; /* Data type for projection/transformation information */ struct PJconsts; @@ -288,22 +288,6 @@ struct PJ_OBS { unsigned int flags; /* additional data, intended for flags */ }; - -struct PJ_DERIVS { - double x_l, x_p; /* derivatives of x for lambda-phi */ - double y_l, y_p; /* derivatives of y for lambda-phi */ -}; - -struct PJ_FACTORS { - struct PJ_DERIVS der; - double h, k; /* meridional, parallel scales */ - double omega, thetap; /* angular distortion, theta prime */ - double conv; /* convergence */ - double s; /* areal scale factor */ - double a, b; /* max-min scale error */ - int code; /* info as to analytics, see following */ -}; - #define PJ_IS_ANAL_XL_YL 01 /* derivatives of lon analytic */ #define PJ_IS_ANAL_XP_YP 02 /* derivatives of lat analytic */ #define PJ_IS_ANAL_HK 04 /* h and k analytic */ -- cgit v1.2.3 From dd12554da8979e47be1eb1b8654c980865da654d Mon Sep 17 00:00:00 2001 From: Kristian Evers Date: Thu, 21 Sep 2017 21:18:59 +0200 Subject: Changed a few occurences of 'const PJ*' to just 'PJ*' since they were making promises that couldn't be kept --- src/proj.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/proj.h') diff --git a/src/proj.h b/src/proj.h index 140ba320..d344485d 100644 --- a/src/proj.h +++ b/src/proj.h @@ -400,12 +400,12 @@ int proj_errno_reset (PJ *P); void proj_errno_restore (PJ *P, int err); -PJ_DERIVS proj_derivatives(const PJ *P, const LP lp); -PJ_FACTORS proj_factors(const PJ *P, const LP lp); +PJ_DERIVS proj_derivatives(PJ *P, const LP lp); +PJ_FACTORS proj_factors(PJ *P, const LP lp); /* Info functions - get information about various PROJ.4 entities */ PJ_INFO proj_info(void); -PJ_PROJ_INFO proj_pj_info(const PJ *P); +PJ_PROJ_INFO proj_pj_info(PJ *P); PJ_GRID_INFO proj_grid_info(const char *gridname); PJ_INIT_INFO proj_init_info(const char *initname); -- cgit v1.2.3 From 6fb79f304faec4d036ea46f19aa197e8cc85fe2e Mon Sep 17 00:00:00 2001 From: Kristian Evers Date: Fri, 22 Sep 2017 08:51:43 +0200 Subject: Add 'expected accuracy' member to PJ_PROJ_INFO struct. --- src/proj.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/proj.h') diff --git a/src/proj.h b/src/proj.h index d344485d..600d5b30 100644 --- a/src/proj.h +++ b/src/proj.h @@ -305,10 +305,11 @@ struct PJ_INFO { }; struct PJ_PROJ_INFO { - char id[16]; /* Name of the projection in question */ - char description[128]; /* Description of the projection */ - char definition[512]; /* Projection definition */ - int has_inverse; /* 1 if an inverse mapping exists, 0 otherwise */ + char id[16]; /* Name of the projection in question */ + char description[128]; /* Description of the projection */ + char definition[512]; /* Projection definition */ + int has_inverse; /* 1 if an inverse mapping exists, 0 otherwise */ + double accuracy; /* Expected accuracy of the transformation. -1 if unknown. */ }; struct PJ_GRID_INFO { -- cgit v1.2.3 From efa741bafb0f40d4d7b7f9138292f15965ed5d75 Mon Sep 17 00:00:00 2001 From: Thomas Knudsen Date: Fri, 6 Oct 2017 22:21:55 +0200 Subject: Switch proj_roundtrip to accept PJ_COORD, rather than PJ_OBS, and make it do proper geodesic distances for forward roundtrips --- src/proj.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/proj.h') diff --git a/src/proj.h b/src/proj.h index 600d5b30..167fb1eb 100644 --- a/src/proj.h +++ b/src/proj.h @@ -382,8 +382,8 @@ PJ_COORD proj_coord (double x, double y, double z, double t); PJ_OBS proj_obs (double x, double y, double z, double t, double o, double p, double k, int id, unsigned int flags); /* Measure internal consistency - in forward or inverse direction */ -double proj_roundtrip (PJ *P, PJ_DIRECTION direction, int n, PJ_OBS obs); - +double proj_roundtrip (PJ *P, PJ_DIRECTION direction, int n, PJ_COORD coo); + /* Geodesic distance between two points with angular 2D coordinates */ double proj_lp_dist (const PJ *P, LP a, LP b); -- cgit v1.2.3 From 8fc250a04edbfe81b9b7409187887066baeba29b Mon Sep 17 00:00:00 2001 From: Kristian Evers Date: Mon, 9 Oct 2017 11:42:02 +0200 Subject: Add proj_list_* functions that exposes various internal lists (#579) Fixes #173, #187 and #220 --- src/proj.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/proj.h') diff --git a/src/proj.h b/src/proj.h index 167fb1eb..049daf19 100644 --- a/src/proj.h +++ b/src/proj.h @@ -205,6 +205,23 @@ typedef struct PJ_GRID_INFO PJ_GRID_INFO; struct PJ_INIT_INFO; typedef struct PJ_INIT_INFO PJ_INIT_INFO; +/* Data types for list of operations, ellipsoids, datums and units used in PROJ.4 */ +struct PJ_LIST; +typedef struct PJ_LIST PJ_OPERATIONS; + +struct PJ_ELLPS; +typedef struct PJ_ELLPS PJ_ELLPS; + +struct PJ_DATUMS; +typedef struct PJ_DATUMS PJ_DATUMS; + +struct PJ_UNITS; +typedef struct PJ_UNITS PJ_UNITS; + +struct PJ_PRIME_MERIDIANS; +typedef struct PJ_PRIME_MERIDIANS PJ_PRIME_MERIDIANS; + + /* Omega, Phi, Kappa: Rotations */ typedef struct {double o, p, k;} PJ_OPK; @@ -410,6 +427,12 @@ PJ_PROJ_INFO proj_pj_info(PJ *P); PJ_GRID_INFO proj_grid_info(const char *gridname); PJ_INIT_INFO proj_init_info(const char *initname); +/* List functions: */ +/* Get lists of operations, ellipsoids, units and prime meridians. */ +const PJ_OPERATIONS *proj_list_operations(void); +const PJ_ELLPS *proj_list_ellps(void); +const PJ_UNITS *proj_list_units(void); +const PJ_PRIME_MERIDIANS *proj_list_prime_meridians(void); /* These are trivial, and while occasionaly useful in real code, primarily here to */ /* simplify demo code, and in acknowledgement of the proj-internal discrepancy between */ -- cgit v1.2.3