| 122 | |
| 123 | |
| 124 | PJ *PROJECTION(omerc) { |
| 125 | double con, com, cosph0, D, F, H, L, sinph0, p, J, gamma=0, |
| 126 | gamma0, lamc=0, lam1=0, lam2=0, phi1=0, phi2=0, alpha_c=0; |
| 127 | int alp, gam, no_off = 0; |
| 128 | |
| 129 | struct pj_opaque *Q = static_cast<struct pj_opaque*>(calloc (1, sizeof (struct pj_opaque))); |
| 130 | if (nullptr==Q) |
| 131 | return pj_default_destructor (P, PROJ_ERR_OTHER /*ENOMEM*/); |
| 132 | P->opaque = Q; |
| 133 | |
| 134 | Q->no_rot = pj_param(P->ctx, P->params, "bno_rot").i; |
| 135 | if ((alp = pj_param(P->ctx, P->params, "talpha").i) != 0) |
| 136 | alpha_c = pj_param(P->ctx, P->params, "ralpha").f; |
| 137 | if ((gam = pj_param(P->ctx, P->params, "tgamma").i) != 0) |
| 138 | gamma = pj_param(P->ctx, P->params, "rgamma").f; |
| 139 | if (alp || gam) { |
| 140 | lamc = pj_param(P->ctx, P->params, "rlonc").f; |
| 141 | no_off = |
| 142 | /* For libproj4 compatibility */ |
| 143 | pj_param(P->ctx, P->params, "tno_off").i |
| 144 | /* for backward compatibility */ |
| 145 | || pj_param(P->ctx, P->params, "tno_uoff").i; |
| 146 | if( no_off ) |
| 147 | { |
| 148 | /* Mark the parameter as used, so that the pj_get_def() return them */ |
| 149 | pj_param(P->ctx, P->params, "sno_uoff"); |
| 150 | pj_param(P->ctx, P->params, "sno_off"); |
| 151 | } |
| 152 | } else { |
| 153 | lam1 = pj_param(P->ctx, P->params, "rlon_1").f; |
| 154 | phi1 = pj_param(P->ctx, P->params, "rlat_1").f; |
| 155 | lam2 = pj_param(P->ctx, P->params, "rlon_2").f; |
| 156 | phi2 = pj_param(P->ctx, P->params, "rlat_2").f; |
| 157 | con = fabs(phi1); |
| 158 | |
| 159 | if (fabs(phi1) > M_HALFPI - TOL) |
| 160 | { |
| 161 | proj_log_error(P, _("Invalid value for lat_1: |lat_1| should be < 90°")); |
| 162 | return pj_default_destructor(P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); |
| 163 | } |
| 164 | if (fabs(phi2) > M_HALFPI - TOL) |
| 165 | { |
| 166 | proj_log_error(P, _("Invalid value for lat_2: |lat_2| should be < 90°")); |
| 167 | return pj_default_destructor(P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); |
| 168 | } |
| 169 | |
| 170 | if (fabs(phi1 - phi2) <= TOL ) |
| 171 | { |
| 172 | proj_log_error(P, _("Invalid value for lat_1/lat_2: lat_1 should be different from lat_2")); |
| 173 | return pj_default_destructor(P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); |
| 174 | } |
| 175 | |
| 176 | if (con <= TOL ) |
| 177 | { |
| 178 | proj_log_error(P, _("Invalid value for lat_1: lat_1 should be different from 0")); |
| 179 | return pj_default_destructor(P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); |
| 180 | } |
| 181 |
nothing calls this directly
no test coverage detected