00001 /****************************************************************************** 00002 * $Id: gdal.h,v 1.24 2000/06/05 17:24:05 warmerda Exp $ 00003 * 00004 * Name: gdal.h 00005 * Project: GDAL Core 00006 * Purpose: GDAL Core C/Public declarations. 00007 * Author: Frank Warmerdam, warmerda@home.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 * $Log: gdal.h,v $ 00032 * Revision 1.24 2000/06/05 17:24:05 warmerda 00033 * added real complex support 00034 * 00035 * Revision 1.23 2000/04/30 23:22:16 warmerda 00036 * added CreateCopy support 00037 * 00038 * Revision 1.22 2000/04/26 18:25:29 warmerda 00039 * added missing CPL_DLL attributes 00040 * 00041 * Revision 1.21 2000/04/21 21:54:37 warmerda 00042 * updated metadata API 00043 * 00044 * Revision 1.20 2000/03/31 13:41:25 warmerda 00045 * added gcps 00046 * 00047 * Revision 1.19 2000/03/24 00:09:05 warmerda 00048 * rewrote cache management 00049 * 00050 * Revision 1.18 2000/03/09 23:22:03 warmerda 00051 * added GetHistogram 00052 * 00053 * Revision 1.17 2000/03/08 19:59:16 warmerda 00054 * added GDALFlushRasterCache 00055 * 00056 * Revision 1.16 2000/03/06 21:50:37 warmerda 00057 * added min/max support 00058 * 00059 * Revision 1.15 2000/03/06 02:19:56 warmerda 00060 * added lots of new functions 00061 * 00062 * Revision 1.14 2000/01/31 14:24:36 warmerda 00063 * implemented dataset delete 00064 * 00065 * Revision 1.13 1999/11/11 21:59:06 warmerda 00066 * added GetDriver() for datasets 00067 * 00068 * Revision 1.12 1999/10/21 13:23:28 warmerda 00069 * Added C callable driver related functions. 00070 * 00071 * Revision 1.11 1999/10/01 14:44:02 warmerda 00072 * added documentation 00073 * 00074 * Revision 1.10 1999/07/23 19:35:22 warmerda 00075 * added GDALSwapWords(), GDALCopyWords() 00076 * 00077 * Revision 1.9 1999/05/23 02:46:26 warmerda 00078 * Added documentation short description. 00079 * 00080 * Revision 1.8 1999/04/21 04:16:13 warmerda 00081 * experimental docs 00082 * 00083 * Revision 1.7 1999/03/02 21:09:48 warmerda 00084 * add GDALDecToDMS() 00085 * 00086 * Revision 1.6 1999/01/11 15:36:17 warmerda 00087 * Added projections support, and a few other things. 00088 * 00089 * Revision 1.5 1998/12/31 18:53:33 warmerda 00090 * Add GDALGetDriverByName 00091 * 00092 * Revision 1.4 1998/12/06 22:16:27 warmerda 00093 * Added GDALCreate(). 00094 * 00095 * Revision 1.3 1998/12/06 02:50:36 warmerda 00096 * Added three new functions. 00097 * 00098 * Revision 1.2 1998/12/03 18:34:05 warmerda 00099 * Update to use CPL 00100 * 00101 * Revision 1.1 1998/10/18 06:15:10 warmerda 00102 * Initial implementation. 00103 * 00104 */ 00105 00106 #ifndef GDAL_H_INCLUDED 00107 #define GDAL_H_INCLUDED 00108 00115 #include "cpl_port.h" 00116 #include "cpl_error.h" 00117 00118 /* -------------------------------------------------------------------- */ 00119 /* Significant constants. */ 00120 /* -------------------------------------------------------------------- */ 00121 00122 CPL_C_START 00123 00125 typedef enum { 00126 GDT_Unknown = 0, GDT_Byte = 1, GDT_UInt16 = 2, GDT_Int16 = 3, GDT_UInt32 = 4, GDT_Int32 = 5, GDT_Float32 = 6, GDT_Float64 = 7, GDT_CInt16 = 8, GDT_CInt32 = 9, GDT_CFloat32 = 10, GDT_CFloat64 = 11, 00138 GDT_TypeCount = 12 /* maximum type # + 1 */ 00139 } GDALDataType; 00140 00141 int CPL_DLL GDALGetDataTypeSize( GDALDataType ); 00142 int CPL_DLL GDALDataTypeIsComplex( GDALDataType ); 00143 const char CPL_DLL *GDALGetDataTypeName( GDALDataType ); 00144 00146 typedef enum { GA_ReadOnly = 0, GA_Update = 1 00149 } GDALAccess; 00150 00151 typedef enum { 00152 GF_Read = 0, 00153 GF_Write = 1 00154 } GDALRWFlag; 00155 00157 typedef enum 00158 { 00159 GCI_Undefined=0, 00160 GCI_GrayIndex=1, 00161 GCI_PaletteIndex=2, 00162 GCI_RedBand=3, 00163 GCI_GreenBand=4, 00164 GCI_BlueBand=5, 00165 GCI_AlphaBand=6, 00166 GCI_HueBand=7, 00167 GCI_SaturationBand=8, 00168 GCI_LightnessBand=9, 00169 GCI_CyanBand=10, 00170 GCI_MagentaBand=11, 00171 GCI_YellowBand=12, 00172 GCI_BlackBand=13 00173 } GDALColorInterp; 00174 00176 const char CPL_DLL *GDALGetColorInterpretationName( GDALColorInterp ); 00177 00179 typedef enum 00180 { 00181 GPI_Gray=0, 00182 GPI_RGB=1, 00183 GPI_CMYK=2, 00184 GPI_HLS=3 00185 } GDALPaletteInterp; 00186 00188 const char CPL_DLL *GDALGetPaletteInterpretationName( GDALPaletteInterp ); 00189 00190 /* -------------------------------------------------------------------- */ 00191 /* GDAL Specific error codes. */ 00192 /* */ 00193 /* error codes 100 to 299 reserved for GDAL. */ 00194 /* -------------------------------------------------------------------- */ 00195 #define CPLE_WrongFormat 200 00196 00197 /* -------------------------------------------------------------------- */ 00198 /* Define handle types related to various internal classes. */ 00199 /* -------------------------------------------------------------------- */ 00200 00201 typedef void *GDALMajorObjectH; 00202 typedef void *GDALDatasetH; 00203 typedef void *GDALRasterBandH; 00204 typedef void *GDALDriverH; 00205 typedef void *GDALProjDefH; 00206 typedef void *GDALColorTableH; 00207 00208 /* -------------------------------------------------------------------- */ 00209 /* Callback "progress" function. */ 00210 /* -------------------------------------------------------------------- */ 00211 typedef int (*GDALProgressFunc)(double,const char *, void *); 00212 int CPL_DLL GDALDummyProgress( double, const char *, void *); 00213 00214 /* ==================================================================== */ 00215 /* Registration/driver related. */ 00216 /* ==================================================================== */ 00217 00218 void CPL_DLL GDALAllRegister( void ); 00219 00220 GDALDatasetH CPL_DLL GDALCreate( GDALDriverH hDriver, 00221 const char *, int, int, int, GDALDataType, 00222 char ** ); 00223 GDALDatasetH CPL_DLL GDALCreateCopy( GDALDriverH, const char *, GDALDatasetH, 00224 int, char **, GDALProgressFunc, void * ); 00225 00226 GDALDatasetH CPL_DLL GDALOpen( const char *, GDALAccess ); 00227 00228 GDALDriverH CPL_DLL GDALGetDriverByName( const char * ); 00229 int CPL_DLL GDALGetDriverCount(); 00230 GDALDriverH CPL_DLL GDALGetDriver( int ); 00231 int CPL_DLL GDALRegisterDriver( GDALDriverH ); 00232 void CPL_DLL GDALDeregisterDriver( GDALDriverH ); 00233 CPLErr CPL_DLL GDALDeleteDataset( GDALDriverH, const char * ); 00234 00235 const char CPL_DLL *GDALGetDriverShortName( GDALDriverH ); 00236 const char CPL_DLL *GDALGetDriverLongName( GDALDriverH ); 00237 const char CPL_DLL *GDALGetDriverHelpTopic( GDALDriverH ); 00238 00239 /* ==================================================================== */ 00240 /* GDAL_GCP */ 00241 /* ==================================================================== */ 00242 00244 typedef struct 00245 { 00247 char *pszId; 00248 00250 char *pszInfo; 00251 00253 double dfGCPPixel; 00255 double dfGCPLine; 00256 00258 double dfGCPX; 00259 00261 double dfGCPY; 00262 00264 double dfGCPZ; 00265 } GDAL_GCP; 00266 00267 void CPL_DLL GDALInitGCPs( int, GDAL_GCP * ); 00268 void CPL_DLL GDALDeinitGCPs( int, GDAL_GCP * ); 00269 GDAL_GCP CPL_DLL *GDALDuplicateGCPs( int, const GDAL_GCP * ); 00270 00271 /* ==================================================================== */ 00272 /* major objects (dataset, and, driver, drivermanager). */ 00273 /* ==================================================================== */ 00274 00275 char CPL_DLL **GDALGetMetadata( GDALMajorObjectH, const char * ); 00276 CPLErr CPL_DLL GDALSetMetadata( GDALMajorObjectH, char **, 00277 const char * ); 00278 char CPL_DLL **GDALGetMetadataItem( GDALMajorObjectH, const char * ); 00279 CPLErr CPL_DLL GDALSetMetadataItem( GDALMajorObjectH, 00280 const char *, const char *, 00281 const char * ); 00282 00283 /* ==================================================================== */ 00284 /* GDALDataset class ... normally this represents one file. */ 00285 /* ==================================================================== */ 00286 00287 GDALDriverH CPL_DLL GDALGetDatasetDriver( GDALDatasetH ); 00288 void CPL_DLL GDALClose( GDALDatasetH ); 00289 int CPL_DLL GDALGetRasterXSize( GDALDatasetH ); 00290 int CPL_DLL GDALGetRasterYSize( GDALDatasetH ); 00291 int CPL_DLL GDALGetRasterCount( GDALDatasetH ); 00292 GDALRasterBandH CPL_DLL GDALGetRasterBand( GDALDatasetH, int ); 00293 00294 const char CPL_DLL *GDALGetProjectionRef( GDALDatasetH ); 00295 CPLErr CPL_DLL GDALSetProjection( GDALDatasetH, const char * ); 00296 CPLErr CPL_DLL GDALGetGeoTransform( GDALDatasetH, double * ); 00297 CPLErr CPL_DLL GDALSetGeoTransform( GDALDatasetH, double * ); 00298 00299 int CPL_DLL GDALGetGCPCount( GDALDatasetH ); 00300 const char CPL_DLL *GDALGetGCPProjection( GDALDatasetH ); 00301 const GDAL_GCP CPL_DLL *GDALGetGCPs( GDALDatasetH ); 00302 00303 void CPL_DLL *GDALGetInternalHandle( GDALDatasetH, const char * ); 00304 int CPL_DLL GDALReferenceDataset( GDALDatasetH ); 00305 int CPL_DLL GDALDereferenceDataset( GDALDatasetH ); 00306 00307 /* ==================================================================== */ 00308 /* GDALRasterBand ... one band/channel in a dataset. */ 00309 /* ==================================================================== */ 00310 00311 GDALDataType CPL_DLL GDALGetRasterDataType( GDALRasterBandH ); 00312 void CPL_DLL GDALGetBlockSize( GDALRasterBandH, 00313 int * pnXSize, int * pnYSize ); 00314 00315 CPLErr CPL_DLL GDALRasterIO( GDALRasterBandH hRBand, GDALRWFlag eRWFlag, 00316 int nDSXOff, int nDSYOff, 00317 int nDSXSize, int nDSYSize, 00318 void * pBuffer, int nBXSize, int nBYSize, 00319 GDALDataType eBDataType, 00320 int nPixelSpace, int nLineSpace ); 00321 CPLErr CPL_DLL GDALReadBlock( GDALRasterBandH, int, int, void * ); 00322 CPLErr CPL_DLL GDALWriteBlock( GDALRasterBandH, int, int, void * ); 00323 int CPL_DLL GDALGetRasterBandXSize( GDALRasterBandH ); 00324 int CPL_DLL GDALGetRasterBandYSize( GDALRasterBandH ); 00325 char CPL_DLL **GDALGetRasterMetadata( GDALRasterBandH ); 00326 00327 GDALColorInterp CPL_DLL GDALGetRasterColorInterpretation( GDALRasterBandH ); 00328 GDALColorTableH CPL_DLL GDALGetRasterColorTable( GDALRasterBandH ); 00329 int CPL_DLL GDALGetOverviewCount( GDALRasterBandH ); 00330 GDALRasterBandH CPL_DLL GDALGetOverview( GDALRasterBandH, int ); 00331 double CPL_DLL GDALGetRasterNoDataValue( GDALRasterBandH, int *pbSuccess ); 00332 double CPL_DLL GDALGetRasterMinimum( GDALRasterBandH, int *pbSuccess ); 00333 double CPL_DLL GDALGetRasterMaximum( GDALRasterBandH, int *pbSuccess ); 00334 void CPL_DLL GDALComputeRasterMinMax( GDALRasterBandH hBand, int bApproxOK, 00335 double adfMinMax[2] ); 00336 CPLErr CPL_DLL GDALFlushRasterCache( GDALRasterBandH hBand ); 00337 CPLErr CPL_DLL GDALGetRasterHistogram( GDALRasterBandH hBand, 00338 double dfMin, double dfMax, 00339 int nBuckets, int *panHistogram, 00340 int bIncludeOutOfRange, int bApproxOK, 00341 GDALProgressFunc pfnProgress, 00342 void * pProgressData ); 00343 int CPL_DLL GDALGetRandomRasterSample( GDALRasterBandH, int, float * ); 00344 00345 /* need to add functions related to block cache */ 00346 00347 /* helper functions */ 00348 void CPL_DLL GDALSwapWords( void *pData, int nWordSize, int nWordCount, 00349 int nWordSkip ); 00350 void CPL_DLL 00351 GDALCopyWords( void * pSrcData, GDALDataType eSrcType, int nSrcPixelOffset, 00352 void * pDstData, GDALDataType eDstType, int nDstPixelOffset, 00353 int nWordCount ); 00354 00355 00356 /* ==================================================================== */ 00357 /* Color tables. */ 00358 /* ==================================================================== */ 00360 typedef struct 00361 { 00363 short c1; 00364 00365 /* green, magenta, or lightness */ 00366 short c2; 00367 00368 /* blue, yellow, or saturation */ 00369 short c3; 00370 00371 /* alpha or blackband */ 00372 short c4; 00373 } GDALColorEntry; 00374 00375 GDALColorTableH CPL_DLL GDALCreateColorTable( GDALPaletteInterp ); 00376 void CPL_DLL GDALDestroyColorTable( GDALColorTableH ); 00377 GDALColorTableH CPL_DLL GDALCloneColorTable( GDALColorTableH ); 00378 GDALPaletteInterp CPL_DLL GDALGetPaletteInterpretation( GDALColorTableH ); 00379 int CPL_DLL GDALGetColorEntryCount( GDALColorTableH ); 00380 const GDALColorEntry CPL_DLL *GDALGetColorEntry( GDALColorTableH, int ); 00381 int CPL_DLL GDALGetColorEntryAsRGB( GDALColorTableH, int, GDALColorEntry *); 00382 void CPL_DLL GDALSetColorEntry( GDALColorTableH, int, const GDALColorEntry * ); 00383 00384 /* ==================================================================== */ 00385 /* Projections */ 00386 /* ==================================================================== */ 00387 00388 GDALProjDefH CPL_DLL GDALCreateProjDef( const char * ); 00389 CPLErr CPL_DLL GDALReprojectToLongLat( GDALProjDefH, double *, double * ); 00390 CPLErr CPL_DLL GDALReprojectFromLongLat( GDALProjDefH, double *, double * ); 00391 void CPL_DLL GDALDestroyProjDef( GDALProjDefH ); 00392 const char CPL_DLL *GDALDecToDMS( double, const char *, int ); 00393 00394 /* ==================================================================== */ 00395 /* GDAL Cache Management */ 00396 /* ==================================================================== */ 00397 00398 void CPL_DLL GDALSetCacheMax( int nBytes ); 00399 int CPL_DLL GDALGetCacheMax(); 00400 int CPL_DLL GDALGetCacheUsed(); 00401 int CPL_DLL GDALFlushCacheBlock(); 00402 00403 CPL_C_END 00404 00405 #endif /* ndef GDAL_H_INCLUDED */