31 #ifndef GDAL_PRIV_H_INCLUDED
32 #define GDAL_PRIV_H_INCLUDED
54 #include "gdal_frmts.h"
61 #define GMO_VALID 0x0001
62 #define GMO_IGNORE_UNIMPLEMENTED 0x0002
63 #define GMO_SUPPORT_MD 0x0004
64 #define GMO_SUPPORT_MDMD 0x0008
65 #define GMO_MD_DIRTY 0x0010
66 #define GMO_PAM_CLASS 0x0020
75 char **papszDomainList;
82 int XMLInit(
CPLXMLNode *psMetadata,
int bMerge );
85 char **GetDomainList() {
return papszDomainList; }
87 char **GetMetadata(
const char * pszDomain =
"" );
88 CPLErr SetMetadata(
char ** papszMetadata,
89 const char * pszDomain =
"" );
90 const char *GetMetadataItem(
const char * pszName,
91 const char * pszDomain =
"" );
92 CPLErr SetMetadataItem(
const char * pszName,
93 const char * pszValue,
94 const char * pszDomain =
"" );
120 void SetMOFlags(
int nFlags);
122 virtual const char *GetDescription()
const;
123 virtual void SetDescription(
const char * );
125 virtual char **GetMetadata(
const char * pszDomain =
"" );
126 virtual CPLErr SetMetadata(
char ** papszMetadata,
127 const char * pszDomain =
"" );
128 virtual const char *GetMetadataItem(
const char * pszName,
129 const char * pszDomain =
"" );
130 virtual CPLErr SetMetadataItem(
const char * pszName,
131 const char * pszValue,
132 const char * pszDomain =
"" );
158 bool bCheckedForOverviews;
162 char **papszInitSiblingFiles;
168 void Initialize(
GDALDataset *poDS,
const char *pszName = NULL,
169 char **papszSiblingFiles = NULL,
170 int bNameIsOVR = FALSE );
178 int GetOverviewCount(
int);
182 const char * pszResampling,
183 int nOverviews,
int * panOverviewList,
184 int nBands,
int * panBandList,
185 GDALProgressFunc pfnProgress,
186 void *pProgressData );
188 CPLErr BuildOverviewsSubDataset(
const char * pszPhysicalFile,
189 const char * pszResampling,
190 int nOverviews,
int * panOverviewList,
191 int nBands,
int * panBandList,
192 GDALProgressFunc pfnProgress,
193 void *pProgressData );
195 CPLErr CleanOverviews();
201 int GetMaskFlags(
int nBand );
203 int HaveMaskFile(
char **papszSiblings = NULL,
204 const char *pszBasename = NULL );
206 char** GetSiblingFiles() {
return papszInitSiblingFiles; }
219 char **papszSiblingFiles = NULL );
223 char **papszSiblingFiles;
243 const char*
const * papszAllowedDrivers);
245 const char*
const * papszAllowedDrivers);
257 const char*
const * papszAllowedDrivers);
280 void RasterInitialize(
int,
int );
285 virtual CPLErr IBuildOverviews(
const char *,
int,
int *,
286 int,
int *, GDALProgressFunc,
void * );
288 virtual CPLErr IRasterIO(
GDALRWFlag,
int,
int,
int,
int,
290 int,
int *,
int,
int,
int );
292 CPLErr BlockBasedRasterIO(
GDALRWFlag,
int,
int,
int,
int,
294 int,
int *,
int,
int,
int );
295 void BlockBasedFlushCache();
297 virtual int CloseDependentDatasets();
304 int GetRasterXSize(
void );
305 int GetRasterYSize(
void );
306 int GetRasterCount(
void );
311 virtual const char *GetProjectionRef(
void);
312 virtual CPLErr SetProjection(
const char * );
314 virtual CPLErr GetGeoTransform(
double * );
315 virtual CPLErr SetGeoTransform(
double * );
318 char **papszOptions=NULL );
320 virtual void *GetInternalHandle(
const char * );
322 virtual char **GetFileList(
void);
324 virtual int GetGCPCount();
325 virtual const char *GetGCPProjection();
327 virtual CPLErr SetGCPs(
int nGCPCount,
const GDAL_GCP *pasGCPList,
328 const char *pszGCPProjection );
330 virtual CPLErr
AdviseRead(
int nXOff,
int nYOff,
int nXSize,
int nYSize,
331 int nBufXSize,
int nBufYSize,
333 int nBandCount,
int *panBandList,
334 char **papszOptions );
339 BeginAsyncReader(
int nXOff,
int nYOff,
int nXSize,
int nYSize,
340 void *pBuf,
int nBufXSize,
int nBufYSize,
342 int nBandCount,
int* panBandMap,
343 int nPixelSpace,
int nLineSpace,
int nBandSpace,
344 char **papszOptions);
349 int,
int *,
int,
int,
int );
358 static GDALDataset **GetOpenDatasets(
int *pnDatasetCount );
361 int,
int *, GDALProgressFunc,
void * );
363 void ReportError(CPLErr eErrClass,
int err_no,
const char *fmt, ...) CPL_PRINT_FUNC_FORMAT (4, 5);
396 CPLErr Internalize(
void );
398 void MarkDirty(
void );
399 void MarkClean(
void );
400 void AddLock(
void ) { nLockCount++; }
401 void DropLock(
void ) { nLockCount--; }
407 int GetXOff() {
return nXOff; }
408 int GetYOff() {
return nYOff; }
409 int GetXSize() {
return nXSize; }
410 int GetYSize() {
return nYSize; }
411 int GetDirty() {
return bDirty; }
412 int GetLockCount() {
return nLockCount; }
414 void *GetDataRef(
void ) {
return pData; }
420 static int FlushCacheBlock();
421 static void Verify();
436 std::vector<GDALColorEntry> aoEntries;
446 int GetColorEntryCount()
const;
463 CPLErr eFlushBlockErr;
465 void SetFlushBlockErr( CPLErr eErr );
483 int nBlocksPerColumn;
485 int bSubBlockingActive;
486 int nSubBlocksPerRow;
487 int nSubBlocksPerColumn;
501 virtual CPLErr IReadBlock(
int,
int,
void * ) = 0;
502 virtual CPLErr IWriteBlock(
int,
int,
void * );
503 virtual CPLErr IRasterIO(
GDALRWFlag,
int,
int,
int,
int,
506 CPLErr OverviewRasterIO(
GDALRWFlag,
int,
int,
int,
int,
537 int bJustInitialize = FALSE );
538 CPLErr FlushBlock(
int = -1,
int = -1,
int bWriteDirtyBlock = TRUE );
541 unsigned char* pTranslationTable = NULL,
542 int* pApproximateMatching = NULL);
549 virtual double GetMinimum(
int *pbSuccess = NULL );
550 virtual double GetMaximum(
int *pbSuccess = NULL );
551 virtual double GetOffset(
int *pbSuccess = NULL );
552 virtual double GetScale(
int *pbSuccess = NULL );
556 virtual CPLErr
Fill(
double dfRealValue,
double dfImaginaryValue = 0);
567 double *pdfMin,
double *pdfMax,
568 double *pdfMean,
double *padfStdDev );
570 double *pdfMin,
double *pdfMax,
571 double *pdfMean,
double *pdfStdDev,
572 GDALProgressFunc,
void *pProgressData );
574 double dfMean,
double dfStdDev );
582 GDALProgressFunc,
void * );
584 virtual CPLErr
AdviseRead(
int nXOff,
int nYOff,
int nXSize,
int nYSize,
585 int nBufXSize,
int nBufYSize,
588 virtual CPLErr
GetHistogram(
double dfMin,
double dfMax,
589 int nBuckets,
int * panHistogram,
590 int bIncludeOutOfRange,
int bApproxOK,
591 GDALProgressFunc,
void *pProgressData );
594 int *pnBuckets,
int ** ppanHistogram,
596 GDALProgressFunc,
void *pProgressData);
598 int nBuckets,
int *panHistogram );
607 void ReportError(CPLErr eErrClass,
int err_no,
const char *fmt, ...) CPL_PRINT_FUNC_FORMAT (4, 5);
617 virtual CPLErr IReadBlock(
int,
int,
void * );
633 double dfNoDataValue;
637 virtual CPLErr IReadBlock(
int,
int,
void * );
638 virtual CPLErr IRasterIO(
GDALRWFlag,
int,
int,
int,
int,
653 double *padfNodataValues;
656 virtual CPLErr IReadBlock(
int,
int,
void * );
689 int nXSize,
int nYSize,
int nBands,
690 GDALDataType eType,
char ** papszOptions ) CPL_WARN_UNUSED_RESULT;
692 CPLErr Delete(
const char * pszName );
693 CPLErr Rename(
const char * pszNewName,
694 const char * pszOldName );
695 CPLErr CopyFiles(
const char * pszNewName,
696 const char * pszOldName );
700 GDALProgressFunc pfnProgress,
701 void * pProgressData ) CPL_WARN_UNUSED_RESULT;
711 int nXSize,
int nYSize,
int nBands,
713 char ** papszOptions );
715 CPLErr (*pfnDelete)(
const char * pszName );
719 GDALProgressFunc pfnProgress,
720 void * pProgressData );
728 CPLErr (*pfnRename)(
const char * pszNewName,
729 const char * pszOldName );
730 CPLErr (*pfnCopyFiles)(
const char * pszNewName,
731 const char * pszOldName );
736 GDALDataset *DefaultCreateCopy(
const char *, GDALDataset *,
738 GDALProgressFunc pfnProgress,
739 void * pProgressData ) CPL_WARN_UNUSED_RESULT;
740 static CPLErr DefaultCopyMasks( GDALDataset *poSrcDS,
741 GDALDataset *poDstDS,
743 static CPLErr QuietDelete(
const char * pszName );
745 CPLErr DefaultRename(
const char * pszNewName,
746 const char * pszOldName );
747 CPLErr DefaultCopyFiles(
const char * pszNewName,
748 const char * pszOldName );
773 int GetDriverCount(
void );
781 void AutoLoadDrivers();
782 void AutoSkipDrivers();
784 const char *GetHome();
785 void SetHome(
const char * );
824 int GetXOffset() {
return nXOff;}
825 int GetYOffset() {
return nYOff;}
826 int GetXSize() {
return nXSize;}
827 int GetYSize() {
return nYSize;}
828 void * GetBuffer() {
return pBuf;}
829 int GetBufferXSize() {
return nBufXSize;}
830 int GetBufferYSize() {
return nBufYSize;}
832 int GetBandCount() {
return nBandCount;}
833 int* GetBandMap() {
return panBandMap;}
834 int GetPixelSpace() {
return nPixelSpace;}
835 int GetLineSpace() {
return nLineSpace;}
836 int GetBandSpace() {
return nBandSpace;}
839 GetNextUpdatedRegion(
double dfTimeout,
840 int* pnBufXOff,
int* pnBufYOff,
841 int* pnBufXSize,
int* pnBufYSize) = 0;
842 virtual int LockBuffer(
double dfTimeout = -1.0 );
843 virtual void UnlockBuffer();
852 GDALRegenerateOverviewsMultiBand(
int nBands,
GDALRasterBand** papoSrcBands,
855 const char * pszResampling,
856 GDALProgressFunc pfnProgress,
void * pProgressData );
863 HFAAuxBuildOverviews(
const char *pszOvrFilename,
GDALDataset *poParentDS,
865 int nBands,
int *panBandList,
866 int nNewOverviews,
int *panNewOverviewList,
867 const char *pszResampling,
868 GDALProgressFunc pfnProgress,
869 void *pProgressData );
874 GTIFFBuildOverviews(
const char * pszFilename,
876 int nOverviews,
int * panOverviewList,
877 const char * pszResampling,
878 GDALProgressFunc pfnProgress,
void * pProgressData );
881 GDALDefaultBuildOverviews(
GDALDataset *hSrcDS,
const char * pszBasename,
882 const char * pszResampling,
883 int nOverviews,
int * panOverviewList,
884 int nBands,
int * panBandList,
885 GDALProgressFunc pfnProgress,
void * pProgressData);
888 int &nXOff,
int &nYOff,
889 int &nXSize,
int &nYSize,
890 int nBufXSize,
int nBufYSize);
892 int CPL_DLL GDALOvLevelAdjust(
int nOvLevel,
int nXSize );
895 GDALFindAssociatedAuxFile(
const char *pszBasefile,
GDALAccess eAccess,
902 CPLErr CPL_DLL GDALParseGMLCoverage(
CPLXMLNode *psTree,
903 int *pnXSize,
int *pnYSize,
904 double *padfGeoTransform,
905 char **ppszProjection );
911 int CPL_DLL GDALCheckDatasetDimensions(
int nXSize,
int nYSize );
912 int CPL_DLL GDALCheckBandCount(
int nBands,
int bIsZeroAllowed );
917 #define ARE_REAL_EQUAL(dfVal1, dfVal2) \
918 (dfVal1 == dfVal2 || fabs(dfVal1 - dfVal2) < 1e-10 || (dfVal2 != 0 && fabs(1 - dfVal1 / dfVal2) < 1e-10 ))
923 int CPL_DLL GDALReadWorldFile2(
const char *pszBaseFilename,
const char *pszExtension,
924 double *padfGeoTransform,
char** papszSiblingFiles,
925 char** ppszWorldFileNameOut);
926 int GDALReadTabFile2(
const char * pszBaseFilename,
927 double *padfGeoTransform,
char **ppszWKT,
928 int *pnGCPCount,
GDAL_GCP **ppasGCPs,
929 char** papszSiblingFiles,
char** ppszTabFileNameOut );
933 void GDALNullifyOpenDatasetsList();
934 void** GDALGetphDMMutex();
935 void** GDALGetphDLMutex();
936 void GDALNullifyProxyPoolSingleton();
938 void GDALSetResponsiblePIDForCurrentThread(GIntBig responsiblePID);
939 GIntBig GDALGetResponsiblePIDForCurrentThread();
941 CPLString GDALFindAssociatedFile(
const char *pszBasename,
const char *pszExt,
942 char **papszSiblingFiles,
int nFlags );
944 CPLErr EXIFExtractMetadata(
char**& papszMetadata,
945 void *fpL,
int nOffset,
946 int bSwabflag,
int nTIFFHEADER,
947 int& nExifOffset,
int& nInterOffset,
int& nGPSOffset);
949 #define DIV_ROUND_UP(a, b) ( ((a) % (b)) == 0 ? ((a) / (b)) : (((a) / (b)) + 1) )
953 #define GDALSTAT_APPROX_NUMSAMPLES 2500
Raster Attribute Table container.
Definition: gdal_rat.h:61
virtual CPLErr GetDefaultHistogram(double *pdfMin, double *pdfMax, int *pnBuckets, int **ppanHistogram, int bForce, GDALProgressFunc, void *pProgressData)
Fetch default raster histogram.
virtual CPLErr AdviseRead(int nXOff, int nYOff, int nXSize, int nYSize, int nBufXSize, int nBufYSize, GDALDataType eDT, char **papszOptions)
Advise driver of upcoming read requests.
Definition: gdalrasterband.cpp:3253
virtual CPLErr FlushCache()
Flush raster data cache.
GDALDataType
Definition: gdal.h:53
Definition: gdal_priv.h:651
Document node structure.
Definition: cpl_minixml.h:65
virtual GDALRasterBand * GetMaskBand()
Return the mask band associated with the band.
Definition: gdalrasterband.cpp:4418
virtual CPLErr SetUnitType(const char *)
Set unit type.
Definitions for CPL mini XML Parser/Serializer.
virtual CPLErr AdviseRead(int nXOff, int nYOff, int nXSize, int nYSize, int nBufXSize, int nBufYSize, GDALDataType eDT, char **papszOptions)
Advise driver of upcoming read requests.
virtual CPLErr SetDefaultRAT(const GDALRasterAttributeTable *)
Set default Raster Attribute Table.
virtual CPLErr ComputeStatistics(int bApproxOK, double *pdfMin, double *pdfMax, double *pdfMean, double *pdfStdDev, GDALProgressFunc, void *pProgressData)
Compute image statistics.
int GetYSize()
Fetch YSize of raster.
Definition: gdalrasterband.cpp:2546
virtual CPLErr SetStatistics(double dfMin, double dfMax, double dfMean, double dfStdDev)
Set statistics on band.
Definition: gdal_proxy.h:98
virtual CPLErr SetDefaultHistogram(double dfMin, double dfMax, int nBuckets, int *panHistogram)
Set default histogram.
GDALDatasetH GDALOpenShared(const char *, GDALAccess) CPL_WARN_UNUSED_RESULT
Open a raster file as a GDALDataset.
Definition: gdaldataset.cpp:2373
virtual CPLErr SetOffset(double)
Set scaling offset.
virtual GDALRasterBand * GetRasterSampleOverview(int)
Fetch best sampling overview.
GDALRWFlag
Definition: gdal.h:97
void * GDALDatasetH
Opaque type used for the C bindings of the C++ GDALDataset class.
Definition: gdal.h:160
Definition: gdal_priv.h:631
virtual CPLErr GetHistogram(double dfMin, double dfMax, int nBuckets, int *panHistogram, int bIncludeOutOfRange, int bApproxOK, GDALProgressFunc, void *pProgressData)
Compute raster histogram.
Color tuple.
Definition: gdal.h:634
A single raster block in the block cache.
Definition: gdal_priv.h:372
virtual int GetMaskFlags()
Return the status flags of the mask band associated with the band.
Definition: gdalrasterband.cpp:4607
virtual CPLErr BuildOverviews(const char *, int, int *, GDALProgressFunc, void *)
Build raster overview(s)
void GetBlockSize(int *, int *)
Fetch the "natural" block size of this band.
Definition: gdalrasterband.cpp:622
virtual GDALRasterBand * GetOverview(int)
Fetch overview raster band object.
Convenient string class based on std::string.
Definition: cpl_string.h:224
virtual CPLErr BuildOverviews(const char *, int, int *, GDALProgressFunc, void *)
Build raster overview(s)
Definition: gdalrasterband.cpp:2191
virtual double GetOffset(int *pbSuccess=NULL)
Fetch the raster value offset.
GDALRasterBand()
Definition: gdalrasterband.cpp:47
virtual CPLErr GetStatistics(int bApproxOK, int bForce, double *pdfMin, double *pdfMax, double *pdfMean, double *padfStdDev)
Fetch image statistics.
virtual char ** GetCategoryNames()
Fetch the list of category names for this raster.
CPLErr WriteBlock(int, int, void *)
Write a block of image data efficiently.
Definition: gdalrasterband.cpp:485
CPLErr BuildOverviews(const char *, int, int *, int, int *, GDALProgressFunc, void *)
Build raster overview(s)
Definition: gdaldataset.cpp:1367
Various convenience functions for working with strings and string lists.
Definition: gdal_priv.h:138
GDALRasterBlock * GetLockedBlockRef(int nXBlockOff, int nYBlockOff, int bJustInitialize=FALSE)
Fetch a pointer to an internally cached raster block.
Definition: gdalrasterband.cpp:1179
virtual CPLErr FlushCache()
Flush raster data cache.
Definition: gdalrasterband.cpp:851
virtual CPLErr CreateMaskBand(int nFlags)
Adds a mask band to the current band.
Definition: gdalrasterband.cpp:4665
virtual CPLErr CreateMaskBand(int nFlags)
Adds a mask band to the dataset.
Definition: gdaldataset.cpp:2126
virtual CPLErr SetScale(double)
Set scaling ratio.
virtual ~GDALRasterBand()
Definition: gdalrasterband.cpp:82
Public (C callable) GDAL entry points.
GDALAsyncStatusType
status of the asynchronous stream
Definition: gdal.h:78
Definition: gdal_proxy.h:44
virtual int HasArbitraryOverviews()
Check for arbitrary overviews.
virtual int GetOverviewCount()
Return the number of overview layers available.
virtual const char * GetUnitType()
Return raster unit type.
virtual CPLErr SetColorTable(GDALColorTable *)
Set the raster color table.
GDALRasterBand * GetBand()
Accessor to source GDALRasterBand object.
Definition: gdal_priv.h:418
Definition: gdal_priv.h:215
Definition: gdal_priv.h:614
GDALDataType GetRasterDataType(void)
Fetch the pixel data type for this band.
Definition: gdalrasterband.cpp:573
String list class designed around our use of C "char**" string lists.
Definition: cpl_string.h:295
GDALDatasetH GDALOpen(const char *pszFilename, GDALAccess eAccess) CPL_WARN_UNUSED_RESULT
Open a raster file as a GDALDataset.
Definition: gdaldataset.cpp:2216
GDALPaletteInterp
Definition: gdal.h:129
virtual CPLErr SetCategoryNames(char **)
Set the category names for this band.
virtual int CloseDependentDatasets()
Drop references to any other datasets referenced by this dataset.
Definition: gdaldataset.cpp:2754
virtual GDALColorInterp GetColorInterpretation()
How should this band be interpreted as color?
virtual CPLErr SetColorInterpretation(GDALColorInterp)
Set color interpretation of a band.
unsigned char * GetIndexColorTranslationTo(GDALRasterBand *poReferenceBand, unsigned char *pTranslationTable=NULL, int *pApproximateMatching=NULL)
Compute translation table for color tables.
Definition: gdalrasterband.cpp:4739
int GetXSize()
Fetch XSize of raster.
Definition: gdalrasterband.cpp:2509
Various convenience functions for CPL.
void ReportError(CPLErr eErrClass, int err_no, const char *fmt,...) CPL_PRINT_FUNC_FORMAT(4
Emits an error related to a raster band.
Definition: gdalrasterband.cpp:4886
virtual const GDALRasterAttributeTable * GetDefaultRAT()
Fetch default Raster Attribute Table.
int GetBand()
Fetch the band number.
Definition: gdalrasterband.cpp:2588
Object with metadata.
Definition: gdal_priv.h:108
virtual CPLErr ComputeRasterMinMax(int, double *)
Compute the min/max values for a band.
GDALDataset * GetDataset()
Fetch the owning dataset handle.
Definition: gdalrasterband.cpp:2629
CPLErr RasterIO(GDALRWFlag, int, int, int, int, void *, int, int, GDALDataType, int, int)
Read/write a region of image data for this band.
Definition: gdalrasterband.cpp:175
virtual GDALRasterBand * GetMaskBand()
Return the mask band associated with the band.
A single raster band (or channel).
Definition: gdal_priv.h:460
GDALAccess
Definition: gdal.h:91
virtual double GetNoDataValue(int *pbSuccess=NULL)
Fetch the no data value for this band.
Definition: gdal_priv.h:72
virtual double GetMaximum(int *pbSuccess=NULL)
Fetch the maximum value for this band.
virtual CPLErr SetNoDataValue(double)
Set the no data value for this band.
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:249
GDALAccess GetAccess()
Find out if we have update permission for this band.
Definition: gdalrasterband.cpp:1394
Class for managing the registration of file format drivers.
Definition: gdal_priv.h:762
virtual CPLErr Fill(double dfRealValue, double dfImaginaryValue=0)
Fill this band with a constant value.
CPLErr ReadBlock(int, int, void *)
Read a block of image data efficiently.
Definition: gdalrasterband.cpp:382
GDALColorInterp
Definition: gdal.h:103
virtual GDALColorTable * GetColorTable()
Fetch the color table associated with band.
virtual int GetMaskFlags()
Return the status flags of the mask band associated with the band.
virtual double GetScale(int *pbSuccess=NULL)
Fetch the raster value scale.
virtual double GetMinimum(int *pbSuccess=NULL)
Fetch the minimum value for this band.
Format specific driver.
Definition: gdal_priv.h:679
Definition: gdal_priv.h:432
GDALRasterBlock * TryGetLockedBlockRef(int nXBlockOff, int nYBlockYOff)
Try fetching block ref.
Definition: gdalrasterband.cpp:1078
Ground Control Point.
Definition: gdal.h:253
virtual CPLErr CreateMaskBand(int nFlags)
Adds a mask band to the current band.
Class used as a session object for asynchronous requests.
Definition: gdal_priv.h:801