Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Backports:SLE-15-SP4
XyGrib
projection.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File projection.diff of Package XyGrib
diff --git a/src/map/Projection_libproj.cpp b/src/map/Projection_libproj.cpp index 1dcbd540..0299714e 100644 --- a/src/map/Projection_libproj.cpp +++ b/src/map/Projection_libproj.cpp @@ -93,9 +93,9 @@ void Projection_libproj::setProjection(int code) params[nbpar++] = "no_defs"; params[nbpar++] = "over"; // allow longitude > 180° // XXX ouch pj_init - libProj = pj_init(nbpar, (char **)params); + libProj = proj_create_argv(PJ_DEFAULT_CTX, nbpar, (char **)params); if (!libProj) - printf("proj error: %s\n", pj_strerrno(pj_errno)); + printf("proj error: %s\n", proj_errno_string(proj_errno(libProj))); assert(libProj); currentProj = code; // libProj->over = 1; // allow longitude > 180° @@ -106,23 +106,23 @@ void Projection_libproj::setProjection(int code) Projection_libproj::~Projection_libproj() { if (libProj != nullptr) { - pj_free(libProj); + proj_destroy(libProj); } } //------------------------------------------------------------------------------- void Projection_libproj::map2screen(double x, double y, int *i, int *j) const { - projUV data, res; + PJ_COORD data, res; if (y <= -90.0) y = -90.0+1e-5; if (y >= 90.0) y = 90.0-1e-5; - data.v = y * DEG_TO_RAD; - data.u = x * DEG_TO_RAD; - res = pj_fwd(data, libProj); - *i = (int) (W/2.0 + scale * (res.u/111319.0-CX) + 0.5); - *j = (int) (H/2.0 - scale * (res.v/111319.0-CY) + 0.5); + data.uv.v = y; + data.uv.u = x; + res = proj_trans(libProj, PJ_FWD, data); + *i = (int) (W/2.0 + scale * (res.uv.u/111319.0-CX) + 0.5); + *j = (int) (H/2.0 - scale * (res.uv.v/111319.0-CY) + 0.5); //printf("PROJ map2screen (%f %f) -> (%3d %3d)\n", x,y, *i,*j); } @@ -130,12 +130,12 @@ void Projection_libproj::map2screen(double x, double y, int *i, int *j) const //------------------------------------------------------------------------------- void Projection_libproj::screen2map(int i, int j, double *x, double *y) const { - projUV data, res; - data.u = ((i-W/2.0)/scale+ CX)*111319.0 ; - data.v = ((H/2.0-j)/scale+ CY)*111319.0 ; - res = pj_inv(data, libProj); - *x = (double)(res.u*RAD_TO_DEG); - *y = (double)(res.v*RAD_TO_DEG); + PJ_COORD data, res; + data.uv.u = ((i-W/2.0)/scale+ CX)*111319.0 ; + data.uv.v = ((H/2.0-j)/scale+ CY)*111319.0 ; + res = proj_trans(libProj, PJ_INV, data); + *x = (double)(res.uv.u); + *y = (double)(res.uv.v); //printf("PROJ screen2map (%3d %3d) -> (%f %f)\n", i,j, *x,*y); } //--------------------------------------------------------------
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor