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

Function pj_find_file

ThirdParty/libproj/vtklibproj/src/filemanager.cpp:1745–1774  ·  view source on GitHub ↗

Returns the full filename corresponding to a proj resource file specified * as a short filename. * * @param ctx context. * @param short_filename short filename (e.g. us_nga_egm96_15.tif). * Must not be NULL. * @param out_full_filename output buffer, of size out_full_filename_size, that * will receive the full filename on success. *

Source from the content-addressed store, hash-verified

1743 * @return 1 if the file was found, 0 otherwise.
1744 */
1745int pj_find_file(PJ_CONTEXT *ctx, const char *short_filename,
1746 char *out_full_filename, size_t out_full_filename_size) {
1747 auto file = std::unique_ptr<NS_PROJ::File>(
1748 reinterpret_cast<NS_PROJ::File *>(pj_open_lib_internal(
1749 ctx, short_filename, "rb", pj_open_file_with_manager,
1750 out_full_filename, out_full_filename_size)));
1751
1752 // Retry with the old proj grid name if the file name ends with .tif
1753 if (file == nullptr && strstr(short_filename, ".tif") != nullptr) {
1754
1755 auto dbContext = getDBcontext(ctx);
1756 if (dbContext) {
1757 try {
1758 auto filename = dbContext->getOldProjGridName(short_filename);
1759 if (!filename.empty()) {
1760 file.reset(reinterpret_cast<NS_PROJ::File *>(
1761 pj_open_lib_internal(ctx, filename.c_str(), "rb",
1762 pj_open_file_with_manager,
1763 out_full_filename,
1764 out_full_filename_size)));
1765 }
1766 } catch (const std::exception &e) {
1767 pj_log(ctx, PJ_LOG_DEBUG, "%s", e.what());
1768 return false;
1769 }
1770 }
1771 }
1772
1773 return file != nullptr;
1774}
1775
1776/************************************************************************/
1777/* trim() */

Callers 6

get_initFunction · 0.85
proj_grid_infoFunction · 0.85
proj_init_infoFunction · 0.85
openMethod · 0.85
lookForGridInfoMethod · 0.85
createFromPROJStringMethod · 0.85

Calls 8

pj_open_lib_internalFunction · 0.85
getDBcontextFunction · 0.85
pj_logFunction · 0.85
getOldProjGridNameMethod · 0.80
emptyMethod · 0.45
resetMethod · 0.45
c_strMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected