| 51 | } |
| 52 | |
| 53 | static PJ_LPZ pj_hgridshift_reverse_3d(PJ_XYZ xyz, PJ *P) { |
| 54 | auto Q = static_cast<hgridshiftData *>(P->opaque); |
| 55 | PJ_COORD point = {{0, 0, 0, 0}}; |
| 56 | point.xyz = xyz; |
| 57 | |
| 58 | if (Q->defer_grid_opening) { |
| 59 | Q->defer_grid_opening = false; |
| 60 | Q->grids = pj_hgrid_init(P, "grids"); |
| 61 | Q->error_code_in_defer_grid_opening = proj_errno(P); |
| 62 | } |
| 63 | if (Q->error_code_in_defer_grid_opening) { |
| 64 | proj_errno_set(P, Q->error_code_in_defer_grid_opening); |
| 65 | return proj_coord_error().lpz; |
| 66 | } |
| 67 | |
| 68 | if (!Q->grids.empty()) { |
| 69 | /* Only try the gridshift if at least one grid is loaded, |
| 70 | * otherwise just pass the coordinate through unchanged. */ |
| 71 | point.lp = pj_hgrid_apply(P->ctx, Q->grids, point.lp, PJ_INV); |
| 72 | } |
| 73 | |
| 74 | return point.lpz; |
| 75 | } |
| 76 | |
| 77 | static void pj_hgridshift_forward_4d(PJ_COORD &coo, PJ *P) { |
| 78 | struct hgridshiftData *Q = (struct hgridshiftData *)P->opaque; |
no test coverage detected