diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-12-11 17:10:13 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2020-12-15 00:52:51 +0100 |
| commit | 1e9894b0e2b161e61546672bccb85a9ef21df541 (patch) | |
| tree | bfc5a15a95dfdc6b495593113937420a0b88e357 | |
| parent | 0af437949dd002a0f0021f35f20681e653e1f849 (diff) | |
| download | PROJ-1e9894b0e2b161e61546672bccb85a9ef21df541.tar.gz PROJ-1e9894b0e2b161e61546672bccb85a9ef21df541.zip | |
Remove ancient no longer used implementation of pj_ell_set()
| -rw-r--r-- | src/ell_set.cpp | 142 |
1 files changed, 0 insertions, 142 deletions
diff --git a/src/ell_set.cpp b/src/ell_set.cpp index 176fc553..afa962c5 100644 --- a/src/ell_set.cpp +++ b/src/ell_set.cpp @@ -582,9 +582,6 @@ int pj_calc_ellipsoid_params (PJ *P, double a, double es) { return 0; } - - -#ifndef KEEP_ORIGINAL_PJ_ELL_SET /**************************************************************************************/ int pj_ell_set (PJ_CONTEXT *ctx, paralist *pl, double *a, double *es) { /*************************************************************************************** @@ -605,142 +602,3 @@ int pj_ell_set (PJ_CONTEXT *ctx, paralist *pl, double *a, double *es) { *es = B.es; return 0; } -#else - - -/**************************************************************************************/ -int pj_ell_set (PJ_CONTEXT *ctx, paralist *pl, double *a, double *es) { -/*************************************************************************************** - Initialize ellipsoidal parameters: This is the original ellipsoid setup - function by Gerald Evenden - significantly more compact than pj_ellipsoid and - its many helper functions, and still quite readable. - - It is, however, also so tight that it is hard to modify and add functionality, - and equally hard to find the right place to add further commentary for improved - future maintainability. - - Hence, when the need to store in the PJ object, the parameters actually used to - define the ellipsoid came up, rather than modifying this little gem of - "economy of expression", a much more verbose reimplementation, pj_ellipsoid, - was written. -***************************************************************************************/ - int i; - double b=0.0, e; - char *name; - paralist *start = 0; - - /* clear any previous error */ - proj_context_errno_set(ctx,0); - - /* check for varying forms of ellipsoid input */ - *a = *es = 0.; - - /* R takes precedence */ - if (pj_param(ctx, pl, "tR").i) - *a = pj_param(ctx,pl, "dR").f; - - /* probable elliptical figure */ - else { - /* check if ellps present and temporarily append its values to pl */ - if ((name = pj_param(ctx,pl, "sellps").s) != NULL) { - char *s; - - for (start = pl; start && start->next ; start = start->next) ; - for (i = 0; (s = pj_ellps[i].id) && strcmp(name, s) ; ++i) ; - if (!s) { - proj_context_errno_set( ctx, PJD_ERR_UNKNOWN_ELLP_PARAM); - return 1; - } - start->next = pj_mkparam(pj_ellps[i].major); - start->next->next = pj_mkparam(pj_ellps[i].ell); - } - - *a = pj_param(ctx,pl, "da").f; - - if (pj_param(ctx,pl, "tes").i) /* eccentricity squared */ - *es = pj_param(ctx,pl, "des").f; - else if (pj_param(ctx,pl, "te").i) { /* eccentricity */ - e = pj_param(ctx,pl, "de").f; - if (e < 0) { - proj_context_errno_set(ctx, PJD_ERR_INVALID_ECCENTRICITY); - return 1; - } - *es = e * e; - } else if (pj_param(ctx,pl, "trf").i) { /* recip flattening */ - *es = pj_param(ctx,pl, "drf").f; - if (*es == 0.0) { - proj_context_errno_set(ctx, PJD_ERR_REV_FLATTENING_IS_ZERO); - goto bomb; - } - *es = 1./ *es; - *es = *es * (2. - *es); - } else if (pj_param(ctx,pl, "tf").i) { /* flattening */ - *es = pj_param(ctx,pl, "df").f; - *es = *es * (2. - *es); - } else if (pj_param(ctx,pl, "tb").i) { /* minor axis */ - b = pj_param(ctx,pl, "db").f; - *es = 1. - (b * b) / (*a * *a); - } /* else *es == 0. and sphere of radius *a */ - if (b == 0.0) - b = *a * sqrt(1. - *es); - - - /* following options turn ellipsoid into equivalent sphere */ - if (pj_param(ctx,pl, "bR_A").i) { /* sphere--area of ellipsoid */ - *a *= 1. - *es * (SIXTH + *es * (RA4 + *es * RA6)); - *es = 0.; - } else if (pj_param(ctx,pl, "bR_V").i) { /* sphere--vol. of ellipsoid */ - *a *= 1. - *es * (SIXTH + *es * (RV4 + *es * RV6)); - *es = 0.; - } else if (pj_param(ctx,pl, "bR_a").i) { /* sphere--arithmetic mean */ - *a = .5 * (*a + b); - *es = 0.; - } else if (pj_param(ctx,pl, "bR_g").i) { /* sphere--geometric mean */ - *a = sqrt(*a * b); - *es = 0.; - } else if (pj_param(ctx,pl, "bR_h").i) { /* sphere--harmonic mean */ - if ( (*a + b) == 0.0) { - proj_context_errno_set(ctx, PJD_ERR_TOLERANCE_CONDITION); - goto bomb; - } - *a = 2. * *a * b / (*a + b); - *es = 0.; - } else if ((i = pj_param(ctx,pl, "tR_lat_a").i) || /* sphere--arith. */ - pj_param(ctx,pl, "tR_lat_g").i) { /* or geom. mean at latitude */ - double tmp; - - tmp = sin(pj_param(ctx,pl, i ? "rR_lat_a" : "rR_lat_g").f); - if (fabs(tmp) > M_HALFPI) { - proj_context_errno_set(ctx, PJD_ERR_REF_RAD_LARGER_THAN_90); - goto bomb; - } - tmp = 1. - *es * tmp * tmp; - *a *= i ? .5 * (1. - *es + tmp) / ( tmp * sqrt(tmp)) : - sqrt(1. - *es) / tmp; - *es = 0.; - } -bomb: - if (start) { /* clean up temporary extension of list */ - free(start->next->next); - free(start->next); - start->next = 0; - } - if (ctx->last_errno) - return 1; - } - /* some remaining checks */ - if (*es < 0.) { - proj_context_errno_set(ctx, PJD_ERR_ES_LESS_THAN_ZERO); - return 1; - } - if (*es >= 1.) { - proj_context_errno_set(ctx, PJD_ERR_INVALID_ECCENTRICITY); - return 1; - } - if (*a <= 0.) { - proj_context_errno_set(ctx, PJD_ERR_MAJOR_AXIS_NOT_GIVEN); - return 1; - } - return 0; -} -#endif |
