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 );
738 GDALProgressFunc pfnProgress,
739 void * pProgressData ) CPL_WARN_UNUSED_RESULT;
740 static CPLErr DefaultCopyMasks(
GDALDataset *poSrcDS,
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