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