diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2022-01-07 15:32:12 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2022-01-07 16:49:11 +0100 |
| commit | cf5aef989b65ed857ed03d2ed3de447daaffe5a3 (patch) | |
| tree | 5f0c24402ae21cf1eab3ba7b90b89c98651a4a7f /src/projections | |
| parent | a03d3c16222ed4aed121d26bdf6db5fbf72ddeb0 (diff) | |
| download | PROJ-cf5aef989b65ed857ed03d2ed3de447daaffe5a3.tar.gz PROJ-cf5aef989b65ed857ed03d2ed3de447daaffe5a3.zip | |
peirce_q: rename +type parameter wrongly introduced in 8.2.1 to +shape (fixes #3011)
Diffstat (limited to 'src/projections')
| -rw-r--r-- | src/projections/adams.cpp | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/src/projections/adams.cpp b/src/projections/adams.cpp index 4150fff2..f991e7c2 100644 --- a/src/projections/adams.cpp +++ b/src/projections/adams.cpp @@ -60,7 +60,7 @@ enum projection_type { ADAMS_WS2, }; -enum peirce_type { +enum peirce_shape { PEIRCE_Q_SQUARE, PEIRCE_Q_DIAMOND, PEIRCE_Q_NHEMISPHERE, @@ -71,7 +71,7 @@ enum peirce_type { struct pj_opaque { projection_type mode; - peirce_type pqtype; + peirce_shape pqshape; double scrollx = 0.0; double scrolly = 0.0; }; @@ -143,13 +143,13 @@ static PJ_XY adams_forward(PJ_LP lp, PJ *P) { break; case PEIRCE_Q: { /* lam0 - note that the original Peirce model used a central meridian of around -70deg, but the default within proj is +lon0=0 */ - if (Q->pqtype == PEIRCE_Q_NHEMISPHERE) { + if (Q->pqshape == PEIRCE_Q_NHEMISPHERE) { if( lp.phi < -TOL ) { proj_errno_set(P, PROJ_ERR_COORD_TRANSFM_OUTSIDE_PROJECTION_DOMAIN); return proj_coord_error().xy; } } - if (Q->pqtype == PEIRCE_Q_SHEMISPHERE) { + if (Q->pqshape == PEIRCE_Q_SHEMISPHERE) { if( lp.phi > -TOL ) { proj_errno_set(P, PROJ_ERR_COORD_TRANSFM_OUTSIDE_PROJECTION_DOMAIN); return proj_coord_error().xy; @@ -211,7 +211,7 @@ static PJ_XY adams_forward(PJ_LP lp, PJ *P) { constexpr double shd = 1.8540746773013719 * 2; /* For square and diamond Quincuncial projections, spin out southern hemisphere to triangular segments of quincunx (before rotation for square)*/ - if( Q->pqtype == PEIRCE_Q_SQUARE || ( Q->pqtype == PEIRCE_Q_DIAMOND )) { + if( Q->pqshape == PEIRCE_Q_SQUARE || ( Q->pqshape == PEIRCE_Q_DIAMOND )) { if (lp.phi < 0.) { /* fold out segments */ if (lp.lam < ( -0.75 * M_PI )) xy.y = shd - xy.y; /* top left segment, shift up and reflect y */ if ( (lp.lam < (-0.25 * M_PI)) && (lp.lam >= ( -0.75 * M_PI ))) xy.x = - shd - xy.x; /* left segment, shift left and reflect x */ @@ -222,20 +222,20 @@ static PJ_XY adams_forward(PJ_LP lp, PJ *P) { } /* For square types rotate xy by 45 deg */ - if( Q->pqtype == PEIRCE_Q_SQUARE ) { + if( Q->pqshape == PEIRCE_Q_SQUARE ) { const double temp = xy.x; xy.x = RSQRT2 * (xy.x - xy.y); xy.y = RSQRT2 * (temp + xy.y); } /* For rectangle Quincuncial projs, spin out southern hemisphere to east (horizontal) or north (vertical) after rotation */ - if( Q->pqtype == PEIRCE_Q_HORIZONTAL ) { + if( Q->pqshape == PEIRCE_Q_HORIZONTAL ) { if (lp.phi < 0.) { xy.x = shd - xy.x; /* reflect x to east */ } xy.x = xy.x - (shd / 2); /* shift everything so origin is in middle of two hemispheres */ } - if( Q->pqtype == PEIRCE_Q_VERTICAL ) { + if( Q->pqshape == PEIRCE_Q_VERTICAL ) { if (lp.phi < 0.) { xy.y = shd - xy.y; /* reflect y to north */ } @@ -243,7 +243,7 @@ static PJ_XY adams_forward(PJ_LP lp, PJ *P) { } //if o_scrollx param present, scroll x - if (!(Q->scrollx == 0.0) && (Q->pqtype == PEIRCE_Q_HORIZONTAL) ) { + if (!(Q->scrollx == 0.0) && (Q->pqshape == PEIRCE_Q_HORIZONTAL) ) { double xscale = 2.0; double xthresh = shd / 2; xy.x = xy.x + (Q->scrollx * (xthresh * 2 * xscale)); /*shift relative to proj width*/ @@ -256,7 +256,7 @@ static PJ_XY adams_forward(PJ_LP lp, PJ *P) { } //if o_scrolly param present, scroll y - if (!(Q->scrolly == 0.0) && (Q->pqtype == PEIRCE_Q_VERTICAL)) { + if (!(Q->scrolly == 0.0) && (Q->pqshape == PEIRCE_Q_VERTICAL)) { double yscale = 2.0; double ythresh = shd / 2; xy.y = xy.y + (Q->scrolly * (ythresh * 2 * yscale)); /*shift relative to proj height*/ @@ -316,25 +316,25 @@ static PJ *setup(PJ *P, projection_type mode) { P->inv = adams_inverse; if( mode == PEIRCE_Q) { - // Quincuncial projections type options: square, diamond, hemisphere, horizontal (rectangle) or vertical (rectangle) - const char* pqtype = pj_param (P->ctx, P->params, "stype").s; + // Quincuncial projections shape options: square, diamond, hemisphere, horizontal (rectangle) or vertical (rectangle) + const char* pqshape = pj_param (P->ctx, P->params, "sshape").s; - if (!pqtype) pqtype = "diamond"; /* default if type value not supplied */ + if (!pqshape) pqshape = "diamond"; /* default if shape value not supplied */ - if (strcmp(pqtype, "square") == 0) { - Q->pqtype = PEIRCE_Q_SQUARE; + if (strcmp(pqshape, "square") == 0) { + Q->pqshape = PEIRCE_Q_SQUARE; } - else if (strcmp(pqtype, "diamond") == 0) { - Q->pqtype = PEIRCE_Q_DIAMOND; + else if (strcmp(pqshape, "diamond") == 0) { + Q->pqshape = PEIRCE_Q_DIAMOND; } - else if (strcmp(pqtype, "nhemisphere") == 0) { - Q->pqtype = PEIRCE_Q_NHEMISPHERE; + else if (strcmp(pqshape, "nhemisphere") == 0) { + Q->pqshape = PEIRCE_Q_NHEMISPHERE; } - else if (strcmp(pqtype, "shemisphere") == 0) { - Q->pqtype = PEIRCE_Q_SHEMISPHERE; + else if (strcmp(pqshape, "shemisphere") == 0) { + Q->pqshape = PEIRCE_Q_SHEMISPHERE; } - else if (strcmp(pqtype, "horizontal") == 0) { - Q->pqtype = PEIRCE_Q_HORIZONTAL; + else if (strcmp(pqshape, "horizontal") == 0) { + Q->pqshape = PEIRCE_Q_HORIZONTAL; if (pj_param(P->ctx, P->params, "tscrollx").i) { double scrollx; scrollx = pj_param(P->ctx, P->params, "dscrollx").f; @@ -345,8 +345,8 @@ static PJ *setup(PJ *P, projection_type mode) { Q->scrollx = scrollx; } } - else if (strcmp(pqtype, "vertical") == 0) { - Q->pqtype = PEIRCE_Q_VERTICAL; + else if (strcmp(pqshape, "vertical") == 0) { + Q->pqshape = PEIRCE_Q_VERTICAL; if (pj_param(P->ctx, P->params, "tscrolly").i) { double scrolly; scrolly = pj_param(P->ctx, P->params, "dscrolly").f; @@ -358,7 +358,7 @@ static PJ *setup(PJ *P, projection_type mode) { } } else { - proj_log_error (P, _("peirce_q: invalid value for 'type' parameter")); + proj_log_error (P, _("peirce_q: invalid value for 'shape' parameter")); return pj_default_destructor (P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } |
