void GeoConvHelper::cartesian2geo(Position& cartesian) const { cartesian.sub(getOffsetBase()); if (myProjectionMethod == NONE) { return; } if (myProjectionMethod == SIMPLE) { const double y = cartesian.y() / 111136.; const double x = cartesian.x() / 111320. / cos(DEG2RAD(y)); cartesian.set(x, y); return; } #ifdef PROJ_API_FILE #ifdef PROJ_VERSION_MAJOR PJ_COORD c; c.xy.x = cartesian.x(); c.xy.y = cartesian.y(); c = proj_trans(myProjection, PJ_INV, c); cartesian.set(proj_todeg(c.lp.lam), proj_todeg(c.lp.phi)); #else projUV p; p.u = cartesian.x(); p.v = cartesian.y(); p = pj_inv(p, myProjection); //!!! check pj_errno p.u *= RAD_TO_DEG; p.v *= RAD_TO_DEG; cartesian.set((double) p.u, (double) p.v); #endif #endif }
void GeoConvHelper::cartesian2geo(Position& cartesian) const { cartesian.sub(getOffsetBase()); if (myProjectionMethod == NONE) { return; } #ifdef HAVE_PROJ projUV p; p.u = cartesian.x(); p.v = cartesian.y(); p = pj_inv(p, myProjection); //!!! check pj_errno p.u *= RAD_TO_DEG; p.v *= RAD_TO_DEG; cartesian.set((SUMOReal) p.u, (SUMOReal) p.v); #endif }