15#ifndef GDAL_CPP_FUNCTIONS_H_INCLUDED
16#define GDAL_CPP_FUNCTIONS_H_INCLUDED
20#include "cpl_progress.h"
25#include "gdal_geotransform.h"
33typedef struct _CPLMutex CPLMutex;
49CPLErr CPL_DLL GDALRegenerateOverviewsMultiBand(
52 const char *pszResampling, GDALProgressFunc pfnProgress,
55CPLErr CPL_DLL GDALRegenerateOverviewsMultiBand(
56 const std::vector<GDALRasterBand *> &apoSrcBands,
59 const std::vector<std::vector<GDALRasterBand *>> &aapoOverviewBands,
60 const char *pszResampling, GDALProgressFunc pfnProgress,
70struct GDALOverviewResampleArgs
84 double dfXRatioDstToSrc = 0;
87 double dfYRatioDstToSrc = 0;
89 double dfSrcXDelta = 0;
91 double dfSrcYDelta = 0;
95 const GByte *pabyChunkNodataMask =
nullptr;
113 const char *pszResampling =
nullptr;
115 bool bHasNoData =
false;
117 double dfNoDataValue = 0;
123 bool bPropagateNoData =
false;
126typedef CPLErr (*GDALResampleFunction)(
const GDALOverviewResampleArgs &args,
127 const void *pChunk,
void **ppDstBuffer,
130GDALResampleFunction GDALGetResampleFunction(
const char *pszResampling,
133std::string CPL_DLL GDALGetNormalizedOvrResampling(
const char *pszResampling);
135GDALDataType GDALGetOvrWorkDataType(
const char *pszResampling,
141HFAAuxBuildOverviews(
const char *pszOvrFilename,
GDALDataset *poParentDS,
142 GDALDataset **ppoDS,
int nBands,
const int *panBandList,
143 int nNewOverviews,
const int *panNewOverviewList,
144 const char *pszResampling, GDALProgressFunc pfnProgress,
147CPLErr CPL_DLL GTIFFBuildOverviews(
const char *pszFilename,
int nBands,
149 int nOverviews,
const int *panOverviewList,
150 const char *pszResampling,
151 GDALProgressFunc pfnProgress,
155CPLErr CPL_DLL GTIFFBuildOverviewsEx(
const char *pszFilename,
int nBands,
157 int nOverviews,
const int *panOverviewList,
158 const std::pair<int, int> *pasOverviewSize,
159 const char *pszResampling,
160 const char *
const *papszOptions,
161 GDALProgressFunc pfnProgress,
162 void *pProgressData);
164int CPL_DLL GDALBandGetBestOverviewLevel(
GDALRasterBand *poBand,
int &nXOff,
165 int &nYOff,
int &nXSize,
int &nYSize,
166 int nBufXSize,
int nBufYSize)
167 CPL_WARN_DEPRECATED(
"Use GDALBandGetBestOverviewLevel2 instead");
168int CPL_DLL GDALBandGetBestOverviewLevel2(
GDALRasterBand *poBand,
int &nXOff,
169 int &nYOff,
int &nXSize,
int &nYSize,
170 int nBufXSize,
int nBufYSize,
173int CPL_DLL GDALOvLevelAdjust(
int nOvLevel,
int nXSize)
174 CPL_WARN_DEPRECATED(
"Use GDALOvLevelAdjust2 instead");
175int CPL_DLL GDALOvLevelAdjust2(
int nOvLevel,
int nXSize,
int nYSize);
176int CPL_DLL GDALComputeOvFactor(
int nOvrXSize,
int nRasterXSize,
int nOvrYSize,
179GDALDataset CPL_DLL *GDALFindAssociatedAuxFile(
const char *pszBasefile,
187int CPL_DLL GDALCheckDatasetDimensions(
int nXSize,
int nYSize);
188int CPL_DLL GDALCheckBandCount(
int nBands,
int bIsZeroAllowed);
194int CPL_DLL GDALReadWorldFile2(
const char *pszBaseFilename,
195 const char *pszExtension,
196 double *padfGeoTransform,
198 char **ppszWorldFileNameOut);
199int CPL_DLL GDALReadTabFile2(
const char *pszBaseFilename,
200 double *padfGeoTransform,
char **ppszWKT,
201 int *pnGCPCount,
GDAL_GCP **ppasGCPs,
203 char **ppszTabFileNameOut);
208void CPL_DLL GDALExpandPackedBitsToByteAt0Or1(
212void CPL_DLL GDALExpandPackedBitsToByteAt0Or255(
218int CPL_DLL GDALReadWorldFile2(
const char *pszBaseFilename,
221 char **ppszWorldFileNameOut);
223std::unique_ptr<GDALDataset> CPL_DLL
230 double dfTargetDownsamplingRatio,
231 double dfOversamplingThreshold);
233void GDALNullifyOpenDatasetsList();
234CPLMutex **GDALGetphDMMutex();
235CPLMutex **GDALGetphDLMutex();
236void GDALNullifyProxyPoolSingleton();
237void GDALSetResponsiblePIDForCurrentThread(
GIntBig responsiblePID);
238GIntBig GDALGetResponsiblePIDForCurrentThread();
240CPLString GDALFindAssociatedFile(
const char *pszBasename,
const char *pszExt,
243CPLErr CPL_DLL EXIFExtractMetadata(
char **&papszMetadata,
void *fpL,
244 uint32_t nOffset,
int bSwabflag,
246 uint32_t &nExifOffset,
247 uint32_t &nInterOffset,
248 uint32_t &nGPSOffset);
251 const char *
const *papszOptionOptions);
252int GDALValidateOptions(
GDALDriverH hDriver,
const char *pszOptionList,
253 const char *
const *papszOptionsToValidate,
254 const char *pszErrorMessageOptionType,
255 const char *pszErrorMessageContainerName);
258GDALRasterIOGetResampleAlg(
const char *pszResampling);
262 int nXSize,
int nYSize,
int nBufXSize,
266 bool bThisLevelOnly);
275inline bool ARE_REAL_EQUAL(
float fVal1,
float fVal2,
int ulp = 2)
278 return fVal1 == fVal2 ||
280 std::numeric_limits<float>::epsilon() * abs(fVal1 + fVal2) * ulp;
285inline bool ARE_REAL_EQUAL(
double dfVal1,
double dfVal2,
int ulp = 2)
288 return dfVal1 == dfVal2 ||
289 abs(dfVal1 - dfVal2) <
290 static_cast<double>(std::numeric_limits<float>::epsilon()) *
291 abs(dfVal1 + dfVal2) * ulp;
294double GDALAdjustNoDataCloseToFloatMax(
double dfVal);
296#define DIV_ROUND_UP(a, b) (((a) % (b)) == 0 ? ((a) / (b)) : (((a) / (b)) + 1))
300#define GDALSTAT_APPROX_NUMSAMPLES 2500
302void GDALSerializeGCPListToXML(
CPLXMLNode *psParentNode,
303 const std::vector<gdal::GCP> &asGCPs,
305void GDALDeserializeGCPListFromXML(
const CPLXMLNode *psGCPList,
306 std::vector<gdal::GCP> &asGCPs,
309void GDALSerializeOpenOptionsToXML(
CPLXMLNode *psParentNode,
312GDALDeserializeOpenOptionsFromXML(
const CPLXMLNode *psParentNode);
314int GDALCanFileAcceptSidecarFile(
const char *pszFilename);
316bool GDALCanReliablyUseSiblingFileList(
const char *pszFilename);
323} GDALBufferSampleFormat;
325bool CPL_DLL GDALBufferHasOnlyNoData(
const void *pBuffer,
double dfNoDataValue,
326 size_t nWidth,
size_t nHeight,
327 size_t nLineStride,
size_t nComponents,
329 GDALBufferSampleFormat nSampleFormat);
333 bool *pbCannotBeExactlyRepresented =
nullptr);
335double CPL_DLL GDALGetNoDataValueCastToDouble(int64_t nVal);
336double CPL_DLL GDALGetNoDataValueCastToDouble(uint64_t nVal);
341void CPL_DLL GDALEnablePixelTypeSignedByteWarning(
GDALRasterBandH hBand,
344std::string CPL_DLL GDALGetCompressionFormatForJPEG(
VSILFILE *fp);
345std::string CPL_DLL GDALGetCompressionFormatForJPEG(
const void *pBuffer,
350 const std::vector<std::shared_ptr<GDALMDArray>> &apoArrays,
351 const std::vector<GDALRATFieldUsage> &aeUsages);
354GDALGetColorInterpFromSTACCommonName(
const char *pszName);
358std::string CPL_DLL GDALGetCacheDirectory();
360bool GDALDoesFileOrDatasetExist(
const char *pszName,
361 const char **ppszType =
nullptr,
365GDALGetMessageAboutMissingPluginDriver(
GDALDriver *poMissingPluginDriver);
367std::string GDALPrintDriverList(
int nOptions,
bool bJSON);
369struct GDALColorAssociation
378std::vector<GDALColorAssociation> GDALLoadTextColorMap(
const char *pszFilename,
385 return eErr1 ==
CE_None ? eErr2 : eErr1;
398CPLStringList CPL_DLL GDALENVISplitList(
const char *pszCleanInput);
399void CPL_DLL GDALApplyENVIHeaders(
GDALDataset *poDS,
406GDALGetDefaultAsyncReader(
GDALDataset *poDS,
int nXOff,
int nYOff,
int nXSize,
407 int nYSize,
void *pBuf,
int nBufXSize,
int nBufYSize,
409 int *panBandMap,
int nPixelSpace,
int nLineSpace,
String list class designed around our use of C "char**" string lists.
Definition cpl_string.h:476
Convenient string class based on std::string.
Definition cpl_string.h:338
Class used as a session object for asynchronous requests.
Definition gdal_asyncreader.h:32
A color table / palette.
Definition gdal_colortable.h:32
A set of associated raster bands, usually from one file.
Definition gdal_dataset.h:77
Format specific driver.
Definition gdal_driver.h:63
Class modeling a multi-dimensional array.
Definition gdal_multidim.h:852
The GDALRasterAttributeTable (or RAT) class is used to encapsulate a table used to provide attribute ...
Definition gdal_rat.h:48
A single raster band (or channel).
Definition gdal_rasterband.h:108
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition ogr_spatialref.h:152
CPL error handling services.
CPLErr
Error category / error level.
Definition cpl_error.h:45
@ CE_None
No error.
Definition cpl_error.h:47
@ CE_Failure
Error that prevents the current operation to succeed.
Definition cpl_error.h:60
Core portability definitions for CPL.
#define CPL_RESTRICT
restrict keyword to declare that pointers do not alias
Definition cpl_port.h:1081
#define CPL_C_END
Macro to end a block of C symbols.
Definition cpl_port.h:279
#define CPL_C_START
Macro to start a block of C symbols.
Definition cpl_port.h:275
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition cpl_port.h:1252
unsigned char GByte
Unsigned byte type.
Definition cpl_port.h:165
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition cpl_port.h:195
Various convenience functions for working with strings and string lists.
GUIntBig vsi_l_offset
Type for a file offset.
Definition cpl_vsi.h:136
Public (C callable) GDAL entry points.
GDALRATTableType
RAT table type (thematic or athematic)
Definition gdal.h:2321
GDALAccess
Definition gdal.h:120
GDALDataType
Definition gdal.h:48
@ GDT_Unknown
Definition gdal.h:49
GDALRasterAttributeTableH GDALCreateRasterAttributeTableFromMDArrays(GDALRATTableType eTableType, int nArrays, const GDALMDArrayH *ahArrays, const GDALRATFieldUsage *paeUsages)
Return a virtual Raster Attribute Table from several GDALMDArray's.
Definition gdalmultidim_rat.cpp:512
GDALRIOResampleAlg
RasterIO() resampling method.
Definition gdal.h:137
GDALDatasetH GDALGetThreadSafeDataset(GDALDatasetH, int nScopeFlags, CSLConstList papszOptions)
Return a thread-safe dataset.
Definition gdalthreadsafedataset.cpp:1306
GDALColorInterp
Types of color interpretation for raster bands.
Definition gdal.h:294
void * GDALDriverH
Opaque type used for the C bindings of the C++ GDALDriver class.
Definition gdal_fwd.h:51
void * GDALRasterBandH
Opaque type used for the C bindings of the C++ GDALRasterBand class.
Definition gdal_fwd.h:45
Document node structure.
Definition cpl_minixml.h:54
Ground Control Point.
Definition gdal.h:1261
Virtual file handle.
Definition cpl_vsi_virtual.h:48