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

Function pj_generic_grid_init

src/grids.cpp:3213–3247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3211// ---------------------------------------------------------------------------
3212
3213ListOfGenericGrids pj_generic_grid_init(PJ *P, const char *gridkey) {
3214 std::string key("s");
3215 key += gridkey;
3216 const char *gridnames = pj_param(P->ctx, P->params, key.c_str()).s;
3217 if (gridnames == nullptr)
3218 return {};
3219
3220 auto listOfGridNames = internal::split(std::string(gridnames), ',');
3221 ListOfGenericGrids grids;
3222 for (const auto &gridnameStr : listOfGridNames) {
3223 const char *gridname = gridnameStr.c_str();
3224 bool canFail = false;
3225 if (gridname[0] == '@') {
3226 canFail = true;
3227 gridname++;
3228 }
3229 auto gridSet = GenericShiftGridSet::open(P->ctx, gridname);
3230 if (!gridSet) {
3231 if (!canFail) {
3232 if (proj_context_errno(P->ctx) !=
3233 PROJ_ERR_OTHER_NETWORK_ERROR) {
3234 proj_context_errno_set(
3235 P->ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID);
3236 }
3237 return {};
3238 }
3239 proj_context_errno_set(P->ctx,
3240 0); // don't treat as a persistent error
3241 } else {
3242 grids.emplace_back(std::move(gridSet));
3243 }
3244 }
3245
3246 return grids;
3247}
3248
3249// ---------------------------------------------------------------------------
3250

Callers 5

loadGridsIfNeededMethod · 0.85
gridshift.cppFile · 0.85
get_grid_valuesFunction · 0.85
xyzgridshift.cppFile · 0.85
deformation.cppFile · 0.85

Calls 4

pj_paramFunction · 0.85
splitFunction · 0.85
proj_context_errnoFunction · 0.85
proj_context_errno_setFunction · 0.85

Tested by

no test coverage detected