MCPcopy Create free account
hub / github.com/Kitware/VTK / pj_vgrid_init

Function pj_vgrid_init

ThirdParty/libproj/vtklibproj/src/grids.cpp:3303–3350  ·  view source on GitHub ↗

/

Source from the content-addressed store, hash-verified

3301
3302/**********************************************/
3303ListOfVGrids pj_vgrid_init(PJ *P, const char *gridkey) {
3304 /**********************************************
3305
3306 Initizalize and populate gridlist.
3307
3308 Takes a PJ-object and the plus-parameter
3309 name that is used in the proj-string to
3310 specify the grids to load, e.g. "+grids".
3311 The + should be left out here.
3312
3313 Returns the number of loaded grids.
3314
3315 ***********************************************/
3316
3317 std::string key("s");
3318 key += gridkey;
3319 const char *gridnames = pj_param(P->ctx, P->params, key.c_str()).s;
3320 if (gridnames == nullptr)
3321 return {};
3322
3323 auto listOfGridNames = internal::split(std::string(gridnames), ',');
3324 ListOfVGrids grids;
3325 for (const auto &gridnameStr : listOfGridNames) {
3326 const char *gridname = gridnameStr.c_str();
3327 bool canFail = false;
3328 if (gridname[0] == '@') {
3329 canFail = true;
3330 gridname++;
3331 }
3332 auto gridSet = VerticalShiftGridSet::open(P->ctx, gridname);
3333 if (!gridSet) {
3334 if (!canFail) {
3335 if (proj_context_errno(P->ctx) !=
3336 PROJ_ERR_OTHER_NETWORK_ERROR) {
3337 proj_context_errno_set(
3338 P->ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID);
3339 }
3340 return {};
3341 }
3342 proj_context_errno_set(P->ctx,
3343 0); // don't treat as a persistent error
3344 } else {
3345 grids.emplace_back(std::move(gridSet));
3346 }
3347 }
3348
3349 return grids;
3350}
3351
3352/***********************************************/
3353double pj_vgrid_value(PJ *P, const ListOfVGrids &grids, PJ_LP lp,

Callers 4

forward_3dFunction · 0.85
reverse_3dFunction · 0.85
vgridshift.cppFile · 0.85
deformation.cppFile · 0.85

Calls 7

pj_paramFunction · 0.85
proj_context_errnoFunction · 0.85
proj_context_errno_setFunction · 0.85
splitFunction · 0.50
stringClass · 0.50
c_strMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected