GDAL
|
00001 /****************************************************************************** 00002 * $Id: gdal_priv.h 23431 2011-11-27 15:02:24Z rouault $ 00003 * 00004 * Name: gdal_priv.h 00005 * Project: GDAL Core 00006 * Purpose: GDAL Core C++/Private declarations. 00007 * Author: Frank Warmerdam, warmerdam@pobox.com 00008 * 00009 ****************************************************************************** 00010 * Copyright (c) 1998, Frank Warmerdam 00011 * 00012 * Permission is hereby granted, free of charge, to any person obtaining a 00013 * copy of this software and associated documentation files (the "Software"), 00014 * to deal in the Software without restriction, including without limitation 00015 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00016 * and/or sell copies of the Software, and to permit persons to whom the 00017 * Software is furnished to do so, subject to the following conditions: 00018 * 00019 * The above copyright notice and this permission notice shall be included 00020 * in all copies or substantial portions of the Software. 00021 * 00022 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00023 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00024 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00025 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00026 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00027 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 00028 * DEALINGS IN THE SOFTWARE. 00029 ****************************************************************************/ 00030 00031 #ifndef GDAL_PRIV_H_INCLUDED 00032 #define GDAL_PRIV_H_INCLUDED 00033 00034 /* -------------------------------------------------------------------- */ 00035 /* Predeclare various classes before pulling in gdal.h, the */ 00036 /* public declarations. */ 00037 /* -------------------------------------------------------------------- */ 00038 class GDALMajorObject; 00039 class GDALDataset; 00040 class GDALRasterBand; 00041 class GDALDriver; 00042 class GDALRasterAttributeTable; 00043 class GDALProxyDataset; 00044 class GDALProxyRasterBand; 00045 class GDALAsyncReader; 00046 00047 /* -------------------------------------------------------------------- */ 00048 /* Pull in the public declarations. This gets the C apis, and */ 00049 /* also various constants. However, we will still get to */ 00050 /* provide the real class definitions for the GDAL classes. */ 00051 /* -------------------------------------------------------------------- */ 00052 00053 #include "gdal.h" 00054 #include "gdal_frmts.h" 00055 #include "cpl_vsi.h" 00056 #include "cpl_conv.h" 00057 #include "cpl_string.h" 00058 #include "cpl_minixml.h" 00059 #include <vector> 00060 00061 #define GMO_VALID 0x0001 00062 #define GMO_IGNORE_UNIMPLEMENTED 0x0002 00063 #define GMO_SUPPORT_MD 0x0004 00064 #define GMO_SUPPORT_MDMD 0x0008 00065 #define GMO_MD_DIRTY 0x0010 00066 #define GMO_PAM_CLASS 0x0020 00067 00068 /************************************************************************/ 00069 /* GDALMultiDomainMetadata */ 00070 /************************************************************************/ 00071 00072 class CPL_DLL GDALMultiDomainMetadata 00073 { 00074 private: 00075 char **papszDomainList; 00076 CPLStringList **papoMetadataLists; 00077 00078 public: 00079 GDALMultiDomainMetadata(); 00080 ~GDALMultiDomainMetadata(); 00081 00082 int XMLInit( CPLXMLNode *psMetadata, int bMerge ); 00083 CPLXMLNode *Serialize(); 00084 00085 char **GetDomainList() { return papszDomainList; } 00086 00087 char **GetMetadata( const char * pszDomain = "" ); 00088 CPLErr SetMetadata( char ** papszMetadata, 00089 const char * pszDomain = "" ); 00090 const char *GetMetadataItem( const char * pszName, 00091 const char * pszDomain = "" ); 00092 CPLErr SetMetadataItem( const char * pszName, 00093 const char * pszValue, 00094 const char * pszDomain = "" ); 00095 00096 void Clear(); 00097 }; 00098 00099 /* ******************************************************************** */ 00100 /* GDALMajorObject */ 00101 /* */ 00102 /* Base class providing metadata, description and other */ 00103 /* services shared by major objects. */ 00104 /* ******************************************************************** */ 00105 00107 00108 class CPL_DLL GDALMajorObject 00109 { 00110 protected: 00111 int nFlags; // GMO_* flags. 00112 CPLString sDescription; 00113 GDALMultiDomainMetadata oMDMD; 00114 00115 public: 00116 GDALMajorObject(); 00117 virtual ~GDALMajorObject(); 00118 00119 int GetMOFlags(); 00120 void SetMOFlags(int nFlags); 00121 00122 virtual const char *GetDescription() const; 00123 virtual void SetDescription( const char * ); 00124 00125 virtual char **GetMetadata( const char * pszDomain = "" ); 00126 virtual CPLErr SetMetadata( char ** papszMetadata, 00127 const char * pszDomain = "" ); 00128 virtual const char *GetMetadataItem( const char * pszName, 00129 const char * pszDomain = "" ); 00130 virtual CPLErr SetMetadataItem( const char * pszName, 00131 const char * pszValue, 00132 const char * pszDomain = "" ); 00133 }; 00134 00135 /* ******************************************************************** */ 00136 /* GDALDefaultOverviews */ 00137 /* ******************************************************************** */ 00138 class CPL_DLL GDALDefaultOverviews 00139 { 00140 friend class GDALDataset; 00141 00142 GDALDataset *poDS; 00143 GDALDataset *poODS; 00144 00145 CPLString osOvrFilename; 00146 00147 int bOvrIsAux; 00148 00149 int bCheckedForMask; 00150 int bOwnMaskDS; 00151 GDALDataset *poMaskDS; 00152 00153 // for "overview datasets" we record base level info so we can 00154 // find our way back to get overview masks. 00155 GDALDataset *poBaseDS; 00156 00157 // Stuff for deferred initialize/overviewscans... 00158 bool bCheckedForOverviews; 00159 void OverviewScan(); 00160 char *pszInitName; 00161 int bInitNameIsOVR; 00162 char **papszInitSiblingFiles; 00163 00164 public: 00165 GDALDefaultOverviews(); 00166 ~GDALDefaultOverviews(); 00167 00168 void Initialize( GDALDataset *poDS, const char *pszName = NULL, 00169 char **papszSiblingFiles = NULL, 00170 int bNameIsOVR = FALSE ); 00171 00172 int IsInitialized(); 00173 00174 int CloseDependentDatasets(); 00175 00176 // Overview Related 00177 00178 int GetOverviewCount(int); 00179 GDALRasterBand *GetOverview(int,int); 00180 00181 CPLErr BuildOverviews( const char * pszBasename, 00182 const char * pszResampling, 00183 int nOverviews, int * panOverviewList, 00184 int nBands, int * panBandList, 00185 GDALProgressFunc pfnProgress, 00186 void *pProgressData ); 00187 00188 CPLErr BuildOverviewsSubDataset( const char * pszPhysicalFile, 00189 const char * pszResampling, 00190 int nOverviews, int * panOverviewList, 00191 int nBands, int * panBandList, 00192 GDALProgressFunc pfnProgress, 00193 void *pProgressData ); 00194 00195 CPLErr CleanOverviews(); 00196 00197 // Mask Related 00198 00199 CPLErr CreateMaskBand( int nFlags, int nBand = -1 ); 00200 GDALRasterBand *GetMaskBand( int nBand ); 00201 int GetMaskFlags( int nBand ); 00202 00203 int HaveMaskFile( char **papszSiblings = NULL, 00204 const char *pszBasename = NULL ); 00205 00206 char** GetSiblingFiles() { return papszInitSiblingFiles; } 00207 }; 00208 00209 /* ******************************************************************** */ 00210 /* GDALOpenInfo */ 00211 /* */ 00212 /* Structure of data about dataset for open functions. */ 00213 /* ******************************************************************** */ 00214 00215 class CPL_DLL GDALOpenInfo 00216 { 00217 public: 00218 GDALOpenInfo( const char * pszFile, GDALAccess eAccessIn, 00219 char **papszSiblingFiles = NULL ); 00220 ~GDALOpenInfo( void ); 00221 00222 char *pszFilename; 00223 char **papszSiblingFiles; 00224 00225 GDALAccess eAccess; 00226 00227 int bStatOK; 00228 int bIsDirectory; 00229 00230 FILE *fp; 00231 00232 int nHeaderBytes; 00233 GByte *pabyHeader; 00234 00235 }; 00236 00237 /* ******************************************************************** */ 00238 /* GDALDataset */ 00239 /* ******************************************************************** */ 00240 00241 /* Internal method for now. Might be subject to later revisions */ 00242 GDALDatasetH GDALOpenInternal( const char * pszFilename, GDALAccess eAccess, 00243 const char* const * papszAllowedDrivers); 00244 GDALDatasetH GDALOpenInternal( GDALOpenInfo& oOpenInfo, 00245 const char* const * papszAllowedDrivers); 00246 00248 00249 class CPL_DLL GDALDataset : public GDALMajorObject 00250 { 00251 friend GDALDatasetH CPL_STDCALL GDALOpen( const char *, GDALAccess); 00252 friend GDALDatasetH CPL_STDCALL GDALOpenShared( const char *, GDALAccess); 00253 00254 /* Internal method for now. Might be subject to later revisions */ 00255 friend GDALDatasetH GDALOpenInternal( const char *, GDALAccess, const char* const * papszAllowedDrivers); 00256 friend GDALDatasetH GDALOpenInternal( GDALOpenInfo& oOpenInfo, 00257 const char* const * papszAllowedDrivers); 00258 00259 friend class GDALDriver; 00260 friend class GDALDefaultOverviews; 00261 friend class GDALProxyDataset; 00262 friend class GDALDriverManager; 00263 00264 protected: 00265 GDALDriver *poDriver; 00266 GDALAccess eAccess; 00267 00268 // Stored raster information. 00269 int nRasterXSize; 00270 int nRasterYSize; 00271 int nBands; 00272 GDALRasterBand **papoBands; 00273 00274 int bForceCachedIO; 00275 00276 int nRefCount; 00277 int bShared; 00278 00279 GDALDataset(void); 00280 void RasterInitialize( int, int ); 00281 void SetBand( int, GDALRasterBand * ); 00282 00283 GDALDefaultOverviews oOvManager; 00284 00285 virtual CPLErr IBuildOverviews( const char *, int, int *, 00286 int, int *, GDALProgressFunc, void * ); 00287 00288 virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int, 00289 void *, int, int, GDALDataType, 00290 int, int *, int, int, int ); 00291 00292 CPLErr BlockBasedRasterIO( GDALRWFlag, int, int, int, int, 00293 void *, int, int, GDALDataType, 00294 int, int *, int, int, int ); 00295 void BlockBasedFlushCache(); 00296 00297 virtual int CloseDependentDatasets(); 00298 00299 friend class GDALRasterBand; 00300 00301 public: 00302 virtual ~GDALDataset(); 00303 00304 int GetRasterXSize( void ); 00305 int GetRasterYSize( void ); 00306 int GetRasterCount( void ); 00307 GDALRasterBand *GetRasterBand( int ); 00308 00309 virtual void FlushCache(void); 00310 00311 virtual const char *GetProjectionRef(void); 00312 virtual CPLErr SetProjection( const char * ); 00313 00314 virtual CPLErr GetGeoTransform( double * ); 00315 virtual CPLErr SetGeoTransform( double * ); 00316 00317 virtual CPLErr AddBand( GDALDataType eType, 00318 char **papszOptions=NULL ); 00319 00320 virtual void *GetInternalHandle( const char * ); 00321 virtual GDALDriver *GetDriver(void); 00322 virtual char **GetFileList(void); 00323 00324 virtual int GetGCPCount(); 00325 virtual const char *GetGCPProjection(); 00326 virtual const GDAL_GCP *GetGCPs(); 00327 virtual CPLErr SetGCPs( int nGCPCount, const GDAL_GCP *pasGCPList, 00328 const char *pszGCPProjection ); 00329 00330 virtual CPLErr AdviseRead( int nXOff, int nYOff, int nXSize, int nYSize, 00331 int nBufXSize, int nBufYSize, 00332 GDALDataType eDT, 00333 int nBandCount, int *panBandList, 00334 char **papszOptions ); 00335 00336 virtual CPLErr CreateMaskBand( int nFlags ); 00337 00338 virtual GDALAsyncReader* 00339 BeginAsyncReader(int nXOff, int nYOff, int nXSize, int nYSize, 00340 void *pBuf, int nBufXSize, int nBufYSize, 00341 GDALDataType eBufType, 00342 int nBandCount, int* panBandMap, 00343 int nPixelSpace, int nLineSpace, int nBandSpace, 00344 char **papszOptions); 00345 virtual void EndAsyncReader(GDALAsyncReader *); 00346 00347 CPLErr RasterIO( GDALRWFlag, int, int, int, int, 00348 void *, int, int, GDALDataType, 00349 int, int *, int, int, int ); 00350 00351 int Reference(); 00352 int Dereference(); 00353 GDALAccess GetAccess() { return eAccess; } 00354 00355 int GetShared(); 00356 void MarkAsShared(); 00357 00358 static GDALDataset **GetOpenDatasets( int *pnDatasetCount ); 00359 00360 CPLErr BuildOverviews( const char *, int, int *, 00361 int, int *, GDALProgressFunc, void * ); 00362 00363 void ReportError(CPLErr eErrClass, int err_no, const char *fmt, ...) CPL_PRINT_FUNC_FORMAT (4, 5); 00364 }; 00365 00366 /* ******************************************************************** */ 00367 /* GDALRasterBlock */ 00368 /* ******************************************************************** */ 00369 00371 00372 class CPL_DLL GDALRasterBlock 00373 { 00374 GDALDataType eType; 00375 00376 int bDirty; 00377 int nLockCount; 00378 00379 int nXOff; 00380 int nYOff; 00381 00382 int nXSize; 00383 int nYSize; 00384 00385 void *pData; 00386 00387 GDALRasterBand *poBand; 00388 00389 GDALRasterBlock *poNext; 00390 GDALRasterBlock *poPrevious; 00391 00392 public: 00393 GDALRasterBlock( GDALRasterBand *, int, int ); 00394 virtual ~GDALRasterBlock(); 00395 00396 CPLErr Internalize( void ); 00397 void Touch( void ); 00398 void MarkDirty( void ); 00399 void MarkClean( void ); 00400 void AddLock( void ) { nLockCount++; } 00401 void DropLock( void ) { nLockCount--; } 00402 void Detach(); 00403 00404 CPLErr Write(); 00405 00406 GDALDataType GetDataType() { return eType; } 00407 int GetXOff() { return nXOff; } 00408 int GetYOff() { return nYOff; } 00409 int GetXSize() { return nXSize; } 00410 int GetYSize() { return nYSize; } 00411 int GetDirty() { return bDirty; } 00412 int GetLockCount() { return nLockCount; } 00413 00414 void *GetDataRef( void ) { return pData; } 00415 00418 GDALRasterBand *GetBand() { return poBand; } 00419 00420 static int FlushCacheBlock(); 00421 static void Verify(); 00422 00423 static int SafeLockBlock( GDALRasterBlock ** ); 00424 }; 00425 00426 /* ******************************************************************** */ 00427 /* GDALColorTable */ 00428 /* ******************************************************************** */ 00429 00432 class CPL_DLL GDALColorTable 00433 { 00434 GDALPaletteInterp eInterp; 00435 00436 std::vector<GDALColorEntry> aoEntries; 00437 00438 public: 00439 GDALColorTable( GDALPaletteInterp = GPI_RGB ); 00440 ~GDALColorTable(); 00441 00442 GDALColorTable *Clone() const; 00443 00444 GDALPaletteInterp GetPaletteInterpretation() const; 00445 00446 int GetColorEntryCount() const; 00447 const GDALColorEntry *GetColorEntry( int ) const; 00448 int GetColorEntryAsRGB( int, GDALColorEntry * ) const; 00449 void SetColorEntry( int, const GDALColorEntry * ); 00450 int CreateColorRamp( int, const GDALColorEntry * , 00451 int, const GDALColorEntry * ); 00452 }; 00453 00454 /* ******************************************************************** */ 00455 /* GDALRasterBand */ 00456 /* ******************************************************************** */ 00457 00459 00460 class CPL_DLL GDALRasterBand : public GDALMajorObject 00461 { 00462 private: 00463 CPLErr eFlushBlockErr; 00464 00465 void SetFlushBlockErr( CPLErr eErr ); 00466 00467 friend class GDALRasterBlock; 00468 00469 protected: 00470 GDALDataset *poDS; 00471 int nBand; /* 1 based */ 00472 00473 int nRasterXSize; 00474 int nRasterYSize; 00475 00476 GDALDataType eDataType; 00477 GDALAccess eAccess; 00478 00479 /* stuff related to blocking, and raster cache */ 00480 int nBlockXSize; 00481 int nBlockYSize; 00482 int nBlocksPerRow; 00483 int nBlocksPerColumn; 00484 00485 int bSubBlockingActive; 00486 int nSubBlocksPerRow; 00487 int nSubBlocksPerColumn; 00488 GDALRasterBlock **papoBlocks; 00489 00490 int nBlockReads; 00491 int bForceCachedIO; 00492 00493 GDALRasterBand *poMask; 00494 bool bOwnMask; 00495 int nMaskFlags; 00496 00497 friend class GDALDataset; 00498 friend class GDALProxyRasterBand; 00499 00500 protected: 00501 virtual CPLErr IReadBlock( int, int, void * ) = 0; 00502 virtual CPLErr IWriteBlock( int, int, void * ); 00503 virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int, 00504 void *, int, int, GDALDataType, 00505 int, int ); 00506 CPLErr OverviewRasterIO( GDALRWFlag, int, int, int, int, 00507 void *, int, int, GDALDataType, 00508 int, int ); 00509 00510 int InitBlockInfo(); 00511 00512 CPLErr AdoptBlock( int, int, GDALRasterBlock * ); 00513 GDALRasterBlock *TryGetLockedBlockRef( int nXBlockOff, int nYBlockYOff ); 00514 00515 public: 00516 GDALRasterBand(); 00517 00518 virtual ~GDALRasterBand(); 00519 00520 int GetXSize(); 00521 int GetYSize(); 00522 int GetBand(); 00523 GDALDataset*GetDataset(); 00524 00525 GDALDataType GetRasterDataType( void ); 00526 void GetBlockSize( int *, int * ); 00527 GDALAccess GetAccess(); 00528 00529 CPLErr RasterIO( GDALRWFlag, int, int, int, int, 00530 void *, int, int, GDALDataType, 00531 int, int ); 00532 CPLErr ReadBlock( int, int, void * ); 00533 00534 CPLErr WriteBlock( int, int, void * ); 00535 00536 GDALRasterBlock *GetLockedBlockRef( int nXBlockOff, int nYBlockOff, 00537 int bJustInitialize = FALSE ); 00538 CPLErr FlushBlock( int = -1, int = -1, int bWriteDirtyBlock = TRUE ); 00539 00540 unsigned char* GetIndexColorTranslationTo(/* const */ GDALRasterBand* poReferenceBand, 00541 unsigned char* pTranslationTable = NULL, 00542 int* pApproximateMatching = NULL); 00543 00544 // New OpengIS CV_SampleDimension stuff. 00545 00546 virtual CPLErr FlushCache(); 00547 virtual char **GetCategoryNames(); 00548 virtual double GetNoDataValue( int *pbSuccess = NULL ); 00549 virtual double GetMinimum( int *pbSuccess = NULL ); 00550 virtual double GetMaximum(int *pbSuccess = NULL ); 00551 virtual double GetOffset( int *pbSuccess = NULL ); 00552 virtual double GetScale( int *pbSuccess = NULL ); 00553 virtual const char *GetUnitType(); 00554 virtual GDALColorInterp GetColorInterpretation(); 00555 virtual GDALColorTable *GetColorTable(); 00556 virtual CPLErr Fill(double dfRealValue, double dfImaginaryValue = 0); 00557 00558 virtual CPLErr SetCategoryNames( char ** ); 00559 virtual CPLErr SetNoDataValue( double ); 00560 virtual CPLErr SetColorTable( GDALColorTable * ); 00561 virtual CPLErr SetColorInterpretation( GDALColorInterp ); 00562 virtual CPLErr SetOffset( double ); 00563 virtual CPLErr SetScale( double ); 00564 virtual CPLErr SetUnitType( const char * ); 00565 00566 virtual CPLErr GetStatistics( int bApproxOK, int bForce, 00567 double *pdfMin, double *pdfMax, 00568 double *pdfMean, double *padfStdDev ); 00569 virtual CPLErr ComputeStatistics( int bApproxOK, 00570 double *pdfMin, double *pdfMax, 00571 double *pdfMean, double *pdfStdDev, 00572 GDALProgressFunc, void *pProgressData ); 00573 virtual CPLErr SetStatistics( double dfMin, double dfMax, 00574 double dfMean, double dfStdDev ); 00575 virtual CPLErr ComputeRasterMinMax( int, double* ); 00576 00577 virtual int HasArbitraryOverviews(); 00578 virtual int GetOverviewCount(); 00579 virtual GDALRasterBand *GetOverview(int); 00580 virtual GDALRasterBand *GetRasterSampleOverview( int ); 00581 virtual CPLErr BuildOverviews( const char *, int, int *, 00582 GDALProgressFunc, void * ); 00583 00584 virtual CPLErr AdviseRead( int nXOff, int nYOff, int nXSize, int nYSize, 00585 int nBufXSize, int nBufYSize, 00586 GDALDataType eDT, char **papszOptions ); 00587 00588 virtual CPLErr GetHistogram( double dfMin, double dfMax, 00589 int nBuckets, int * panHistogram, 00590 int bIncludeOutOfRange, int bApproxOK, 00591 GDALProgressFunc, void *pProgressData ); 00592 00593 virtual CPLErr GetDefaultHistogram( double *pdfMin, double *pdfMax, 00594 int *pnBuckets, int ** ppanHistogram, 00595 int bForce, 00596 GDALProgressFunc, void *pProgressData); 00597 virtual CPLErr SetDefaultHistogram( double dfMin, double dfMax, 00598 int nBuckets, int *panHistogram ); 00599 00600 virtual const GDALRasterAttributeTable *GetDefaultRAT(); 00601 virtual CPLErr SetDefaultRAT( const GDALRasterAttributeTable * ); 00602 00603 virtual GDALRasterBand *GetMaskBand(); 00604 virtual int GetMaskFlags(); 00605 virtual CPLErr CreateMaskBand( int nFlags ); 00606 00607 void ReportError(CPLErr eErrClass, int err_no, const char *fmt, ...) CPL_PRINT_FUNC_FORMAT (4, 5); 00608 }; 00609 00610 /* ******************************************************************** */ 00611 /* GDALAllValidMaskBand */ 00612 /* ******************************************************************** */ 00613 00614 class CPL_DLL GDALAllValidMaskBand : public GDALRasterBand 00615 { 00616 protected: 00617 virtual CPLErr IReadBlock( int, int, void * ); 00618 00619 public: 00620 GDALAllValidMaskBand( GDALRasterBand * ); 00621 virtual ~GDALAllValidMaskBand(); 00622 00623 virtual GDALRasterBand *GetMaskBand(); 00624 virtual int GetMaskFlags(); 00625 }; 00626 00627 /* ******************************************************************** */ 00628 /* GDALNoDataMaskBand */ 00629 /* ******************************************************************** */ 00630 00631 class CPL_DLL GDALNoDataMaskBand : public GDALRasterBand 00632 { 00633 double dfNoDataValue; 00634 GDALRasterBand *poParent; 00635 00636 protected: 00637 virtual CPLErr IReadBlock( int, int, void * ); 00638 00639 public: 00640 GDALNoDataMaskBand( GDALRasterBand * ); 00641 virtual ~GDALNoDataMaskBand(); 00642 }; 00643 00644 /* ******************************************************************** */ 00645 /* GDALNoDataValuesMaskBand */ 00646 /* ******************************************************************** */ 00647 00648 class CPL_DLL GDALNoDataValuesMaskBand : public GDALRasterBand 00649 { 00650 double *padfNodataValues; 00651 00652 protected: 00653 virtual CPLErr IReadBlock( int, int, void * ); 00654 00655 public: 00656 GDALNoDataValuesMaskBand( GDALDataset * ); 00657 virtual ~GDALNoDataValuesMaskBand(); 00658 }; 00659 00660 /* ******************************************************************** */ 00661 /* GDALDriver */ 00662 /* ******************************************************************** */ 00663 00664 00676 class CPL_DLL GDALDriver : public GDALMajorObject 00677 { 00678 public: 00679 GDALDriver(); 00680 ~GDALDriver(); 00681 00682 /* -------------------------------------------------------------------- */ 00683 /* Public C++ methods. */ 00684 /* -------------------------------------------------------------------- */ 00685 GDALDataset *Create( const char * pszName, 00686 int nXSize, int nYSize, int nBands, 00687 GDALDataType eType, char ** papszOptions ) CPL_WARN_UNUSED_RESULT; 00688 00689 CPLErr Delete( const char * pszName ); 00690 CPLErr Rename( const char * pszNewName, 00691 const char * pszOldName ); 00692 CPLErr CopyFiles( const char * pszNewName, 00693 const char * pszOldName ); 00694 00695 GDALDataset *CreateCopy( const char *, GDALDataset *, 00696 int, char **, 00697 GDALProgressFunc pfnProgress, 00698 void * pProgressData ) CPL_WARN_UNUSED_RESULT; 00699 00700 /* -------------------------------------------------------------------- */ 00701 /* The following are semiprivate, not intended to be accessed */ 00702 /* by anyone but the formats instantiating and populating the */ 00703 /* drivers. */ 00704 /* -------------------------------------------------------------------- */ 00705 GDALDataset *(*pfnOpen)( GDALOpenInfo * ); 00706 00707 GDALDataset *(*pfnCreate)( const char * pszName, 00708 int nXSize, int nYSize, int nBands, 00709 GDALDataType eType, 00710 char ** papszOptions ); 00711 00712 CPLErr (*pfnDelete)( const char * pszName ); 00713 00714 GDALDataset *(*pfnCreateCopy)( const char *, GDALDataset *, 00715 int, char **, 00716 GDALProgressFunc pfnProgress, 00717 void * pProgressData ); 00718 00719 void *pDriverData; 00720 00721 void (*pfnUnloadDriver)(GDALDriver *); 00722 00723 int (*pfnIdentify)( GDALOpenInfo * ); 00724 00725 CPLErr (*pfnRename)( const char * pszNewName, 00726 const char * pszOldName ); 00727 CPLErr (*pfnCopyFiles)( const char * pszNewName, 00728 const char * pszOldName ); 00729 00730 /* -------------------------------------------------------------------- */ 00731 /* Helper methods. */ 00732 /* -------------------------------------------------------------------- */ 00733 GDALDataset *DefaultCreateCopy( const char *, GDALDataset *, 00734 int, char **, 00735 GDALProgressFunc pfnProgress, 00736 void * pProgressData ) CPL_WARN_UNUSED_RESULT; 00737 static CPLErr DefaultCopyMasks( GDALDataset *poSrcDS, 00738 GDALDataset *poDstDS, 00739 int bStrict ); 00740 static CPLErr QuietDelete( const char * pszName ); 00741 00742 CPLErr DefaultRename( const char * pszNewName, 00743 const char * pszOldName ); 00744 CPLErr DefaultCopyFiles( const char * pszNewName, 00745 const char * pszOldName ); 00746 }; 00747 00748 /* ******************************************************************** */ 00749 /* GDALDriverManager */ 00750 /* ******************************************************************** */ 00751 00759 class CPL_DLL GDALDriverManager : public GDALMajorObject 00760 { 00761 int nDrivers; 00762 GDALDriver **papoDrivers; 00763 00764 char *pszHome; 00765 00766 public: 00767 GDALDriverManager(); 00768 ~GDALDriverManager(); 00769 00770 int GetDriverCount( void ); 00771 GDALDriver *GetDriver( int ); 00772 GDALDriver *GetDriverByName( const char * ); 00773 00774 int RegisterDriver( GDALDriver * ); 00775 void MoveDriver( GDALDriver *, int ); 00776 void DeregisterDriver( GDALDriver * ); 00777 00778 void AutoLoadDrivers(); 00779 void AutoSkipDrivers(); 00780 00781 const char *GetHome(); 00782 void SetHome( const char * ); 00783 }; 00784 00785 CPL_C_START 00786 GDALDriverManager CPL_DLL * GetGDALDriverManager( void ); 00787 CPL_C_END 00788 00789 /* ******************************************************************** */ 00790 /* GDALAsyncReader */ 00791 /* ******************************************************************** */ 00792 00798 class CPL_DLL GDALAsyncReader 00799 { 00800 protected: 00801 GDALDataset* poDS; 00802 int nXOff; 00803 int nYOff; 00804 int nXSize; 00805 int nYSize; 00806 void * pBuf; 00807 int nBufXSize; 00808 int nBufYSize; 00809 GDALDataType eBufType; 00810 int nBandCount; 00811 int* panBandMap; 00812 int nPixelSpace; 00813 int nLineSpace; 00814 int nBandSpace; 00815 00816 public: 00817 GDALAsyncReader(); 00818 virtual ~GDALAsyncReader(); 00819 00820 GDALDataset* GetGDALDataset() {return poDS;} 00821 int GetXOffset() {return nXOff;} 00822 int GetYOffset() {return nYOff;} 00823 int GetXSize() {return nXSize;} 00824 int GetYSize() {return nYSize;} 00825 void * GetBuffer() {return pBuf;} 00826 int GetBufferXSize() {return nBufXSize;} 00827 int GetBufferYSize() {return nBufYSize;} 00828 GDALDataType GetBufferType() {return eBufType;} 00829 int GetBandCount() {return nBandCount;} 00830 int* GetBandMap() {return panBandMap;} 00831 int GetPixelSpace() {return nPixelSpace;} 00832 int GetLineSpace() {return nLineSpace;} 00833 int GetBandSpace() {return nBandSpace;} 00834 00835 virtual GDALAsyncStatusType 00836 GetNextUpdatedRegion(double dfTimeout, 00837 int* pnBufXOff, int* pnBufYOff, 00838 int* pnBufXSize, int* pnBufYSize) = 0; 00839 virtual int LockBuffer( double dfTimeout = -1.0 ); 00840 virtual void UnlockBuffer(); 00841 }; 00842 00843 /* ==================================================================== */ 00844 /* An assortment of overview related stuff. */ 00845 /* ==================================================================== */ 00846 00847 /* Not a public symbol for the moment */ 00848 CPLErr 00849 GDALRegenerateOverviewsMultiBand(int nBands, GDALRasterBand** papoSrcBands, 00850 int nOverviews, 00851 GDALRasterBand*** papapoOverviewBands, 00852 const char * pszResampling, 00853 GDALProgressFunc pfnProgress, void * pProgressData ); 00854 00855 CPL_C_START 00856 00857 #ifndef WIN32CE 00858 00859 CPLErr CPL_DLL 00860 HFAAuxBuildOverviews( const char *pszOvrFilename, GDALDataset *poParentDS, 00861 GDALDataset **ppoDS, 00862 int nBands, int *panBandList, 00863 int nNewOverviews, int *panNewOverviewList, 00864 const char *pszResampling, 00865 GDALProgressFunc pfnProgress, 00866 void *pProgressData ); 00867 00868 #endif /* WIN32CE */ 00869 00870 CPLErr CPL_DLL 00871 GTIFFBuildOverviews( const char * pszFilename, 00872 int nBands, GDALRasterBand **papoBandList, 00873 int nOverviews, int * panOverviewList, 00874 const char * pszResampling, 00875 GDALProgressFunc pfnProgress, void * pProgressData ); 00876 00877 CPLErr CPL_DLL 00878 GDALDefaultBuildOverviews( GDALDataset *hSrcDS, const char * pszBasename, 00879 const char * pszResampling, 00880 int nOverviews, int * panOverviewList, 00881 int nBands, int * panBandList, 00882 GDALProgressFunc pfnProgress, void * pProgressData); 00883 00884 int CPL_DLL GDALBandGetBestOverviewLevel(GDALRasterBand* poBand, 00885 int &nXOff, int &nYOff, 00886 int &nXSize, int &nYSize, 00887 int nBufXSize, int nBufYSize); 00888 00889 int CPL_DLL GDALOvLevelAdjust( int nOvLevel, int nXSize ); 00890 00891 GDALDataset CPL_DLL * 00892 GDALFindAssociatedAuxFile( const char *pszBasefile, GDALAccess eAccess, 00893 GDALDataset *poDependentDS ); 00894 00895 /* ==================================================================== */ 00896 /* Misc functions. */ 00897 /* ==================================================================== */ 00898 00899 CPLErr CPL_DLL GDALParseGMLCoverage( CPLXMLNode *psTree, 00900 int *pnXSize, int *pnYSize, 00901 double *padfGeoTransform, 00902 char **ppszProjection ); 00903 00904 /* ==================================================================== */ 00905 /* Infrastructure to check that dataset characteristics are valid */ 00906 /* ==================================================================== */ 00907 00908 int CPL_DLL GDALCheckDatasetDimensions( int nXSize, int nYSize ); 00909 int CPL_DLL GDALCheckBandCount( int nBands, int bIsZeroAllowed ); 00910 00911 00912 // Test if 2 floating point values match. Usefull when comparing values 00913 // stored as a string at some point. See #3573, #4183 00914 #define ARE_REAL_EQUAL(dfVal1, dfVal2) \ 00915 (fabs(dfVal1 - dfVal2) < 1e-10 || (dfVal2 != 0 && fabs(1 - dfVal1 / dfVal2) < 1e-10 )) 00916 00917 /* Internal use only */ 00918 int GDALReadWorldFile2( const char *pszBaseFilename, const char *pszExtension, 00919 double *padfGeoTransform, char** papszSiblingFiles, 00920 char** ppszWorldFileNameOut); 00921 int GDALReadTabFile2( const char * pszBaseFilename, 00922 double *padfGeoTransform, char **ppszWKT, 00923 int *pnGCPCount, GDAL_GCP **ppasGCPs, 00924 char** papszSiblingFiles, char** ppszTabFileNameOut ); 00925 00926 CPL_C_END 00927 00928 CPLString GDALFindAssociatedFile( const char *pszBasename, const char *pszExt, 00929 char **papszSiblingFiles, int nFlags ); 00930 00931 #endif /* ndef GDAL_PRIV_H_INCLUDED */