| 26 | } // anonymous namespace |
| 27 | |
| 28 | static PJ_XYZ forward_3d(PJ_LPZ lpz, PJ *P) { |
| 29 | auto Q = static_cast<hgridshiftData*>(P->opaque); |
| 30 | PJ_COORD point = {{0,0,0,0}}; |
| 31 | point.lpz = lpz; |
| 32 | |
| 33 | if ( Q->defer_grid_opening ) { |
| 34 | Q->defer_grid_opening = false; |
| 35 | Q->grids = pj_hgrid_init(P, "grids"); |
| 36 | if ( proj_errno(P) ) { |
| 37 | return proj_coord_error().xyz; |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | if (!Q->grids.empty()) { |
| 42 | /* Only try the gridshift if at least one grid is loaded, |
| 43 | * otherwise just pass the coordinate through unchanged. */ |
| 44 | point.lp = pj_hgrid_apply(P->ctx, Q->grids, point.lp, PJ_FWD); |
| 45 | } |
| 46 | |
| 47 | return point.xyz; |
| 48 | } |
| 49 | |
| 50 | |
| 51 | static PJ_LPZ reverse_3d(PJ_XYZ xyz, PJ *P) { |
no test coverage detected