Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

gdal.h

Go to the documentation of this file.
00001 /******************************************************************************
00002  * $Id: gdal_h-source.html,v 1.2 2000/09/25 20:50:11 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-source.html,v $
00031  * Revision 1.2  2000/09/25 20:50:11  warmerda
00031  * New
00031  *
00032  * Revision 1.31  2000/08/25 14:26:51  warmerda
00033  * added GDALHasArbitraryOverviews
00034  *
00035  * Revision 1.30  2000/08/18 15:24:48  warmerda
00036  * added GDALTermProgress
00037  *
00038  * Revision 1.29  2000/07/11 14:35:43  warmerda
00039  * added documentation
00040  *
00041  * Revision 1.28  2000/06/27 17:30:21  warmerda
00042  * added GDALGetRasterSampleOverview
00043  *
00044  * Revision 1.27  2000/06/26 22:17:49  warmerda
00045  * added scaled progress support
00046  *
00047  * Revision 1.26  2000/06/26 18:47:31  warmerda
00048  * added GDALBuildOverviews
00049  *
00050  * Revision 1.25  2000/06/26 15:26:21  warmerda
00051  * added GDALGetDescription
00052  *
00053  * Revision 1.24  2000/06/05 17:24:05  warmerda
00054  * added real complex support
00055  *
00056  * Revision 1.23  2000/04/30 23:22:16  warmerda
00057  * added CreateCopy support
00058  *
00059  * Revision 1.22  2000/04/26 18:25:29  warmerda
00060  * added missing CPL_DLL attributes
00061  *
00062  * Revision 1.21  2000/04/21 21:54:37  warmerda
00063  * updated metadata API
00064  *
00065  * Revision 1.20  2000/03/31 13:41:25  warmerda
00066  * added gcps
00067  *
00068  * Revision 1.19  2000/03/24 00:09:05  warmerda
00069  * rewrote cache management
00070  *
00071  * Revision 1.18  2000/03/09 23:22:03  warmerda
00072  * added GetHistogram
00073  *
00074  * Revision 1.17  2000/03/08 19:59:16  warmerda
00075  * added GDALFlushRasterCache
00076  *
00077  * Revision 1.16  2000/03/06 21:50:37  warmerda
00078  * added min/max support
00079  *
00080  * Revision 1.15  2000/03/06 02:19:56  warmerda
00081  * added lots of new functions
00082  *
00083  * Revision 1.14  2000/01/31 14:24:36  warmerda
00084  * implemented dataset delete
00085  *
00086  * Revision 1.13  1999/11/11 21:59:06  warmerda
00087  * added GetDriver() for datasets
00088  *
00089  * Revision 1.12  1999/10/21 13:23:28  warmerda
00090  * Added C callable driver related functions.
00091  *
00092  * Revision 1.11  1999/10/01 14:44:02  warmerda
00093  * added documentation
00094  *
00095  * Revision 1.10  1999/07/23 19:35:22  warmerda
00096  * added GDALSwapWords(), GDALCopyWords()
00097  *
00098  * Revision 1.9  1999/05/23 02:46:26  warmerda
00099  * Added documentation short description.
00100  *
00101  * Revision 1.8  1999/04/21 04:16:13  warmerda
00102  * experimental docs
00103  *
00104  * Revision 1.7  1999/03/02 21:09:48  warmerda
00105  * add GDALDecToDMS()
00106  *
00107  * Revision 1.6  1999/01/11 15:36:17  warmerda
00108  * Added projections support, and a few other things.
00109  *
00110  * Revision 1.5  1998/12/31 18:53:33  warmerda
00111  * Add GDALGetDriverByName
00112  *
00113  * Revision 1.4  1998/12/06 22:16:27  warmerda
00114  * Added GDALCreate().
00115  *
00116  * Revision 1.3  1998/12/06 02:50:36  warmerda
00117  * Added three new functions.
00118  *
00119  * Revision 1.2  1998/12/03 18:34:05  warmerda
00120  * Update to use CPL
00121  *
00122  * Revision 1.1  1998/10/18 06:15:10  warmerda
00123  * Initial implementation.
00124  *
00125  */
00126 
00127 #ifndef GDAL_H_INCLUDED
00128 #define GDAL_H_INCLUDED
00129 
00136 #include "cpl_port.h"
00137 #include "cpl_error.h"
00138 
00139 /* -------------------------------------------------------------------- */
00140 /*      Significant constants.                                          */
00141 /* -------------------------------------------------------------------- */
00142 
00143 CPL_C_START
00144 
00146 typedef enum {
00147     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,
00159     GDT_TypeCount = 12          /* maximum type # + 1 */
00160 } GDALDataType;
00161 
00162 int CPL_DLL GDALGetDataTypeSize( GDALDataType );
00163 int CPL_DLL GDALDataTypeIsComplex( GDALDataType );
00164 const char CPL_DLL *GDALGetDataTypeName( GDALDataType );
00165 
00167 typedef enum { GA_ReadOnly = 0,           GA_Update = 1
00170 } GDALAccess;
00171 
00173 typedef enum {   GF_Read = 0,  GF_Write = 1
00176 } GDALRWFlag;
00177 
00179 typedef enum
00180 {
00181     GCI_Undefined=0,                                      GCI_GrayIndex=1,          GCI_PaletteIndex=2,                         GCI_RedBand=3,                       GCI_GreenBand=4,                        GCI_BlueBand=5,              GCI_AlphaBand=6,                          GCI_HueBand=7,                   GCI_SaturationBand=8,                    GCI_LightnessBand=9,                        GCI_CyanBand=10,                     GCI_MagentaBand=11,                      GCI_YellowBand=12,                       GCI_BlackBand=13
00195 } GDALColorInterp;
00196 
00198 const char CPL_DLL *GDALGetColorInterpretationName( GDALColorInterp );
00199 
00201 typedef enum 
00202 {                      GPI_Gray=0,  GPI_RGB=1, GPI_CMYK=2,     GPI_HLS=3
00207 } GDALPaletteInterp;
00208 
00210 const char CPL_DLL *GDALGetPaletteInterpretationName( GDALPaletteInterp );
00211 
00212 /* -------------------------------------------------------------------- */
00213 /*      GDAL Specific error codes.                                      */
00214 /*                                                                      */
00215 /*      error codes 100 to 299 reserved for GDAL.                       */
00216 /* -------------------------------------------------------------------- */
00217 #define CPLE_WrongFormat        200
00218 
00219 /* -------------------------------------------------------------------- */
00220 /*      Define handle types related to various internal classes.        */
00221 /* -------------------------------------------------------------------- */
00222 typedef void *GDALMajorObjectH;
00223 typedef void *GDALDatasetH;
00224 typedef void *GDALRasterBandH;
00225 typedef void *GDALDriverH;
00226 typedef void *GDALProjDefH;
00227 typedef void *GDALColorTableH;
00228 
00229 /* -------------------------------------------------------------------- */
00230 /*      Callback "progress" function.                                   */
00231 /* -------------------------------------------------------------------- */
00234 typedef int (*GDALProgressFunc)(double,const char *, void *);
00235 int CPL_DLL GDALDummyProgress( double, const char *, void *);
00236 int CPL_DLL GDALTermProgress( double, const char *, void *);
00237 int CPL_DLL GDALScaledProgress( double, const char *, void *);
00238 void CPL_DLL *GDALCreateScaledProgress( double, double,
00239                                         GDALProgressFunc, void * );
00240 void CPL_DLL GDALDestroyScaledProgress( void * );
00241 
00242 /* ==================================================================== */
00243 /*      Registration/driver related.                                    */
00244 /* ==================================================================== */
00245 
00246 void CPL_DLL GDALAllRegister( void );
00247 
00248 GDALDatasetH CPL_DLL GDALCreate( GDALDriverH hDriver,
00249                                  const char *, int, int, int, GDALDataType,
00250                                  char ** );
00251 GDALDatasetH CPL_DLL GDALCreateCopy( GDALDriverH, const char *, GDALDatasetH,
00252                                      int, char **, GDALProgressFunc, void * );
00253 
00254 GDALDatasetH CPL_DLL GDALOpen( const char *, GDALAccess );
00255 
00256 GDALDriverH CPL_DLL GDALGetDriverByName( const char * );
00257 int CPL_DLL         GDALGetDriverCount();
00258 GDALDriverH CPL_DLL GDALGetDriver( int );
00259 int         CPL_DLL GDALRegisterDriver( GDALDriverH );
00260 void        CPL_DLL GDALDeregisterDriver( GDALDriverH );
00261 CPLErr      CPL_DLL GDALDeleteDataset( GDALDriverH, const char * );
00262 
00263 const char CPL_DLL *GDALGetDriverShortName( GDALDriverH );
00264 const char CPL_DLL *GDALGetDriverLongName( GDALDriverH );
00265 const char CPL_DLL *GDALGetDriverHelpTopic( GDALDriverH );
00266 
00267 /* ==================================================================== */
00268 /*      GDAL_GCP                                                        */
00269 /* ==================================================================== */
00270 
00272 typedef struct
00273 {
00275     char        *pszId; 
00276 
00278     char        *pszInfo;
00279 
00281     double      dfGCPPixel;
00283     double      dfGCPLine;
00284 
00286     double      dfGCPX;
00287 
00289     double      dfGCPY;
00290 
00292     double      dfGCPZ;
00293 } GDAL_GCP;
00294 
00295 void CPL_DLL GDALInitGCPs( int, GDAL_GCP * );
00296 void CPL_DLL GDALDeinitGCPs( int, GDAL_GCP * );
00297 GDAL_GCP CPL_DLL *GDALDuplicateGCPs( int, const GDAL_GCP * );
00298 
00299 /* ==================================================================== */
00300 /*      major objects (dataset, and, driver, drivermanager).            */
00301 /* ==================================================================== */
00302 
00303 char CPL_DLL  **GDALGetMetadata( GDALMajorObjectH, const char * );
00304 CPLErr CPL_DLL  GDALSetMetadata( GDALMajorObjectH, char **,
00305                                  const char * );
00306 char CPL_DLL  **GDALGetMetadataItem( GDALMajorObjectH, const char * );
00307 CPLErr CPL_DLL  GDALSetMetadataItem( GDALMajorObjectH,
00308                                      const char *, const char *,
00309                                      const char * );
00310 const char CPL_DLL *GDALGetDescription( GDALMajorObjectH );
00311 
00312 /* ==================================================================== */
00313 /*      GDALDataset class ... normally this represents one file.        */
00314 /* ==================================================================== */
00315 
00316 GDALDriverH CPL_DLL GDALGetDatasetDriver( GDALDatasetH );
00317 void CPL_DLL   GDALClose( GDALDatasetH );
00318 int CPL_DLL     GDALGetRasterXSize( GDALDatasetH );
00319 int CPL_DLL     GDALGetRasterYSize( GDALDatasetH );
00320 int CPL_DLL     GDALGetRasterCount( GDALDatasetH );
00321 GDALRasterBandH CPL_DLL GDALGetRasterBand( GDALDatasetH, int );
00322 
00323 const char CPL_DLL *GDALGetProjectionRef( GDALDatasetH );
00324 CPLErr CPL_DLL  GDALSetProjection( GDALDatasetH, const char * );
00325 CPLErr CPL_DLL  GDALGetGeoTransform( GDALDatasetH, double * );
00326 CPLErr CPL_DLL  GDALSetGeoTransform( GDALDatasetH, double * );
00327 
00328 int CPL_DLL     GDALGetGCPCount( GDALDatasetH );
00329 const char CPL_DLL *GDALGetGCPProjection( GDALDatasetH );
00330 const GDAL_GCP CPL_DLL *GDALGetGCPs( GDALDatasetH );
00331 
00332 void CPL_DLL   *GDALGetInternalHandle( GDALDatasetH, const char * );
00333 int CPL_DLL     GDALReferenceDataset( GDALDatasetH );
00334 int CPL_DLL     GDALDereferenceDataset( GDALDatasetH );
00335 
00336 CPLErr CPL_DLL  GDALBuildOverviews( GDALDatasetH, const char *, int, int *,
00337                                     int, int *, GDALProgressFunc, void * );
00338 
00339 /* ==================================================================== */
00340 /*      GDALRasterBand ... one band/channel in a dataset.               */
00341 /* ==================================================================== */
00342 
00343 GDALDataType CPL_DLL GDALGetRasterDataType( GDALRasterBandH );
00344 void CPL_DLL    GDALGetBlockSize( GDALRasterBandH,
00345                                   int * pnXSize, int * pnYSize );
00346 
00347 CPLErr CPL_DLL GDALRasterIO( GDALRasterBandH hRBand, GDALRWFlag eRWFlag,
00348                               int nDSXOff, int nDSYOff,
00349                               int nDSXSize, int nDSYSize,
00350                               void * pBuffer, int nBXSize, int nBYSize,
00351                               GDALDataType eBDataType,
00352                               int nPixelSpace, int nLineSpace );
00353 CPLErr CPL_DLL GDALReadBlock( GDALRasterBandH, int, int, void * );
00354 CPLErr CPL_DLL GDALWriteBlock( GDALRasterBandH, int, int, void * );
00355 int CPL_DLL GDALGetRasterBandXSize( GDALRasterBandH );
00356 int CPL_DLL GDALGetRasterBandYSize( GDALRasterBandH );
00357 char CPL_DLL  **GDALGetRasterMetadata( GDALRasterBandH );
00358 
00359 GDALColorInterp CPL_DLL GDALGetRasterColorInterpretation( GDALRasterBandH );
00360 GDALColorTableH CPL_DLL GDALGetRasterColorTable( GDALRasterBandH );
00361 int CPL_DLL     GDALHasArbitraryOverviews( GDALRasterBandH );
00362 int CPL_DLL             GDALGetOverviewCount( GDALRasterBandH );
00363 GDALRasterBandH CPL_DLL GDALGetOverview( GDALRasterBandH, int );
00364 double CPL_DLL GDALGetRasterNoDataValue( GDALRasterBandH, int *pbSuccess );
00365 double CPL_DLL GDALGetRasterMinimum( GDALRasterBandH, int *pbSuccess );
00366 double CPL_DLL GDALGetRasterMaximum( GDALRasterBandH, int *pbSuccess );
00367 void CPL_DLL GDALComputeRasterMinMax( GDALRasterBandH hBand, int bApproxOK,
00368                                       double adfMinMax[2] );
00369 CPLErr CPL_DLL GDALFlushRasterCache( GDALRasterBandH hBand );
00370 CPLErr CPL_DLL GDALGetRasterHistogram( GDALRasterBandH hBand,
00371                                        double dfMin, double dfMax,
00372                                        int nBuckets, int *panHistogram,
00373                                        int bIncludeOutOfRange, int bApproxOK,
00374                                        GDALProgressFunc pfnProgress,
00375                                        void * pProgressData );
00376 int CPL_DLL GDALGetRandomRasterSample( GDALRasterBandH, int, float * );
00377 GDALRasterBandH CPL_DLL GDALGetRasterSampleOverview( GDALRasterBandH, int );
00378 
00379 /* need to add functions related to block cache */
00380 
00381 /* helper functions */
00382 void CPL_DLL GDALSwapWords( void *pData, int nWordSize, int nWordCount,
00383                             int nWordSkip );
00384 void CPL_DLL
00385     GDALCopyWords( void * pSrcData, GDALDataType eSrcType, int nSrcPixelOffset,
00386                    void * pDstData, GDALDataType eDstType, int nDstPixelOffset,
00387                    int nWordCount );
00388 
00389 
00390 /* ==================================================================== */
00391 /*      Color tables.                                                   */
00392 /* ==================================================================== */
00394 typedef struct
00395 {
00397     short      c1;      
00398 
00400     short      c2;      
00401 
00403     short      c3;      
00404 
00406     short      c4;      
00407 } GDALColorEntry;
00408 
00409 GDALColorTableH CPL_DLL GDALCreateColorTable( GDALPaletteInterp );
00410 void CPL_DLL            GDALDestroyColorTable( GDALColorTableH );
00411 GDALColorTableH CPL_DLL GDALCloneColorTable( GDALColorTableH );
00412 GDALPaletteInterp CPL_DLL GDALGetPaletteInterpretation( GDALColorTableH );
00413 int CPL_DLL             GDALGetColorEntryCount( GDALColorTableH );
00414 const GDALColorEntry CPL_DLL *GDALGetColorEntry( GDALColorTableH, int );
00415 int CPL_DLL GDALGetColorEntryAsRGB( GDALColorTableH, int, GDALColorEntry *);
00416 void CPL_DLL GDALSetColorEntry( GDALColorTableH, int, const GDALColorEntry * );
00417 
00418 /* ==================================================================== */
00419 /*      Projections                                                     */
00420 /* ==================================================================== */
00421 
00422 GDALProjDefH CPL_DLL GDALCreateProjDef( const char * );
00423 CPLErr  CPL_DLL GDALReprojectToLongLat( GDALProjDefH, double *, double * );
00424 CPLErr  CPL_DLL GDALReprojectFromLongLat( GDALProjDefH, double *, double * );
00425 void    CPL_DLL GDALDestroyProjDef( GDALProjDefH );
00426 const char CPL_DLL *GDALDecToDMS( double, const char *, int );
00427 
00428 /* ==================================================================== */
00429 /*      GDAL Cache Management                                           */
00430 /* ==================================================================== */
00431 
00432 void CPL_DLL GDALSetCacheMax( int nBytes );
00433 int CPL_DLL GDALGetCacheMax();
00434 int CPL_DLL GDALGetCacheUsed();
00435 int CPL_DLL GDALFlushCacheBlock();
00436 
00437 CPL_C_END
00438 
00439 #endif /* ndef GDAL_H_INCLUDED */

doxygen1.2.2 Dimitri van Heesch, © 1997-2000