MCPcopy Create free account
hub / github.com/OSGeo/PROJ / inv_finalize

Function inv_finalize

src/inv.cpp:102–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102static void inv_finalize(PJ *P, PJ_COORD &coo) {
103 if (coo.xyz.x == HUGE_VAL) {
104 proj_errno_set(P, PROJ_ERR_COORD_TRANSFM_OUTSIDE_PROJECTION_DOMAIN);
105 coo = proj_coord_error();
106 }
107
108 if (OUTPUT_UNITS == PJ_IO_UNITS_RADIANS) {
109
110 /* Distance from central meridian, taking system zero meridian into
111 * account
112 */
113 coo.lp.lam = coo.lp.lam + P->from_greenwich + P->lam0;
114
115 /* adjust longitude to central meridian */
116 if (0 == P->over)
117 coo.lpz.lam = adjlon(coo.lpz.lam);
118
119 if (P->vgridshift)
120 coo = proj_trans(P->vgridshift, PJ_INV,
121 coo); /* Go geometric from orthometric */
122 if (coo.lp.lam == HUGE_VAL)
123 return;
124 if (P->hgridshift)
125 coo = proj_trans(P->hgridshift, PJ_FWD, coo);
126 else if (P->helmert ||
127 (P->cart_wgs84 != nullptr && P->cart != nullptr)) {
128 coo = proj_trans(P->cart, PJ_FWD,
129 coo); /* Go cartesian in local frame */
130 if (P->helmert)
131 coo = proj_trans(P->helmert, PJ_FWD, coo); /* Step into WGS84 */
132 coo = proj_trans(P->cart_wgs84, PJ_INV,
133 coo); /* Go back to angular using WGS84 ellps */
134 }
135 if (coo.lp.lam == HUGE_VAL)
136 return;
137
138 /* If input latitude was geocentrical, convert back to geocentrical */
139 if (P->geoc)
140 coo = pj_geocentric_latitude(P, PJ_FWD, coo);
141 }
142}
143
144static inline PJ_COORD error_or_coord(PJ *P, PJ_COORD coord, int last_errno) {
145 if (P->ctx->last_errno)

Callers 3

pj_invFunction · 0.85
pj_inv3dFunction · 0.85
pj_inv4dFunction · 0.85

Calls 5

proj_errno_setFunction · 0.85
proj_coord_errorFunction · 0.85
adjlonFunction · 0.85
proj_transFunction · 0.85
pj_geocentric_latitudeFunction · 0.85

Tested by

no test coverage detected