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
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
#ifndef GDAL_PRIV_H_INCLUDED
00173
#define GDAL_PRIV_H_INCLUDED
00174
00175
00176
00177
00178
00179
class GDALMajorObject;
00180
class GDALDataset;
00181
class GDALRasterBand;
00182
class GDALDriver;
00183
00184
00185
00186
00187
00188
00189
00190
#include "gdal.h"
00191
#include "gdal_frmts.h"
00192
#include "cpl_vsi.h"
00193
#include "cpl_conv.h"
00194
00195
00196
00197
00198
00199
00200
00201
00202
class CPL_DLL GDALMajorObject
00203 {
00204
protected:
00205
char *pszDescription;
00206
char **papszMetadata;
00207
00208
public:
00209 GDALMajorObject();
00210
virtual ~GDALMajorObject();
00211
00212
virtual const char *GetDescription() const;
00213 virtual
void SetDescription( const
char * );
00214
00215 virtual
char **GetMetadata( const
char * pszDomain = "" );
00216 virtual CPLErr SetMetadata(
char ** papszMetadata,
00217 const
char * pszDomain = "" );
00218 virtual const
char *GetMetadataItem( const
char * pszName,
00219 const
char * pszDomain = "" );
00220 virtual CPLErr SetMetadataItem( const
char * pszName,
00221 const
char * pszValue,
00222 const
char * pszDomain = "" );
00223 };
00224
00225
00226
00227
00228 class CPL_DLL GDALDefaultOverviews
00229 {
00230
GDALDataset *poDS;
00231
GDALDataset *poODS;
00232
00233
char *pszOvrFilename;
00234
00235
public:
00236 GDALDefaultOverviews();
00237 ~GDALDefaultOverviews();
00238
00239
void Initialize(
GDALDataset *poDS,
const char *pszName = NULL,
00240
int bNameIsOVR = FALSE );
00241
int IsInitialized() {
return poDS != NULL; }
00242
00243
int GetOverviewCount(
int);
00244
GDALRasterBand *GetOverview(
int,
int);
00245
00246 CPLErr BuildOverviews(
const char * pszBasename,
00247
const char * pszResampling,
00248
int nOverviews,
int * panOverviewList,
00249
int nBands,
int * panBandList,
00250
GDALProgressFunc pfnProgress,
00251
void *pProgressData );
00252 };
00253
00254
00255
00256
00257
00258 class CPL_DLL GDALDataset :
public GDALMajorObject
00259 {
00260
friend GDALDatasetH
GDALOpen(
const char *,
GDALAccess);
00261
friend GDALDatasetH
GDALOpenShared(
const char *,
GDALAccess);
00262
friend class GDALDriver;
00263
00264
protected:
00265
GDALDriver *poDriver;
00266
GDALAccess eAccess;
00267
00268
00269
int nRasterXSize;
00270
int nRasterYSize;
00271
int nBands;
00272
GDALRasterBand **papoBands;
00273
00274
int nRefCount;
00275
int bShared;
00276
00277 GDALDataset(
void);
00278
void RasterInitialize(
int,
int );
00279
void SetBand(
int,
GDALRasterBand * );
00280
00281 GDALDefaultOverviews oOvManager;
00282
00283
virtual CPLErr IBuildOverviews(
const char *,
int,
int *,
00284
int,
int *,
GDALProgressFunc,
void * );
00285
00286
virtual CPLErr IRasterIO(
GDALRWFlag,
int,
int,
int,
int,
00287
void *,
int,
int,
GDALDataType,
00288
int,
int *,
int,
int,
int );
00289
00290 CPLErr BlockBasedRasterIO(
GDALRWFlag,
int,
int,
int,
int,
00291
void *,
int,
int,
GDALDataType,
00292
int,
int *,
int,
int,
int );
00293
void BlockBasedFlushCache();
00294
00295
friend class GDALRasterBand;
00296
00297
public:
00298
virtual ~GDALDataset();
00299
00300
int GetRasterXSize(
void );
00301
int GetRasterYSize(
void );
00302
int GetRasterCount(
void );
00303
GDALRasterBand *GetRasterBand(
int );
00304
00305
virtual void FlushCache(
void);
00306
00307
virtual const char *GetProjectionRef(
void);
00308
virtual CPLErr SetProjection(
const char * );
00309
00310
virtual CPLErr GetGeoTransform(
double * );
00311
virtual CPLErr SetGeoTransform(
double * );
00312
00313
virtual CPLErr AddBand(
GDALDataType eType,
00314
char **papszOptions=NULL );
00315
00316
virtual void *GetInternalHandle(
const char * );
00317
virtual GDALDriver *GetDriver(
void);
00318
00319
virtual int GetGCPCount();
00320
virtual const char *GetGCPProjection();
00321
virtual const GDAL_GCP *GetGCPs();
00322
virtual CPLErr SetGCPs(
int nGCPCount,
const GDAL_GCP *pasGCPList,
00323
const char *pszGCPProjection );
00324
00325 CPLErr RasterIO(
GDALRWFlag,
int,
int,
int,
int,
00326
void *,
int,
int,
GDALDataType,
00327
int,
int *,
int,
int,
int );
00328
00329
int Reference();
00330
int Dereference();
00331
GDALAccess GetAccess() {
return eAccess; }
00332
00333
int GetShared();
00334
void MarkAsShared();
00335
00336
static GDALDataset **GetOpenDatasets(
int *pnDatasetCount );
00337
00338 CPLErr BuildOverviews(
const char *,
int,
int *,
00339
int,
int *,
GDALProgressFunc,
void * );
00340 };
00341
00342
00343
00344
00345
00348 class CPL_DLL GDALRasterBlock
00349 {
00350
GDALDataType eType;
00351
00352
int nAge;
00353
int bDirty;
00354
int nLockCount;
00355
00356
int nXOff;
00357
int nYOff;
00358
00359
int nXSize;
00360
int nYSize;
00361
00362
void *pData;
00363
00364
GDALRasterBand *poBand;
00365
00366 GDALRasterBlock *poNext;
00367 GDALRasterBlock *poPrevious;
00368
00369
public:
00370 GDALRasterBlock(
GDALRasterBand *,
int,
int );
00371
virtual ~GDALRasterBlock();
00372
00373 CPLErr Internalize(
void );
00374
void Touch(
void );
00375
void MarkDirty(
void );
00376
void MarkClean(
void );
00377
void AddLock(
void ) { nLockCount++; }
00378
void DropLock(
void ) { nLockCount--; }
00379
00380 CPLErr Write();
00381
00382
GDALDataType GetDataType() {
return eType; }
00383
int GetXOff() {
return nXOff; }
00384
int GetYOff() {
return nYOff; }
00385
int GetXSize() {
return nXSize; }
00386
int GetYSize() {
return nYSize; }
00387
int GetAge() {
return nAge; }
00388
int GetDirty() {
return bDirty; }
00389
int GetLockCount() {
return nLockCount; }
00390
00391
void *GetDataRef(
void ) {
return pData; }
00392
00393
GDALRasterBand *GetBand() {
return poBand; }
00394
00395
static int FlushCacheBlock();
00396
static void Verify();
00397 };
00398
00399
00400
00401
00402
00403
00404
class CPL_DLL GDALColorTable
00405 {
00406
GDALPaletteInterp eInterp;
00407
00408
int nEntryCount;
00409
GDALColorEntry *paoEntries;
00410
00411
public:
00412 GDALColorTable( GDALPaletteInterp = GPI_RGB );
00413 ~GDALColorTable();
00414
00415 GDALColorTable *Clone() const;
00416
00417 GDALPaletteInterp GetPaletteInterpretation() const;
00418
00419
int GetColorEntryCount() const;
00420 const
GDALColorEntry *GetColorEntry(
int ) const;
00421
int GetColorEntryAsRGB(
int,
GDALColorEntry * ) const;
00422
void SetColorEntry(
int, const
GDALColorEntry * );
00423 };
00424
00425
00426
00427
00428
00430
00431 class CPL_DLL
GDALRasterBand : public GDALMajorObject
00432 {
00433
protected:
00434 GDALDataset *poDS;
00435
int nBand;
00436
00437
int nRasterXSize;
00438
int nRasterYSize;
00439
00440
GDALDataType eDataType;
00441
GDALAccess eAccess;
00442
00443
00444
int nBlockXSize;
00445
int nBlockYSize;
00446
int nBlocksPerRow;
00447
int nBlocksPerColumn;
00448
00449 GDALRasterBlock **papoBlocks;
00450
00451
int nBlockReads;
00452
00453
friend class GDALDataset;
00454
friend class GDALRasterBlock;
00455
00456
protected:
00457
virtual CPLErr IReadBlock(
int,
int,
void * ) = 0;
00458
virtual CPLErr IWriteBlock(
int,
int,
void * );
00459
virtual CPLErr IRasterIO(
GDALRWFlag,
int,
int,
int,
int,
00460
void *,
int,
int,
GDALDataType,
00461
int,
int );
00462 CPLErr OverviewRasterIO(
GDALRWFlag,
int,
int,
int,
int,
00463
void *,
int,
int,
GDALDataType,
00464
int,
int );
00465
00466 CPLErr AdoptBlock(
int,
int, GDALRasterBlock * );
00467
void InitBlockInfo();
00468
int IsBlockCached(
int,
int );
00469
00470
public:
00471
GDALRasterBand();
00472
00473
virtual ~
GDALRasterBand();
00474
00475
int GetXSize();
00476
int GetYSize();
00477
int GetBand();
00478 GDALDataset*GetDataset();
00479
00480
GDALDataType GetRasterDataType(
void );
00481
void GetBlockSize(
int *,
int * );
00482
GDALAccess GetAccess();
00483
00484 CPLErr RasterIO(
GDALRWFlag,
int,
int,
int,
int,
00485
void *,
int,
int,
GDALDataType,
00486
int,
int );
00487 CPLErr ReadBlock(
int,
int,
void * );
00488
00489 CPLErr WriteBlock(
int,
int,
void * );
00490
00491 GDALRasterBlock *GetBlockRef(
int nXBlockOff,
int nYBlockOff,
00492
int bJustInitialize = FALSE );
00493 CPLErr FlushBlock(
int = -1,
int = -1 );
00494
00495
00496
00497
virtual CPLErr FlushCache();
00498
virtual char **GetCategoryNames();
00499
virtual double GetNoDataValue(
int *pbSuccess = NULL );
00500
virtual double GetMinimum(
int *pbSuccess = NULL );
00501
virtual double GetMaximum(
int *pbSuccess = NULL );
00502
virtual double GetOffset(
int *pbSuccess = NULL );
00503
virtual double GetScale(
int *pbSuccess = NULL );
00504
virtual const char *GetUnitType();
00505
virtual GDALColorInterp GetColorInterpretation();
00506
virtual GDALColorTable *GetColorTable();
00507
virtual CPLErr Fill(
double dfRealValue,
double dfImaginaryValue = 0);
00508
00509
virtual CPLErr SetCategoryNames(
char ** );
00510
virtual CPLErr SetNoDataValue(
double );
00511
virtual CPLErr SetColorTable( GDALColorTable * );
00512
virtual CPLErr SetColorInterpretation(
GDALColorInterp );
00513
00514
virtual int HasArbitraryOverviews();
00515
virtual int GetOverviewCount();
00516
virtual GDALRasterBand *GetOverview(
int);
00517
virtual CPLErr BuildOverviews(
const char *,
int,
int *,
00518
GDALProgressFunc,
void * );
00519
00520 CPLErr GetHistogram(
double dfMin,
double dfMax,
00521
int nBuckets,
int * panHistogram,
00522
int bIncludeOutOfRange,
int bApproxOK,
00523
GDALProgressFunc,
void *pProgressData );
00524 };
00525
00526
00527
00528
00529
00530
00531
00532
class CPL_DLL GDALOpenInfo
00533 {
00534
public:
00535
00536 GDALOpenInfo(
const char * pszFile, GDALAccess eAccessIn );
00537 ~GDALOpenInfo(
void );
00538
00539
char *pszFilename;
00540
00541
GDALAccess eAccess;
00542
00543
int bStatOK;
00544
int bIsDirectory;
00545
00546 FILE *fp;
00547
00548
int nHeaderBytes;
00549 GByte *pabyHeader;
00550
00551 };
00552
00553
00554
00555
00556
00566 class CPL_DLL GDALDriver :
public GDALMajorObject
00567 {
00568
public:
00569 GDALDriver();
00570 ~GDALDriver();
00571
00572
00573
00574
00575 GDALDataset *Create(
const char * pszName,
00576
int nXSize,
int nYSize,
int nBands,
00577
GDALDataType eType,
char ** papszOptions );
00578
00579 CPLErr Delete(
const char * pszName );
00580
00581 GDALDataset *CreateCopy(
const char *, GDALDataset *,
00582
int,
char **,
00583
GDALProgressFunc pfnProgress,
00584
void * pProgressData );
00585
00586
00587
00588
00589
00590
00591 GDALDataset *(*pfnOpen)( GDALOpenInfo * );
00592
00593 GDALDataset *(*pfnCreate)(
const char * pszName,
00594
int nXSize,
int nYSize,
int nBands,
00595
GDALDataType eType,
00596
char ** papszOptions );
00597
00598 CPLErr (*pfnDelete)(
const char * pszName );
00599
00600 GDALDataset *(*pfnCreateCopy)(
const char *, GDALDataset *,
00601
int,
char **,
00602
GDALProgressFunc pfnProgress,
00603
void * pProgressData );
00604
00605
void *pDriverData;
00606
00607 void (*pfnUnloadDriver)(GDALDriver *);
00608 };
00609
00610
00611
00612
00613
00621 class CPL_DLL GDALDriverManager :
public GDALMajorObject
00622 {
00623
int nDrivers;
00624 GDALDriver **papoDrivers;
00625
00626
char *pszHome;
00627
00628
public:
00629 GDALDriverManager();
00630 ~GDALDriverManager();
00631
00632
int GetDriverCount(
void );
00633 GDALDriver *GetDriver(
int );
00634 GDALDriver *GetDriverByName(
const char * );
00635
00636
int RegisterDriver( GDALDriver * );
00637
void MoveDriver( GDALDriver *,
int );
00638
void DeregisterDriver( GDALDriver * );
00639
00640
void AutoLoadDrivers();
00641
void AutoSkipDrivers();
00642
00643
const char *GetHome();
00644
void SetHome(
const char * );
00645 };
00646
00647 CPL_C_START
00648 GDALDriverManager CPL_DLL * GetGDALDriverManager(
void );
00649 CPL_C_END
00650
00651
00652
00653
00654
00655 CPL_C_START
00656
00657 CPLErr
00658 GTIFFBuildOverviews(
const char * pszFilename,
00659
int nBands,
GDALRasterBand **papoBandList,
00660
int nOverviews,
int * panOverviewList,
00661
const char * pszResampling,
00662
GDALProgressFunc pfnProgress,
void * pProgressData );
00663
00664 CPLErr
00665 GDALDefaultBuildOverviews( GDALDataset *hSrcDS,
const char * pszBasename,
00666
const char * pszResampling,
00667
int nOverviews,
int * panOverviewList,
00668
int nBands,
int * panBandList,
00669
GDALProgressFunc pfnProgress,
void * pProgressData);
00670
00671
00672 CPLErr
00673 GDALRegenerateOverviews(
GDALRasterBand *,
int,
GDALRasterBand **,
00674
const char *,
GDALProgressFunc,
void * );
00675
00676 CPL_C_END
00677
00678
#endif