00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef GDAL_PRIV_H_INCLUDED
00033 #define GDAL_PRIV_H_INCLUDED
00034
00035
00036
00037
00038
00039 class GDALMajorObject;
00040 class GDALDataset;
00041 class GDALRasterBand;
00042 class GDALDriver;
00043 class GDALRasterAttributeTable;
00044 class GDALProxyDataset;
00045 class GDALProxyRasterBand;
00046 class GDALAsyncReader;
00047
00048
00049
00050
00051
00052
00053
00054 #include "gdal.h"
00055 #include "gdal_frmts.h"
00056 #include "cpl_vsi.h"
00057 #include "cpl_conv.h"
00058 #include "cpl_string.h"
00059 #include "cpl_minixml.h"
00060 #include <vector>
00061
00062 #define GMO_VALID 0x0001
00063 #define GMO_IGNORE_UNIMPLEMENTED 0x0002
00064 #define GMO_SUPPORT_MD 0x0004
00065 #define GMO_SUPPORT_MDMD 0x0008
00066 #define GMO_MD_DIRTY 0x0010
00067 #define GMO_PAM_CLASS 0x0020
00068
00069
00070
00071
00072
00073 class CPL_DLL GDALMultiDomainMetadata
00074 {
00075 private:
00076 char **papszDomainList;
00077 CPLStringList **papoMetadataLists;
00078
00079 public:
00080 GDALMultiDomainMetadata();
00081 ~GDALMultiDomainMetadata();
00082
00083 int XMLInit( CPLXMLNode *psMetadata, int bMerge );
00084 CPLXMLNode *Serialize();
00085
00086 char **GetDomainList() { return papszDomainList; }
00087
00088 char **GetMetadata( const char * pszDomain = "" );
00089 CPLErr SetMetadata( char ** papszMetadata,
00090 const char * pszDomain = "" );
00091 const char *GetMetadataItem( const char * pszName,
00092 const char * pszDomain = "" );
00093 CPLErr SetMetadataItem( const char * pszName,
00094 const char * pszValue,
00095 const char * pszDomain = "" );
00096
00097 void Clear();
00098 };
00099
00100
00101
00102
00103
00104
00105
00106
00108
00109 class CPL_DLL GDALMajorObject
00110 {
00111 protected:
00112 int nFlags;
00113 CPLString sDescription;
00114 GDALMultiDomainMetadata oMDMD;
00115
00116 char **BuildMetadataDomainList(char** papszList, int bCheckNonEmpty, ...) CPL_NULL_TERMINATED;
00117
00118 public:
00119 GDALMajorObject();
00120 virtual ~GDALMajorObject();
00121
00122 int GetMOFlags();
00123 void SetMOFlags(int nFlags);
00124
00125 virtual const char *GetDescription() const;
00126 virtual void SetDescription( const char * );
00127
00128 virtual char **GetMetadataDomainList();
00129
00130 virtual char **GetMetadata( const char * pszDomain = "" );
00131 virtual CPLErr SetMetadata( char ** papszMetadata,
00132 const char * pszDomain = "" );
00133 virtual const char *GetMetadataItem( const char * pszName,
00134 const char * pszDomain = "" );
00135 virtual CPLErr SetMetadataItem( const char * pszName,
00136 const char * pszValue,
00137 const char * pszDomain = "" );
00138 };
00139
00140
00141
00142
00143 class CPL_DLL GDALDefaultOverviews
00144 {
00145 friend class GDALDataset;
00146
00147 GDALDataset *poDS;
00148 GDALDataset *poODS;
00149
00150 CPLString osOvrFilename;
00151
00152 int bOvrIsAux;
00153
00154 int bCheckedForMask;
00155 int bOwnMaskDS;
00156 GDALDataset *poMaskDS;
00157
00158
00159
00160 GDALDataset *poBaseDS;
00161
00162
00163 bool bCheckedForOverviews;
00164 void OverviewScan();
00165 char *pszInitName;
00166 int bInitNameIsOVR;
00167 char **papszInitSiblingFiles;
00168
00169 public:
00170 GDALDefaultOverviews();
00171 ~GDALDefaultOverviews();
00172
00173 void Initialize( GDALDataset *poDS, const char *pszName = NULL,
00174 char **papszSiblingFiles = NULL,
00175 int bNameIsOVR = FALSE );
00176
00177 int IsInitialized();
00178
00179 int CloseDependentDatasets();
00180
00181
00182
00183 int GetOverviewCount(int);
00184 GDALRasterBand *GetOverview(int,int);
00185
00186 CPLErr BuildOverviews( const char * pszBasename,
00187 const char * pszResampling,
00188 int nOverviews, int * panOverviewList,
00189 int nBands, int * panBandList,
00190 GDALProgressFunc pfnProgress,
00191 void *pProgressData );
00192
00193 CPLErr BuildOverviewsSubDataset( const char * pszPhysicalFile,
00194 const char * pszResampling,
00195 int nOverviews, int * panOverviewList,
00196 int nBands, int * panBandList,
00197 GDALProgressFunc pfnProgress,
00198 void *pProgressData );
00199
00200 CPLErr CleanOverviews();
00201
00202
00203
00204 CPLErr CreateMaskBand( int nFlags, int nBand = -1 );
00205 GDALRasterBand *GetMaskBand( int nBand );
00206 int GetMaskFlags( int nBand );
00207
00208 int HaveMaskFile( char **papszSiblings = NULL,
00209 const char *pszBasename = NULL );
00210
00211 char** GetSiblingFiles() { return papszInitSiblingFiles; }
00212 };
00213
00214
00215
00216
00217
00218
00219
00220 class CPL_DLL GDALOpenInfo
00221 {
00222 public:
00223 GDALOpenInfo( const char * pszFile, GDALAccess eAccessIn,
00224 char **papszSiblingFiles = NULL );
00225 ~GDALOpenInfo( void );
00226
00227 char *pszFilename;
00228 char **papszSiblingFiles;
00229
00230 GDALAccess eAccess;
00231
00232 int bStatOK;
00233 int bIsDirectory;
00234
00235 FILE *fp;
00236
00237 int nHeaderBytes;
00238 GByte *pabyHeader;
00239
00240 };
00241
00242
00243
00244
00245
00246
00247 GDALDatasetH GDALOpenInternal( const char * pszFilename, GDALAccess eAccess,
00248 const char* const * papszAllowedDrivers);
00249 GDALDatasetH GDALOpenInternal( GDALOpenInfo& oOpenInfo,
00250 const char* const * papszAllowedDrivers);
00251
00253
00254 class CPL_DLL GDALDataset : public GDALMajorObject
00255 {
00256 friend GDALDatasetH CPL_STDCALL GDALOpen( const char *, GDALAccess);
00257 friend GDALDatasetH CPL_STDCALL GDALOpenShared( const char *, GDALAccess);
00258
00259
00260 friend GDALDatasetH GDALOpenInternal( const char *, GDALAccess, const char* const * papszAllowedDrivers);
00261 friend GDALDatasetH GDALOpenInternal( GDALOpenInfo& oOpenInfo,
00262 const char* const * papszAllowedDrivers);
00263
00264 friend class GDALDriver;
00265 friend class GDALDefaultOverviews;
00266 friend class GDALProxyDataset;
00267 friend class GDALDriverManager;
00268
00269 protected:
00270 GDALDriver *poDriver;
00271 GDALAccess eAccess;
00272
00273
00274 int nRasterXSize;
00275 int nRasterYSize;
00276 int nBands;
00277 GDALRasterBand **papoBands;
00278
00279 int bForceCachedIO;
00280
00281 int nRefCount;
00282 int bShared;
00283
00284 GDALDataset(void);
00285 void RasterInitialize( int, int );
00286 void SetBand( int, GDALRasterBand * );
00287
00288 GDALDefaultOverviews oOvManager;
00289
00290 virtual CPLErr IBuildOverviews( const char *, int, int *,
00291 int, int *, GDALProgressFunc, void * );
00292
00293 virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
00294 void *, int, int, GDALDataType,
00295 int, int *, int, int, int );
00296
00297 CPLErr BlockBasedRasterIO( GDALRWFlag, int, int, int, int,
00298 void *, int, int, GDALDataType,
00299 int, int *, int, int, int );
00300 void BlockBasedFlushCache();
00301
00302 CPLErr ValidateRasterIOOrAdviseReadParameters(
00303 const char* pszCallingFunc,
00304 int* pbStopProcessingOnCENone,
00305 int nXOff, int nYOff, int nXSize, int nYSize,
00306 int nBufXSize, int nBufYSize,
00307 int nBandCount, int *panBandMap);
00308
00309 virtual int CloseDependentDatasets();
00310
00311 friend class GDALRasterBand;
00312
00313 public:
00314 virtual ~GDALDataset();
00315
00316 int GetRasterXSize( void );
00317 int GetRasterYSize( void );
00318 int GetRasterCount( void );
00319 GDALRasterBand *GetRasterBand( int );
00320
00321 virtual void FlushCache(void);
00322
00323 virtual const char *GetProjectionRef(void);
00324 virtual CPLErr SetProjection( const char * );
00325
00326 virtual CPLErr GetGeoTransform( double * );
00327 virtual CPLErr SetGeoTransform( double * );
00328
00329 virtual CPLErr AddBand( GDALDataType eType,
00330 char **papszOptions=NULL );
00331
00332 virtual void *GetInternalHandle( const char * );
00333 virtual GDALDriver *GetDriver(void);
00334 virtual char **GetFileList(void);
00335
00336 virtual int GetGCPCount();
00337 virtual const char *GetGCPProjection();
00338 virtual const GDAL_GCP *GetGCPs();
00339 virtual CPLErr SetGCPs( int nGCPCount, const GDAL_GCP *pasGCPList,
00340 const char *pszGCPProjection );
00341
00342 virtual CPLErr AdviseRead( int nXOff, int nYOff, int nXSize, int nYSize,
00343 int nBufXSize, int nBufYSize,
00344 GDALDataType eDT,
00345 int nBandCount, int *panBandList,
00346 char **papszOptions );
00347
00348 virtual CPLErr CreateMaskBand( int nFlags );
00349
00350 virtual GDALAsyncReader*
00351 BeginAsyncReader(int nXOff, int nYOff, int nXSize, int nYSize,
00352 void *pBuf, int nBufXSize, int nBufYSize,
00353 GDALDataType eBufType,
00354 int nBandCount, int* panBandMap,
00355 int nPixelSpace, int nLineSpace, int nBandSpace,
00356 char **papszOptions);
00357 virtual void EndAsyncReader(GDALAsyncReader *);
00358
00359 CPLErr RasterIO( GDALRWFlag, int, int, int, int,
00360 void *, int, int, GDALDataType,
00361 int, int *, int, int, int );
00362
00363 int Reference();
00364 int Dereference();
00365 GDALAccess GetAccess() { return eAccess; }
00366
00367 int GetShared();
00368 void MarkAsShared();
00369
00370 static GDALDataset **GetOpenDatasets( int *pnDatasetCount );
00371
00372 CPLErr BuildOverviews( const char *, int, int *,
00373 int, int *, GDALProgressFunc, void * );
00374
00375 void ReportError(CPLErr eErrClass, int err_no, const char *fmt, ...) CPL_PRINT_FUNC_FORMAT (4, 5);
00376 };
00377
00378
00379
00380
00381
00383
00384 class CPL_DLL GDALRasterBlock
00385 {
00386 GDALDataType eType;
00387
00388 int bDirty;
00389 int nLockCount;
00390
00391 int nXOff;
00392 int nYOff;
00393
00394 int nXSize;
00395 int nYSize;
00396
00397 void *pData;
00398
00399 GDALRasterBand *poBand;
00400
00401 GDALRasterBlock *poNext;
00402 GDALRasterBlock *poPrevious;
00403
00404 public:
00405 GDALRasterBlock( GDALRasterBand *, int, int );
00406 virtual ~GDALRasterBlock();
00407
00408 CPLErr Internalize( void );
00409 void Touch( void );
00410 void MarkDirty( void );
00411 void MarkClean( void );
00412 void AddLock( void ) { nLockCount++; }
00413 void DropLock( void ) { nLockCount--; }
00414 void Detach();
00415
00416 CPLErr Write();
00417
00418 GDALDataType GetDataType() { return eType; }
00419 int GetXOff() { return nXOff; }
00420 int GetYOff() { return nYOff; }
00421 int GetXSize() { return nXSize; }
00422 int GetYSize() { return nYSize; }
00423 int GetDirty() { return bDirty; }
00424 int GetLockCount() { return nLockCount; }
00425
00426 void *GetDataRef( void ) { return pData; }
00427
00430 GDALRasterBand *GetBand() { return poBand; }
00431
00432 static int FlushCacheBlock();
00433 static void Verify();
00434
00435 static int SafeLockBlock( GDALRasterBlock ** );
00436
00437
00438 static void DestroyRBMutex();
00439 };
00440
00441
00442
00443
00444
00447 class CPL_DLL GDALColorTable
00448 {
00449 GDALPaletteInterp eInterp;
00450
00451 std::vector<GDALColorEntry> aoEntries;
00452
00453 public:
00454 GDALColorTable( GDALPaletteInterp = GPI_RGB );
00455 ~GDALColorTable();
00456
00457 GDALColorTable *Clone() const;
00458
00459 GDALPaletteInterp GetPaletteInterpretation() const;
00460
00461 int GetColorEntryCount() const;
00462 const GDALColorEntry *GetColorEntry( int ) const;
00463 int GetColorEntryAsRGB( int, GDALColorEntry * ) const;
00464 void SetColorEntry( int, const GDALColorEntry * );
00465 int CreateColorRamp( int, const GDALColorEntry * ,
00466 int, const GDALColorEntry * );
00467 };
00468
00469
00470
00471
00472
00474
00475 class CPL_DLL GDALRasterBand : public GDALMajorObject
00476 {
00477 private:
00478 CPLErr eFlushBlockErr;
00479
00480 void SetFlushBlockErr( CPLErr eErr );
00481
00482 friend class GDALRasterBlock;
00483
00484 protected:
00485 GDALDataset *poDS;
00486 int nBand;
00487
00488 int nRasterXSize;
00489 int nRasterYSize;
00490
00491 GDALDataType eDataType;
00492 GDALAccess eAccess;
00493
00494
00495 int nBlockXSize;
00496 int nBlockYSize;
00497 int nBlocksPerRow;
00498 int nBlocksPerColumn;
00499
00500 int bSubBlockingActive;
00501 int nSubBlocksPerRow;
00502 int nSubBlocksPerColumn;
00503 GDALRasterBlock **papoBlocks;
00504
00505 int nBlockReads;
00506 int bForceCachedIO;
00507
00508 GDALRasterBand *poMask;
00509 bool bOwnMask;
00510 int nMaskFlags;
00511
00512 friend class GDALDataset;
00513 friend class GDALProxyRasterBand;
00514
00515 protected:
00516 virtual CPLErr IReadBlock( int, int, void * ) = 0;
00517 virtual CPLErr IWriteBlock( int, int, void * );
00518 virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
00519 void *, int, int, GDALDataType,
00520 int, int );
00521 CPLErr OverviewRasterIO( GDALRWFlag, int, int, int, int,
00522 void *, int, int, GDALDataType,
00523 int, int );
00524
00525 int InitBlockInfo();
00526
00527 CPLErr AdoptBlock( int, int, GDALRasterBlock * );
00528 GDALRasterBlock *TryGetLockedBlockRef( int nXBlockOff, int nYBlockYOff );
00529
00530 public:
00531 GDALRasterBand();
00532
00533 virtual ~GDALRasterBand();
00534
00535 int GetXSize();
00536 int GetYSize();
00537 int GetBand();
00538 GDALDataset*GetDataset();
00539
00540 GDALDataType GetRasterDataType( void );
00541 void GetBlockSize( int *, int * );
00542 GDALAccess GetAccess();
00543
00544 CPLErr RasterIO( GDALRWFlag, int, int, int, int,
00545 void *, int, int, GDALDataType,
00546 int, int );
00547 CPLErr ReadBlock( int, int, void * );
00548
00549 CPLErr WriteBlock( int, int, void * );
00550
00551 GDALRasterBlock *GetLockedBlockRef( int nXBlockOff, int nYBlockOff,
00552 int bJustInitialize = FALSE );
00553 CPLErr FlushBlock( int = -1, int = -1, int bWriteDirtyBlock = TRUE );
00554
00555 unsigned char* GetIndexColorTranslationTo( GDALRasterBand* poReferenceBand,
00556 unsigned char* pTranslationTable = NULL,
00557 int* pApproximateMatching = NULL);
00558
00559
00560
00561 virtual CPLErr FlushCache();
00562 virtual char **GetCategoryNames();
00563 virtual double GetNoDataValue( int *pbSuccess = NULL );
00564 virtual double GetMinimum( int *pbSuccess = NULL );
00565 virtual double GetMaximum(int *pbSuccess = NULL );
00566 virtual double GetOffset( int *pbSuccess = NULL );
00567 virtual double GetScale( int *pbSuccess = NULL );
00568 virtual const char *GetUnitType();
00569 virtual GDALColorInterp GetColorInterpretation();
00570 virtual GDALColorTable *GetColorTable();
00571 virtual CPLErr Fill(double dfRealValue, double dfImaginaryValue = 0);
00572
00573 virtual CPLErr SetCategoryNames( char ** );
00574 virtual CPLErr SetNoDataValue( double );
00575 virtual CPLErr SetColorTable( GDALColorTable * );
00576 virtual CPLErr SetColorInterpretation( GDALColorInterp );
00577 virtual CPLErr SetOffset( double );
00578 virtual CPLErr SetScale( double );
00579 virtual CPLErr SetUnitType( const char * );
00580
00581 virtual CPLErr GetStatistics( int bApproxOK, int bForce,
00582 double *pdfMin, double *pdfMax,
00583 double *pdfMean, double *padfStdDev );
00584 virtual CPLErr ComputeStatistics( int bApproxOK,
00585 double *pdfMin, double *pdfMax,
00586 double *pdfMean, double *pdfStdDev,
00587 GDALProgressFunc, void *pProgressData );
00588 virtual CPLErr SetStatistics( double dfMin, double dfMax,
00589 double dfMean, double dfStdDev );
00590 virtual CPLErr ComputeRasterMinMax( int, double* );
00591
00592 virtual int HasArbitraryOverviews();
00593 virtual int GetOverviewCount();
00594 virtual GDALRasterBand *GetOverview(int);
00595 virtual GDALRasterBand *GetRasterSampleOverview( int );
00596 virtual CPLErr BuildOverviews( const char *, int, int *,
00597 GDALProgressFunc, void * );
00598
00599 virtual CPLErr AdviseRead( int nXOff, int nYOff, int nXSize, int nYSize,
00600 int nBufXSize, int nBufYSize,
00601 GDALDataType eDT, char **papszOptions );
00602
00603 virtual CPLErr GetHistogram( double dfMin, double dfMax,
00604 int nBuckets, int * panHistogram,
00605 int bIncludeOutOfRange, int bApproxOK,
00606 GDALProgressFunc, void *pProgressData );
00607
00608 virtual CPLErr GetDefaultHistogram( double *pdfMin, double *pdfMax,
00609 int *pnBuckets, int ** ppanHistogram,
00610 int bForce,
00611 GDALProgressFunc, void *pProgressData);
00612 virtual CPLErr SetDefaultHistogram( double dfMin, double dfMax,
00613 int nBuckets, int *panHistogram );
00614
00615 virtual GDALRasterAttributeTable *GetDefaultRAT();
00616 virtual CPLErr SetDefaultRAT( const GDALRasterAttributeTable * );
00617
00618 virtual GDALRasterBand *GetMaskBand();
00619 virtual int GetMaskFlags();
00620 virtual CPLErr CreateMaskBand( int nFlags );
00621
00622 virtual CPLVirtualMem *GetVirtualMemAuto( GDALRWFlag eRWFlag,
00623 int *pnPixelSpace,
00624 GIntBig *pnLineSpace,
00625 char **papszOptions );
00626
00627 void ReportError(CPLErr eErrClass, int err_no, const char *fmt, ...) CPL_PRINT_FUNC_FORMAT (4, 5);
00628 };
00629
00630
00631
00632
00633
00634 class CPL_DLL GDALAllValidMaskBand : public GDALRasterBand
00635 {
00636 protected:
00637 virtual CPLErr IReadBlock( int, int, void * );
00638
00639 public:
00640 GDALAllValidMaskBand( GDALRasterBand * );
00641 virtual ~GDALAllValidMaskBand();
00642
00643 virtual GDALRasterBand *GetMaskBand();
00644 virtual int GetMaskFlags();
00645 };
00646
00647
00648
00649
00650
00651 class CPL_DLL GDALNoDataMaskBand : public GDALRasterBand
00652 {
00653 double dfNoDataValue;
00654 GDALRasterBand *poParent;
00655
00656 protected:
00657 virtual CPLErr IReadBlock( int, int, void * );
00658 virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
00659 void *, int, int, GDALDataType,
00660 int, int );
00661
00662 public:
00663 GDALNoDataMaskBand( GDALRasterBand * );
00664 virtual ~GDALNoDataMaskBand();
00665 };
00666
00667
00668
00669
00670
00671 class CPL_DLL GDALNoDataValuesMaskBand : public GDALRasterBand
00672 {
00673 double *padfNodataValues;
00674
00675 protected:
00676 virtual CPLErr IReadBlock( int, int, void * );
00677
00678 public:
00679 GDALNoDataValuesMaskBand( GDALDataset * );
00680 virtual ~GDALNoDataValuesMaskBand();
00681 };
00682
00683
00684
00685
00686
00687
00699 class CPL_DLL GDALDriver : public GDALMajorObject
00700 {
00701 public:
00702 GDALDriver();
00703 ~GDALDriver();
00704
00705
00706
00707
00708 GDALDataset *Create( const char * pszName,
00709 int nXSize, int nYSize, int nBands,
00710 GDALDataType eType, char ** papszOptions ) CPL_WARN_UNUSED_RESULT;
00711
00712 CPLErr Delete( const char * pszName );
00713 CPLErr Rename( const char * pszNewName,
00714 const char * pszOldName );
00715 CPLErr CopyFiles( const char * pszNewName,
00716 const char * pszOldName );
00717
00718 GDALDataset *CreateCopy( const char *, GDALDataset *,
00719 int, char **,
00720 GDALProgressFunc pfnProgress,
00721 void * pProgressData ) CPL_WARN_UNUSED_RESULT;
00722
00723
00724
00725
00726
00727
00728 GDALDataset *(*pfnOpen)( GDALOpenInfo * );
00729
00730 GDALDataset *(*pfnCreate)( const char * pszName,
00731 int nXSize, int nYSize, int nBands,
00732 GDALDataType eType,
00733 char ** papszOptions );
00734
00735 CPLErr (*pfnDelete)( const char * pszName );
00736
00737 GDALDataset *(*pfnCreateCopy)( const char *, GDALDataset *,
00738 int, char **,
00739 GDALProgressFunc pfnProgress,
00740 void * pProgressData );
00741
00742 void *pDriverData;
00743
00744 void (*pfnUnloadDriver)(GDALDriver *);
00745
00746 int (*pfnIdentify)( GDALOpenInfo * );
00747
00748 CPLErr (*pfnRename)( const char * pszNewName,
00749 const char * pszOldName );
00750 CPLErr (*pfnCopyFiles)( const char * pszNewName,
00751 const char * pszOldName );
00752
00753
00754
00755
00756 GDALDataset *DefaultCreateCopy( const char *, GDALDataset *,
00757 int, char **,
00758 GDALProgressFunc pfnProgress,
00759 void * pProgressData ) CPL_WARN_UNUSED_RESULT;
00760 static CPLErr DefaultCopyMasks( GDALDataset *poSrcDS,
00761 GDALDataset *poDstDS,
00762 int bStrict );
00763 static CPLErr QuietDelete( const char * pszName );
00764
00765 CPLErr DefaultRename( const char * pszNewName,
00766 const char * pszOldName );
00767 CPLErr DefaultCopyFiles( const char * pszNewName,
00768 const char * pszOldName );
00769 };
00770
00771
00772
00773
00774
00782 class CPL_DLL GDALDriverManager : public GDALMajorObject
00783 {
00784 int nDrivers;
00785 GDALDriver **papoDrivers;
00786
00787 char *pszHome;
00788
00789 public:
00790 GDALDriverManager();
00791 ~GDALDriverManager();
00792
00793 int GetDriverCount( void );
00794 GDALDriver *GetDriver( int );
00795 GDALDriver *GetDriverByName( const char * );
00796
00797 int RegisterDriver( GDALDriver * );
00798 void MoveDriver( GDALDriver *, int );
00799 void DeregisterDriver( GDALDriver * );
00800
00801 void AutoLoadDrivers();
00802 void AutoSkipDrivers();
00803
00804 const char *GetHome();
00805 void SetHome( const char * );
00806 };
00807
00808 CPL_C_START
00809 GDALDriverManager CPL_DLL * GetGDALDriverManager( void );
00810 CPL_C_END
00811
00812
00813
00814
00815
00821 class CPL_DLL GDALAsyncReader
00822 {
00823 protected:
00824 GDALDataset* poDS;
00825 int nXOff;
00826 int nYOff;
00827 int nXSize;
00828 int nYSize;
00829 void * pBuf;
00830 int nBufXSize;
00831 int nBufYSize;
00832 GDALDataType eBufType;
00833 int nBandCount;
00834 int* panBandMap;
00835 int nPixelSpace;
00836 int nLineSpace;
00837 int nBandSpace;
00838
00839 public:
00840 GDALAsyncReader();
00841 virtual ~GDALAsyncReader();
00842
00843 GDALDataset* GetGDALDataset() {return poDS;}
00844 int GetXOffset() {return nXOff;}
00845 int GetYOffset() {return nYOff;}
00846 int GetXSize() {return nXSize;}
00847 int GetYSize() {return nYSize;}
00848 void * GetBuffer() {return pBuf;}
00849 int GetBufferXSize() {return nBufXSize;}
00850 int GetBufferYSize() {return nBufYSize;}
00851 GDALDataType GetBufferType() {return eBufType;}
00852 int GetBandCount() {return nBandCount;}
00853 int* GetBandMap() {return panBandMap;}
00854 int GetPixelSpace() {return nPixelSpace;}
00855 int GetLineSpace() {return nLineSpace;}
00856 int GetBandSpace() {return nBandSpace;}
00857
00858 virtual GDALAsyncStatusType
00859 GetNextUpdatedRegion(double dfTimeout,
00860 int* pnBufXOff, int* pnBufYOff,
00861 int* pnBufXSize, int* pnBufYSize) = 0;
00862 virtual int LockBuffer( double dfTimeout = -1.0 );
00863 virtual void UnlockBuffer();
00864 };
00865
00866
00867
00868
00869
00870
00871 CPLErr
00872 GDALRegenerateOverviewsMultiBand(int nBands, GDALRasterBand** papoSrcBands,
00873 int nOverviews,
00874 GDALRasterBand*** papapoOverviewBands,
00875 const char * pszResampling,
00876 GDALProgressFunc pfnProgress, void * pProgressData );
00877
00878 CPL_C_START
00879
00880 #ifndef WIN32CE
00881
00882 CPLErr CPL_DLL
00883 HFAAuxBuildOverviews( const char *pszOvrFilename, GDALDataset *poParentDS,
00884 GDALDataset **ppoDS,
00885 int nBands, int *panBandList,
00886 int nNewOverviews, int *panNewOverviewList,
00887 const char *pszResampling,
00888 GDALProgressFunc pfnProgress,
00889 void *pProgressData );
00890
00891 #endif
00892
00893 CPLErr CPL_DLL
00894 GTIFFBuildOverviews( const char * pszFilename,
00895 int nBands, GDALRasterBand **papoBandList,
00896 int nOverviews, int * panOverviewList,
00897 const char * pszResampling,
00898 GDALProgressFunc pfnProgress, void * pProgressData );
00899
00900 CPLErr CPL_DLL
00901 GDALDefaultBuildOverviews( GDALDataset *hSrcDS, const char * pszBasename,
00902 const char * pszResampling,
00903 int nOverviews, int * panOverviewList,
00904 int nBands, int * panBandList,
00905 GDALProgressFunc pfnProgress, void * pProgressData);
00906
00907 int CPL_DLL GDALBandGetBestOverviewLevel(GDALRasterBand* poBand,
00908 int &nXOff, int &nYOff,
00909 int &nXSize, int &nYSize,
00910 int nBufXSize, int nBufYSize);
00911
00912 int CPL_DLL GDALOvLevelAdjust( int nOvLevel, int nXSize );
00913
00914 GDALDataset CPL_DLL *
00915 GDALFindAssociatedAuxFile( const char *pszBasefile, GDALAccess eAccess,
00916 GDALDataset *poDependentDS );
00917
00918
00919
00920
00921
00922 CPLErr CPL_DLL GDALParseGMLCoverage( CPLXMLNode *psTree,
00923 int *pnXSize, int *pnYSize,
00924 double *padfGeoTransform,
00925 char **ppszProjection );
00926
00927
00928
00929
00930
00931 int CPL_DLL GDALCheckDatasetDimensions( int nXSize, int nYSize );
00932 int CPL_DLL GDALCheckBandCount( int nBands, int bIsZeroAllowed );
00933
00934
00935
00936
00937 #define ARE_REAL_EQUAL(dfVal1, dfVal2) \
00938 (dfVal1 == dfVal2 || fabs(dfVal1 - dfVal2) < 1e-10 || (dfVal2 != 0 && fabs(1 - dfVal1 / dfVal2) < 1e-10 ))
00939
00940
00941
00942
00943 int CPL_DLL GDALReadWorldFile2( const char *pszBaseFilename, const char *pszExtension,
00944 double *padfGeoTransform, char** papszSiblingFiles,
00945 char** ppszWorldFileNameOut);
00946 int GDALReadTabFile2( const char * pszBaseFilename,
00947 double *padfGeoTransform, char **ppszWKT,
00948 int *pnGCPCount, GDAL_GCP **ppasGCPs,
00949 char** papszSiblingFiles, char** ppszTabFileNameOut );
00950
00951 CPL_C_END
00952
00953 void GDALNullifyOpenDatasetsList();
00954 void** GDALGetphDMMutex();
00955 void** GDALGetphDLMutex();
00956 void GDALNullifyProxyPoolSingleton();
00957 GDALDriver* GDALGetAPIPROXYDriver();
00958 void GDALSetResponsiblePIDForCurrentThread(GIntBig responsiblePID);
00959 GIntBig GDALGetResponsiblePIDForCurrentThread();
00960
00961 CPLString GDALFindAssociatedFile( const char *pszBasename, const char *pszExt,
00962 char **papszSiblingFiles, int nFlags );
00963
00964 CPLErr EXIFExtractMetadata(char**& papszMetadata,
00965 void *fpL, int nOffset,
00966 int bSwabflag, int nTIFFHEADER,
00967 int& nExifOffset, int& nInterOffset, int& nGPSOffset);
00968
00969 #define DIV_ROUND_UP(a, b) ( ((a) % (b)) == 0 ? ((a) / (b)) : (((a) / (b)) + 1) )
00970
00971
00972
00973 #define GDALSTAT_APPROX_NUMSAMPLES 2500
00974
00975 CPL_C_START
00976
00977
00978 void GDALSerializeGCPListToXML( CPLXMLNode* psParentNode,
00979 GDAL_GCP* pasGCPList,
00980 int nGCPCount,
00981 const char* pszGCPProjection );
00982 void GDALDeserializeGCPListFromXML( CPLXMLNode* psGCPList,
00983 GDAL_GCP** ppasGCPList,
00984 int* pnGCPCount,
00985 char** ppszGCPProjection );
00986 CPL_C_END
00987
00988 #endif