| 3077 | // --------------------------------------------------------------------------- |
| 3078 | |
| 3079 | PJ_LP pj_hgrid_apply(PJ_CONTEXT *ctx, const ListOfHGrids &grids, PJ_LP lp, |
| 3080 | PJ_DIRECTION direction) { |
| 3081 | PJ_LP out; |
| 3082 | |
| 3083 | out.lam = HUGE_VAL; |
| 3084 | out.phi = HUGE_VAL; |
| 3085 | |
| 3086 | while (true) { |
| 3087 | HorizontalShiftGridSet *gridset = nullptr; |
| 3088 | const auto grid = findGrid(grids, lp, gridset); |
| 3089 | if (!grid) { |
| 3090 | proj_context_errno_set(ctx, PROJ_ERR_COORD_TRANSFM_OUTSIDE_GRID); |
| 3091 | return out; |
| 3092 | } |
| 3093 | if (grid->isNullGrid()) { |
| 3094 | return lp; |
| 3095 | } |
| 3096 | |
| 3097 | bool shouldRetry = false; |
| 3098 | out = pj_hgrid_apply_internal(ctx, lp, direction, grid, gridset, grids, |
| 3099 | shouldRetry); |
| 3100 | if (!shouldRetry) { |
| 3101 | break; |
| 3102 | } |
| 3103 | } |
| 3104 | |
| 3105 | if (out.lam == HUGE_VAL || out.phi == HUGE_VAL) |
| 3106 | proj_context_errno_set(ctx, PROJ_ERR_COORD_TRANSFM_OUTSIDE_GRID); |
| 3107 | |
| 3108 | return out; |
| 3109 | } |
| 3110 | |
| 3111 | /********************************************/ |
| 3112 | /* proj_hgrid_value() */ |
no test coverage detected