1 : /******************************************************************************
2 : * $Id: gdal.h 19883 2010-06-17 21:26:06Z rouault $
3 : *
4 : * Project: GDAL Core
5 : * Purpose: GDAL Core C/Public declarations.
6 : * Author: Frank Warmerdam, warmerdam@pobox.com
7 : *
8 : ******************************************************************************
9 : * Copyright (c) 1998, 2002 Frank Warmerdam
10 : *
11 : * Permission is hereby granted, free of charge, to any person obtaining a
12 : * copy of this software and associated documentation files (the "Software"),
13 : * to deal in the Software without restriction, including without limitation
14 : * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15 : * and/or sell copies of the Software, and to permit persons to whom the
16 : * Software is furnished to do so, subject to the following conditions:
17 : *
18 : * The above copyright notice and this permission notice shall be included
19 : * in all copies or substantial portions of the Software.
20 : *
21 : * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22 : * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 : * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24 : * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 : * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 : * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27 : * DEALINGS IN THE SOFTWARE.
28 : ****************************************************************************/
29 :
30 : #ifndef GDAL_H_INCLUDED
31 : #define GDAL_H_INCLUDED
32 :
33 : /**
34 : * \file gdal.h
35 : *
36 : * Public (C callable) GDAL entry points.
37 : */
38 :
39 : #ifndef DOXYGEN_SKIP
40 : #include "gdal_version.h"
41 : #include "cpl_port.h"
42 : #include "cpl_error.h"
43 : #endif
44 :
45 : /* -------------------------------------------------------------------- */
46 : /* Significant constants. */
47 : /* -------------------------------------------------------------------- */
48 :
49 : CPL_C_START
50 :
51 : /*! Pixel data types */
52 : typedef enum {
53 : /*! Unknown or unspecified type */ GDT_Unknown = 0,
54 : /*! Eight bit unsigned integer */ GDT_Byte = 1,
55 : /*! Sixteen bit unsigned integer */ GDT_UInt16 = 2,
56 : /*! Sixteen bit signed integer */ GDT_Int16 = 3,
57 : /*! Thirty two bit unsigned integer */ GDT_UInt32 = 4,
58 : /*! Thirty two bit signed integer */ GDT_Int32 = 5,
59 : /*! Thirty two bit floating point */ GDT_Float32 = 6,
60 : /*! Sixty four bit floating point */ GDT_Float64 = 7,
61 : /*! Complex Int16 */ GDT_CInt16 = 8,
62 : /*! Complex Int32 */ GDT_CInt32 = 9,
63 : /*! Complex Float32 */ GDT_CFloat32 = 10,
64 : /*! Complex Float64 */ GDT_CFloat64 = 11,
65 : GDT_TypeCount = 12 /* maximum type # + 1 */
66 : } GDALDataType;
67 :
68 : int CPL_DLL CPL_STDCALL GDALGetDataTypeSize( GDALDataType );
69 : int CPL_DLL CPL_STDCALL GDALDataTypeIsComplex( GDALDataType );
70 : const char CPL_DLL * CPL_STDCALL GDALGetDataTypeName( GDALDataType );
71 : GDALDataType CPL_DLL CPL_STDCALL GDALGetDataTypeByName( const char * );
72 : GDALDataType CPL_DLL CPL_STDCALL GDALDataTypeUnion( GDALDataType, GDALDataType );
73 :
74 : /**
75 : * status of the asynchronous stream
76 : */
77 : typedef enum
78 : {
79 : GARIO_PENDING = 0,
80 : GARIO_UPDATE = 1,
81 : GARIO_ERROR = 2,
82 : GARIO_COMPLETE = 3,
83 : GARIO_TypeCount = 4
84 : } GDALAsyncStatusType;
85 :
86 : const char CPL_DLL * CPL_STDCALL GDALGetAsyncStatusTypeName( GDALAsyncStatusType );
87 : GDALAsyncStatusType CPL_DLL CPL_STDCALL GDALGetAsyncStatusTypeByName( const char * );
88 :
89 : /*! Flag indicating read/write, or read-only access to data. */
90 : typedef enum {
91 : /*! Read only (no update) access */ GA_ReadOnly = 0,
92 : /*! Read/write access. */ GA_Update = 1
93 : } GDALAccess;
94 :
95 : /*! Read/Write flag for RasterIO() method */
96 : typedef enum {
97 : /*! Read data */ GF_Read = 0,
98 : /*! Write data */ GF_Write = 1
99 : } GDALRWFlag;
100 :
101 : /*! Types of color interpretation for raster bands. */
102 : typedef enum
103 : {
104 : GCI_Undefined=0,
105 : /*! Greyscale */ GCI_GrayIndex=1,
106 : /*! Paletted (see associated color table) */ GCI_PaletteIndex=2,
107 : /*! Red band of RGBA image */ GCI_RedBand=3,
108 : /*! Green band of RGBA image */ GCI_GreenBand=4,
109 : /*! Blue band of RGBA image */ GCI_BlueBand=5,
110 : /*! Alpha (0=transparent, 255=opaque) */ GCI_AlphaBand=6,
111 : /*! Hue band of HLS image */ GCI_HueBand=7,
112 : /*! Saturation band of HLS image */ GCI_SaturationBand=8,
113 : /*! Lightness band of HLS image */ GCI_LightnessBand=9,
114 : /*! Cyan band of CMYK image */ GCI_CyanBand=10,
115 : /*! Magenta band of CMYK image */ GCI_MagentaBand=11,
116 : /*! Yellow band of CMYK image */ GCI_YellowBand=12,
117 : /*! Black band of CMLY image */ GCI_BlackBand=13,
118 : /*! Y Luminance */ GCI_YCbCr_YBand=14,
119 : /*! Cb Chroma */ GCI_YCbCr_CbBand=15,
120 : /*! Cr Chroma */ GCI_YCbCr_CrBand=16,
121 : /*! Max current value */ GCI_Max=16
122 : } GDALColorInterp;
123 :
124 : const char CPL_DLL *GDALGetColorInterpretationName( GDALColorInterp );
125 : GDALColorInterp CPL_DLL GDALGetColorInterpretationByName( const char *pszName );
126 :
127 : /*! Types of color interpretations for a GDALColorTable. */
128 : typedef enum
129 : {
130 : /*! Grayscale (in GDALColorEntry.c1) */ GPI_Gray=0,
131 : /*! Red, Green, Blue and Alpha in (in c1, c2, c3 and c4) */ GPI_RGB=1,
132 : /*! Cyan, Magenta, Yellow and Black (in c1, c2, c3 and c4)*/ GPI_CMYK=2,
133 : /*! Hue, Lightness and Saturation (in c1, c2, and c3) */ GPI_HLS=3
134 : } GDALPaletteInterp;
135 :
136 : const char CPL_DLL *GDALGetPaletteInterpretationName( GDALPaletteInterp );
137 :
138 : /* "well known" metadata items. */
139 :
140 : #define GDALMD_AREA_OR_POINT "AREA_OR_POINT"
141 : # define GDALMD_AOP_AREA "Area"
142 : # define GDALMD_AOP_POINT "Point"
143 :
144 : /* -------------------------------------------------------------------- */
145 : /* GDAL Specific error codes. */
146 : /* */
147 : /* error codes 100 to 299 reserved for GDAL. */
148 : /* -------------------------------------------------------------------- */
149 : #define CPLE_WrongFormat 200
150 :
151 : /* -------------------------------------------------------------------- */
152 : /* Define handle types related to various internal classes. */
153 : /* -------------------------------------------------------------------- */
154 :
155 : /** Opaque type used for the C bindings of the C++ GDALMajorObject class */
156 : typedef void *GDALMajorObjectH;
157 :
158 : /** Opaque type used for the C bindings of the C++ GDALDataset class */
159 : typedef void *GDALDatasetH;
160 :
161 : /** Opaque type used for the C bindings of the C++ GDALRasterBand class */
162 : typedef void *GDALRasterBandH;
163 :
164 : /** Opaque type used for the C bindings of the C++ GDALDriver class */
165 : typedef void *GDALDriverH;
166 :
167 : #ifndef DOXYGEN_SKIP
168 : /* Deprecated / unused */
169 : typedef void *GDALProjDefH;
170 : #endif
171 :
172 : /** Opaque type used for the C bindings of the C++ GDALColorTable class */
173 : typedef void *GDALColorTableH;
174 :
175 : /** Opaque type used for the C bindings of the C++ GDALRasterAttributeTable class */
176 : typedef void *GDALRasterAttributeTableH;
177 :
178 : /** Opaque type used for the C bindings of the C++ GDALAsyncReader class */
179 : typedef void *GDALAsyncReaderH;
180 :
181 : /* -------------------------------------------------------------------- */
182 : /* Callback "progress" function. */
183 : /* -------------------------------------------------------------------- */
184 :
185 : typedef int (CPL_STDCALL *GDALProgressFunc)(double dfComplete, const char *pszMessage, void *pProgressArg);
186 :
187 : int CPL_DLL CPL_STDCALL GDALDummyProgress( double, const char *, void *);
188 : int CPL_DLL CPL_STDCALL GDALTermProgress( double, const char *, void *);
189 : int CPL_DLL CPL_STDCALL GDALScaledProgress( double, const char *, void *);
190 : void CPL_DLL * CPL_STDCALL GDALCreateScaledProgress( double, double,
191 : GDALProgressFunc, void * );
192 : void CPL_DLL CPL_STDCALL GDALDestroyScaledProgress( void * );
193 :
194 : /* ==================================================================== */
195 : /* Registration/driver related. */
196 : /* ==================================================================== */
197 :
198 : #ifndef DOXYGEN_SKIP
199 : /* Deprecated / unused */
200 : typedef struct {
201 : char *pszOptionName;
202 : char *pszValueType; /* "boolean", "int", "float", "string",
203 : "string-select" */
204 : char *pszDescription;
205 : char **papszOptions;
206 : } GDALOptionDefinition;
207 : #endif
208 :
209 : #define GDAL_DMD_LONGNAME "DMD_LONGNAME"
210 : #define GDAL_DMD_HELPTOPIC "DMD_HELPTOPIC"
211 : #define GDAL_DMD_MIMETYPE "DMD_MIMETYPE"
212 : #define GDAL_DMD_EXTENSION "DMD_EXTENSION"
213 : #define GDAL_DMD_CREATIONOPTIONLIST "DMD_CREATIONOPTIONLIST"
214 : #define GDAL_DMD_CREATIONDATATYPES "DMD_CREATIONDATATYPES"
215 :
216 : #define GDAL_DCAP_CREATE "DCAP_CREATE"
217 : #define GDAL_DCAP_CREATECOPY "DCAP_CREATECOPY"
218 : #define GDAL_DCAP_VIRTUALIO "DCAP_VIRTUALIO"
219 :
220 : void CPL_DLL CPL_STDCALL GDALAllRegister( void );
221 :
222 : GDALDatasetH CPL_DLL CPL_STDCALL GDALCreate( GDALDriverH hDriver,
223 : const char *, int, int, int, GDALDataType,
224 : char ** );
225 : GDALDatasetH CPL_DLL CPL_STDCALL
226 : GDALCreateCopy( GDALDriverH, const char *, GDALDatasetH,
227 : int, char **, GDALProgressFunc, void * );
228 :
229 : GDALDriverH CPL_DLL CPL_STDCALL GDALIdentifyDriver( const char * pszFilename,
230 : char ** papszFileList );
231 : GDALDatasetH CPL_DLL CPL_STDCALL
232 : GDALOpen( const char *pszFilename, GDALAccess eAccess );
233 : GDALDatasetH CPL_DLL CPL_STDCALL GDALOpenShared( const char *, GDALAccess );
234 : int CPL_DLL CPL_STDCALL GDALDumpOpenDatasets( FILE * );
235 :
236 : GDALDriverH CPL_DLL CPL_STDCALL GDALGetDriverByName( const char * );
237 : int CPL_DLL CPL_STDCALL GDALGetDriverCount( void );
238 : GDALDriverH CPL_DLL CPL_STDCALL GDALGetDriver( int );
239 : void CPL_DLL CPL_STDCALL GDALDestroyDriver( GDALDriverH );
240 : int CPL_DLL CPL_STDCALL GDALRegisterDriver( GDALDriverH );
241 : void CPL_DLL CPL_STDCALL GDALDeregisterDriver( GDALDriverH );
242 : void CPL_DLL CPL_STDCALL GDALDestroyDriverManager( void );
243 : CPLErr CPL_DLL CPL_STDCALL GDALDeleteDataset( GDALDriverH, const char * );
244 : CPLErr CPL_DLL CPL_STDCALL GDALRenameDataset( GDALDriverH,
245 : const char * pszNewName,
246 : const char * pszOldName );
247 : CPLErr CPL_DLL CPL_STDCALL GDALCopyDatasetFiles( GDALDriverH,
248 : const char * pszNewName,
249 : const char * pszOldName);
250 : int CPL_DLL CPL_STDCALL GDALValidateCreationOptions( GDALDriverH,
251 : char** papszCreationOptions);
252 :
253 : /* The following are deprecated */
254 : const char CPL_DLL * CPL_STDCALL GDALGetDriverShortName( GDALDriverH );
255 : const char CPL_DLL * CPL_STDCALL GDALGetDriverLongName( GDALDriverH );
256 : const char CPL_DLL * CPL_STDCALL GDALGetDriverHelpTopic( GDALDriverH );
257 : const char CPL_DLL * CPL_STDCALL GDALGetDriverCreationOptionList( GDALDriverH );
258 :
259 : /* ==================================================================== */
260 : /* GDAL_GCP */
261 : /* ==================================================================== */
262 :
263 : /** Ground Control Point */
264 : typedef struct
265 : {
266 : /** Unique identifier, often numeric */
267 : char *pszId;
268 :
269 : /** Informational message or "" */
270 : char *pszInfo;
271 :
272 : /** Pixel (x) location of GCP on raster */
273 : double dfGCPPixel;
274 : /** Line (y) location of GCP on raster */
275 : double dfGCPLine;
276 :
277 : /** X position of GCP in georeferenced space */
278 : double dfGCPX;
279 :
280 : /** Y position of GCP in georeferenced space */
281 : double dfGCPY;
282 :
283 : /** Elevation of GCP, or zero if not known */
284 : double dfGCPZ;
285 : } GDAL_GCP;
286 :
287 : void CPL_DLL CPL_STDCALL GDALInitGCPs( int, GDAL_GCP * );
288 : void CPL_DLL CPL_STDCALL GDALDeinitGCPs( int, GDAL_GCP * );
289 : GDAL_GCP CPL_DLL * CPL_STDCALL GDALDuplicateGCPs( int, const GDAL_GCP * );
290 :
291 : int CPL_DLL CPL_STDCALL
292 : GDALGCPsToGeoTransform( int nGCPCount, const GDAL_GCP *pasGCPs,
293 : double *padfGeoTransform, int bApproxOK );
294 : int CPL_DLL CPL_STDCALL
295 : GDALInvGeoTransform( double *padfGeoTransformIn,
296 : double *padfInvGeoTransformOut );
297 : void CPL_DLL CPL_STDCALL GDALApplyGeoTransform( double *, double, double,
298 : double *, double * );
299 :
300 : /* ==================================================================== */
301 : /* major objects (dataset, and, driver, drivermanager). */
302 : /* ==================================================================== */
303 :
304 : char CPL_DLL ** CPL_STDCALL GDALGetMetadata( GDALMajorObjectH, const char * );
305 : CPLErr CPL_DLL CPL_STDCALL GDALSetMetadata( GDALMajorObjectH, char **,
306 : const char * );
307 : const char CPL_DLL * CPL_STDCALL
308 : GDALGetMetadataItem( GDALMajorObjectH, const char *, const char * );
309 : CPLErr CPL_DLL CPL_STDCALL
310 : GDALSetMetadataItem( GDALMajorObjectH, const char *, const char *,
311 : const char * );
312 : const char CPL_DLL * CPL_STDCALL GDALGetDescription( GDALMajorObjectH );
313 : void CPL_DLL CPL_STDCALL GDALSetDescription( GDALMajorObjectH, const char * );
314 :
315 : /* ==================================================================== */
316 : /* GDALDataset class ... normally this represents one file. */
317 : /* ==================================================================== */
318 :
319 : GDALDriverH CPL_DLL CPL_STDCALL GDALGetDatasetDriver( GDALDatasetH );
320 : char CPL_DLL ** CPL_STDCALL GDALGetFileList( GDALDatasetH );
321 : void CPL_DLL CPL_STDCALL GDALClose( GDALDatasetH );
322 : int CPL_DLL CPL_STDCALL GDALGetRasterXSize( GDALDatasetH );
323 : int CPL_DLL CPL_STDCALL GDALGetRasterYSize( GDALDatasetH );
324 : int CPL_DLL CPL_STDCALL GDALGetRasterCount( GDALDatasetH );
325 : GDALRasterBandH CPL_DLL CPL_STDCALL GDALGetRasterBand( GDALDatasetH, int );
326 :
327 : CPLErr CPL_DLL CPL_STDCALL GDALAddBand( GDALDatasetH hDS, GDALDataType eType,
328 : char **papszOptions );
329 :
330 : GDALAsyncReaderH CPL_DLL CPL_STDCALL
331 : GDALBeginAsyncReader(GDALDatasetH hDS, int nXOff, int nYOff,
332 : int nXSize, int nYSize,
333 : void *pBuf, int nBufXSize, int nBufYSize,
334 : GDALDataType eBufType, int nBandCount, int* panBandMap,
335 : int nPixelSpace, int nLineSpace, int nBandSpace,
336 : char **papszOptions);
337 :
338 : void CPL_DLL CPL_STDCALL
339 : GDALEndAsyncReader(GDALDatasetH hDS, GDALAsyncReaderH hAsynchReaderH);
340 :
341 : CPLErr CPL_DLL CPL_STDCALL GDALDatasetRasterIO(
342 : GDALDatasetH hDS, GDALRWFlag eRWFlag,
343 : int nDSXOff, int nDSYOff, int nDSXSize, int nDSYSize,
344 : void * pBuffer, int nBXSize, int nBYSize, GDALDataType eBDataType,
345 : int nBandCount, int *panBandCount,
346 : int nPixelSpace, int nLineSpace, int nBandSpace);
347 :
348 : CPLErr CPL_DLL CPL_STDCALL GDALDatasetAdviseRead( GDALDatasetH hDS,
349 : int nDSXOff, int nDSYOff, int nDSXSize, int nDSYSize,
350 : int nBXSize, int nBYSize, GDALDataType eBDataType,
351 : int nBandCount, int *panBandCount, char **papszOptions );
352 :
353 : const char CPL_DLL * CPL_STDCALL GDALGetProjectionRef( GDALDatasetH );
354 : CPLErr CPL_DLL CPL_STDCALL GDALSetProjection( GDALDatasetH, const char * );
355 : CPLErr CPL_DLL CPL_STDCALL GDALGetGeoTransform( GDALDatasetH, double * );
356 : CPLErr CPL_DLL CPL_STDCALL GDALSetGeoTransform( GDALDatasetH, double * );
357 :
358 : int CPL_DLL CPL_STDCALL GDALGetGCPCount( GDALDatasetH );
359 : const char CPL_DLL * CPL_STDCALL GDALGetGCPProjection( GDALDatasetH );
360 : const GDAL_GCP CPL_DLL * CPL_STDCALL GDALGetGCPs( GDALDatasetH );
361 : CPLErr CPL_DLL CPL_STDCALL GDALSetGCPs( GDALDatasetH, int, const GDAL_GCP *,
362 : const char * );
363 :
364 : void CPL_DLL * CPL_STDCALL GDALGetInternalHandle( GDALDatasetH, const char * );
365 : int CPL_DLL CPL_STDCALL GDALReferenceDataset( GDALDatasetH );
366 : int CPL_DLL CPL_STDCALL GDALDereferenceDataset( GDALDatasetH );
367 :
368 : CPLErr CPL_DLL CPL_STDCALL
369 : GDALBuildOverviews( GDALDatasetH, const char *, int, int *,
370 : int, int *, GDALProgressFunc, void * );
371 : void CPL_DLL CPL_STDCALL GDALGetOpenDatasets( GDALDatasetH **hDS, int *pnCount );
372 : int CPL_DLL CPL_STDCALL GDALGetAccess( GDALDatasetH hDS );
373 : void CPL_DLL CPL_STDCALL GDALFlushCache( GDALDatasetH hDS );
374 :
375 : CPLErr CPL_DLL CPL_STDCALL
376 : GDALCreateDatasetMaskBand( GDALDatasetH hDS, int nFlags );
377 :
378 : CPLErr CPL_DLL CPL_STDCALL GDALDatasetCopyWholeRaster(
379 : GDALDatasetH hSrcDS, GDALDatasetH hDstDS, char **papszOptions,
380 : GDALProgressFunc pfnProgress, void *pProgressData );
381 :
382 : CPLErr CPL_DLL
383 : GDALRegenerateOverviews( GDALRasterBandH hSrcBand,
384 : int nOverviewCount, GDALRasterBandH *pahOverviewBands,
385 : const char *pszResampling,
386 : GDALProgressFunc pfnProgress, void *pProgressData );
387 :
388 : /* ==================================================================== */
389 : /* GDALRasterBand ... one band/channel in a dataset. */
390 : /* ==================================================================== */
391 :
392 : /**
393 : * SRCVAL - Macro which may be used by pixel functions to obtain
394 : * a pixel from a source buffer.
395 : */
396 : #define SRCVAL(papoSource, eSrcType, ii) \
397 : (eSrcType == GDT_Byte ? \
398 : ((GByte *)papoSource)[ii] : \
399 : (eSrcType == GDT_Float32 ? \
400 : ((float *)papoSource)[ii] : \
401 : (eSrcType == GDT_Float64 ? \
402 : ((double *)papoSource)[ii] : \
403 : (eSrcType == GDT_Int32 ? \
404 : ((GInt32 *)papoSource)[ii] : \
405 : (eSrcType == GDT_UInt16 ? \
406 : ((GUInt16 *)papoSource)[ii] : \
407 : (eSrcType == GDT_Int16 ? \
408 : ((GInt16 *)papoSource)[ii] : \
409 : (eSrcType == GDT_UInt32 ? \
410 : ((GUInt32 *)papoSource)[ii] : \
411 : (eSrcType == GDT_CInt16 ? \
412 : ((GInt16 *)papoSource)[ii * 2] : \
413 : (eSrcType == GDT_CInt32 ? \
414 : ((GInt32 *)papoSource)[ii * 2] : \
415 : (eSrcType == GDT_CFloat32 ? \
416 : ((float *)papoSource)[ii * 2] : \
417 : (eSrcType == GDT_CFloat64 ? \
418 : ((double *)papoSource)[ii * 2] : 0)))))))))))
419 :
420 : typedef CPLErr
421 : (*GDALDerivedPixelFunc)(void **papoSources, int nSources, void *pData,
422 : int nBufXSize, int nBufYSize,
423 : GDALDataType eSrcType, GDALDataType eBufType,
424 : int nPixelSpace, int nLineSpace);
425 :
426 : GDALDataType CPL_DLL CPL_STDCALL GDALGetRasterDataType( GDALRasterBandH );
427 : void CPL_DLL CPL_STDCALL
428 : GDALGetBlockSize( GDALRasterBandH, int * pnXSize, int * pnYSize );
429 :
430 : CPLErr CPL_DLL CPL_STDCALL GDALRasterAdviseRead( GDALRasterBandH hRB,
431 : int nDSXOff, int nDSYOff, int nDSXSize, int nDSYSize,
432 : int nBXSize, int nBYSize, GDALDataType eBDataType, char **papszOptions );
433 :
434 : CPLErr CPL_DLL CPL_STDCALL
435 : GDALRasterIO( GDALRasterBandH hRBand, GDALRWFlag eRWFlag,
436 : int nDSXOff, int nDSYOff, int nDSXSize, int nDSYSize,
437 : void * pBuffer, int nBXSize, int nBYSize,GDALDataType eBDataType,
438 : int nPixelSpace, int nLineSpace );
439 : CPLErr CPL_DLL CPL_STDCALL GDALReadBlock( GDALRasterBandH, int, int, void * );
440 : CPLErr CPL_DLL CPL_STDCALL GDALWriteBlock( GDALRasterBandH, int, int, void * );
441 : int CPL_DLL CPL_STDCALL GDALGetRasterBandXSize( GDALRasterBandH );
442 : int CPL_DLL CPL_STDCALL GDALGetRasterBandYSize( GDALRasterBandH );
443 : GDALAccess CPL_DLL CPL_STDCALL GDALGetRasterAccess( GDALRasterBandH );
444 : int CPL_DLL CPL_STDCALL GDALGetBandNumber( GDALRasterBandH );
445 : GDALDatasetH CPL_DLL CPL_STDCALL GDALGetBandDataset( GDALRasterBandH );
446 :
447 : GDALColorInterp CPL_DLL CPL_STDCALL
448 : GDALGetRasterColorInterpretation( GDALRasterBandH );
449 : CPLErr CPL_DLL CPL_STDCALL
450 : GDALSetRasterColorInterpretation( GDALRasterBandH, GDALColorInterp );
451 : GDALColorTableH CPL_DLL CPL_STDCALL GDALGetRasterColorTable( GDALRasterBandH );
452 : CPLErr CPL_DLL CPL_STDCALL GDALSetRasterColorTable( GDALRasterBandH, GDALColorTableH );
453 : int CPL_DLL CPL_STDCALL GDALHasArbitraryOverviews( GDALRasterBandH );
454 : int CPL_DLL CPL_STDCALL GDALGetOverviewCount( GDALRasterBandH );
455 : GDALRasterBandH CPL_DLL CPL_STDCALL GDALGetOverview( GDALRasterBandH, int );
456 : double CPL_DLL CPL_STDCALL GDALGetRasterNoDataValue( GDALRasterBandH, int * );
457 : CPLErr CPL_DLL CPL_STDCALL GDALSetRasterNoDataValue( GDALRasterBandH, double );
458 : char CPL_DLL ** CPL_STDCALL GDALGetRasterCategoryNames( GDALRasterBandH );
459 : CPLErr CPL_DLL CPL_STDCALL GDALSetRasterCategoryNames( GDALRasterBandH, char ** );
460 : double CPL_DLL CPL_STDCALL GDALGetRasterMinimum( GDALRasterBandH, int *pbSuccess );
461 : double CPL_DLL CPL_STDCALL GDALGetRasterMaximum( GDALRasterBandH, int *pbSuccess );
462 : CPLErr CPL_DLL CPL_STDCALL GDALGetRasterStatistics(
463 : GDALRasterBandH, int bApproxOK, int bForce,
464 : double *pdfMin, double *pdfMax, double *pdfMean, double *pdfStdDev );
465 : CPLErr CPL_DLL CPL_STDCALL GDALComputeRasterStatistics(
466 : GDALRasterBandH, int bApproxOK,
467 : double *pdfMin, double *pdfMax, double *pdfMean, double *pdfStdDev,
468 : GDALProgressFunc pfnProgress, void *pProgressData );
469 : CPLErr CPL_DLL CPL_STDCALL GDALSetRasterStatistics(
470 : GDALRasterBandH hBand,
471 : double dfMin, double dfMax, double dfMean, double dfStdDev );
472 :
473 : const char CPL_DLL * CPL_STDCALL GDALGetRasterUnitType( GDALRasterBandH );
474 : CPLErr CPL_DLL CPL_STDCALL GDALSetRasterUnitType( GDALRasterBandH hBand, const char *pszNewValue );
475 : double CPL_DLL CPL_STDCALL GDALGetRasterOffset( GDALRasterBandH, int *pbSuccess );
476 : CPLErr CPL_DLL CPL_STDCALL GDALSetRasterOffset( GDALRasterBandH hBand, double dfNewOffset);
477 : double CPL_DLL CPL_STDCALL GDALGetRasterScale( GDALRasterBandH, int *pbSuccess );
478 : CPLErr CPL_DLL CPL_STDCALL GDALSetRasterScale( GDALRasterBandH hBand, double dfNewOffset );
479 : void CPL_DLL CPL_STDCALL
480 : GDALComputeRasterMinMax( GDALRasterBandH hBand, int bApproxOK,
481 : double adfMinMax[2] );
482 : CPLErr CPL_DLL CPL_STDCALL GDALFlushRasterCache( GDALRasterBandH hBand );
483 : CPLErr CPL_DLL CPL_STDCALL GDALGetRasterHistogram( GDALRasterBandH hBand,
484 : double dfMin, double dfMax,
485 : int nBuckets, int *panHistogram,
486 : int bIncludeOutOfRange, int bApproxOK,
487 : GDALProgressFunc pfnProgress,
488 : void * pProgressData );
489 : CPLErr CPL_DLL CPL_STDCALL GDALGetDefaultHistogram( GDALRasterBandH hBand,
490 : double *pdfMin, double *pdfMax,
491 : int *pnBuckets, int **ppanHistogram,
492 : int bForce,
493 : GDALProgressFunc pfnProgress,
494 : void * pProgressData );
495 : CPLErr CPL_DLL CPL_STDCALL GDALSetDefaultHistogram( GDALRasterBandH hBand,
496 : double dfMin, double dfMax,
497 : int nBuckets, int *panHistogram );
498 : int CPL_DLL CPL_STDCALL
499 : GDALGetRandomRasterSample( GDALRasterBandH, int, float * );
500 : GDALRasterBandH CPL_DLL CPL_STDCALL
501 : GDALGetRasterSampleOverview( GDALRasterBandH, int );
502 : CPLErr CPL_DLL CPL_STDCALL GDALFillRaster( GDALRasterBandH hBand,
503 : double dfRealValue, double dfImaginaryValue );
504 : CPLErr CPL_DLL CPL_STDCALL
505 : GDALComputeBandStats( GDALRasterBandH hBand, int nSampleStep,
506 : double *pdfMean, double *pdfStdDev,
507 : GDALProgressFunc pfnProgress,
508 : void *pProgressData );
509 : CPLErr CPL_DLL GDALOverviewMagnitudeCorrection( GDALRasterBandH hBaseBand,
510 : int nOverviewCount,
511 : GDALRasterBandH *pahOverviews,
512 : GDALProgressFunc pfnProgress,
513 : void *pProgressData );
514 :
515 : GDALRasterAttributeTableH CPL_DLL CPL_STDCALL GDALGetDefaultRAT(
516 : GDALRasterBandH hBand );
517 : CPLErr CPL_DLL CPL_STDCALL GDALSetDefaultRAT( GDALRasterBandH,
518 : GDALRasterAttributeTableH );
519 : CPLErr CPL_DLL CPL_STDCALL GDALAddDerivedBandPixelFunc( const char *pszName,
520 : GDALDerivedPixelFunc pfnPixelFunc );
521 :
522 : GDALRasterBandH CPL_DLL CPL_STDCALL GDALGetMaskBand( GDALRasterBandH hBand );
523 : int CPL_DLL CPL_STDCALL GDALGetMaskFlags( GDALRasterBandH hBand );
524 : CPLErr CPL_DLL CPL_STDCALL
525 : GDALCreateMaskBand( GDALRasterBandH hBand, int nFlags );
526 :
527 : #define GMF_ALL_VALID 0x01
528 : #define GMF_PER_DATASET 0x02
529 : #define GMF_ALPHA 0x04
530 : #define GMF_NODATA 0x08
531 :
532 : /* ==================================================================== */
533 : /* GDALAsyncReader */
534 : /* ==================================================================== */
535 :
536 : GDALAsyncStatusType CPL_DLL CPL_STDCALL
537 : GDALARGetNextUpdatedRegion(GDALAsyncReaderH hARIO, double dfTimeout,
538 : int* pnXBufOff, int* pnYBufOff,
539 : int* pnXBufSize, int* pnYBufSize );
540 : int CPL_DLL CPL_STDCALL GDALARLockBuffer(GDALAsyncReaderH hARIO,
541 : double dfTimeout);
542 : void CPL_DLL CPL_STDCALL GDALARUnlockBuffer(GDALAsyncReaderH hARIO);
543 :
544 : /* -------------------------------------------------------------------- */
545 : /* Helper functions. */
546 : /* -------------------------------------------------------------------- */
547 : int CPL_DLL CPL_STDCALL GDALGeneralCmdLineProcessor( int nArgc, char ***ppapszArgv,
548 : int nOptions );
549 : void CPL_DLL CPL_STDCALL GDALSwapWords( void *pData, int nWordSize, int nWordCount,
550 : int nWordSkip );
551 : void CPL_DLL CPL_STDCALL
552 : GDALCopyWords( void * pSrcData, GDALDataType eSrcType, int nSrcPixelOffset,
553 : void * pDstData, GDALDataType eDstType, int nDstPixelOffset,
554 : int nWordCount );
555 :
556 : void CPL_DLL
557 : GDALCopyBits( const GByte *pabySrcData, int nSrcOffset, int nSrcStep,
558 : GByte *pabyDstData, int nDstOffset, int nDstStep,
559 : int nBitCount, int nStepCount );
560 :
561 : int CPL_DLL CPL_STDCALL GDALLoadWorldFile( const char *, double * );
562 : int CPL_DLL CPL_STDCALL GDALReadWorldFile( const char *, const char *,
563 : double * );
564 : int CPL_DLL CPL_STDCALL GDALWriteWorldFile( const char *, const char *,
565 : double * );
566 : int CPL_DLL CPL_STDCALL GDALLoadTabFile( const char *, double *, char **,
567 : int *, GDAL_GCP ** );
568 : int CPL_DLL CPL_STDCALL GDALReadTabFile( const char *, double *, char **,
569 : int *, GDAL_GCP ** );
570 : int CPL_DLL CPL_STDCALL GDALLoadOziMapFile( const char *, double *, char **,
571 : int *, GDAL_GCP ** );
572 : int CPL_DLL CPL_STDCALL GDALReadOziMapFile( const char * , double *,
573 : char **, int *, GDAL_GCP ** );
574 : char CPL_DLL ** CPL_STDCALL GDALLoadRPBFile( const char *pszFilename,
575 : char **papszSiblingFiles );
576 : char CPL_DLL ** CPL_STDCALL GDALLoadRPCFile( const char *pszFilename,
577 : char **papszSiblingFiles );
578 : CPLErr CPL_DLL CPL_STDCALL GDALWriteRPBFile( const char *pszFilename,
579 : char **papszMD );
580 : char CPL_DLL ** CPL_STDCALL GDALLoadIMDFile( const char *pszFilename,
581 : char **papszSiblingFiles );
582 : CPLErr CPL_DLL CPL_STDCALL GDALWriteIMDFile( const char *pszFilename,
583 : char **papszMD );
584 :
585 : const char CPL_DLL * CPL_STDCALL GDALDecToDMS( double, const char *, int );
586 : double CPL_DLL CPL_STDCALL GDALPackedDMSToDec( double );
587 : double CPL_DLL CPL_STDCALL GDALDecToPackedDMS( double );
588 :
589 : /* Note to developers : please keep this section in sync with ogr_core.h */
590 :
591 : #ifndef GDAL_VERSION_INFO_DEFINED
592 : #define GDAL_VERSION_INFO_DEFINED
593 : const char CPL_DLL * CPL_STDCALL GDALVersionInfo( const char * );
594 : #endif
595 :
596 : #ifndef GDAL_CHECK_VERSION
597 :
598 : int CPL_DLL CPL_STDCALL GDALCheckVersion( int nVersionMajor, int nVersionMinor,
599 : const char* pszCallingComponentName);
600 :
601 : /** Helper macro for GDALCheckVersion()
602 : @see GDALCheckVersion()
603 : */
604 : #define GDAL_CHECK_VERSION(pszCallingComponentName) \
605 : GDALCheckVersion(GDAL_VERSION_MAJOR, GDAL_VERSION_MINOR, pszCallingComponentName)
606 :
607 : #endif
608 :
609 : typedef struct {
610 : double dfLINE_OFF;
611 : double dfSAMP_OFF;
612 : double dfLAT_OFF;
613 : double dfLONG_OFF;
614 : double dfHEIGHT_OFF;
615 :
616 : double dfLINE_SCALE;
617 : double dfSAMP_SCALE;
618 : double dfLAT_SCALE;
619 : double dfLONG_SCALE;
620 : double dfHEIGHT_SCALE;
621 :
622 : double adfLINE_NUM_COEFF[20];
623 : double adfLINE_DEN_COEFF[20];
624 : double adfSAMP_NUM_COEFF[20];
625 : double adfSAMP_DEN_COEFF[20];
626 :
627 : double dfMIN_LONG;
628 : double dfMIN_LAT;
629 : double dfMAX_LONG;
630 : double dfMAX_LAT;
631 :
632 : } GDALRPCInfo;
633 :
634 : int CPL_DLL CPL_STDCALL GDALExtractRPCInfo( char **, GDALRPCInfo * );
635 :
636 : /* ==================================================================== */
637 : /* Color tables. */
638 : /* ==================================================================== */
639 :
640 : /** Color tuple */
641 : typedef struct
642 : {
643 : /*! gray, red, cyan or hue */
644 : short c1;
645 :
646 : /*! green, magenta, or lightness */
647 : short c2;
648 :
649 : /*! blue, yellow, or saturation */
650 : short c3;
651 :
652 : /*! alpha or blackband */
653 : short c4;
654 425846 : } GDALColorEntry;
655 :
656 : GDALColorTableH CPL_DLL CPL_STDCALL GDALCreateColorTable( GDALPaletteInterp );
657 : void CPL_DLL CPL_STDCALL GDALDestroyColorTable( GDALColorTableH );
658 : GDALColorTableH CPL_DLL CPL_STDCALL GDALCloneColorTable( GDALColorTableH );
659 : GDALPaletteInterp CPL_DLL CPL_STDCALL GDALGetPaletteInterpretation( GDALColorTableH );
660 : int CPL_DLL CPL_STDCALL GDALGetColorEntryCount( GDALColorTableH );
661 : const GDALColorEntry CPL_DLL * CPL_STDCALL GDALGetColorEntry( GDALColorTableH, int );
662 : int CPL_DLL CPL_STDCALL GDALGetColorEntryAsRGB( GDALColorTableH, int, GDALColorEntry *);
663 : void CPL_DLL CPL_STDCALL GDALSetColorEntry( GDALColorTableH, int, const GDALColorEntry * );
664 : void CPL_DLL CPL_STDCALL GDALCreateColorRamp( GDALColorTableH hTable,
665 : int nStartIndex, const GDALColorEntry *psStartColor,
666 : int nEndIndex, const GDALColorEntry *psEndColor );
667 :
668 : /* ==================================================================== */
669 : /* Raster Attribute Table */
670 : /* ==================================================================== */
671 :
672 : /** Field type of raster attribute table */
673 : typedef enum {
674 : /*! Integer field */ GFT_Integer ,
675 : /*! Floating point (double) field */ GFT_Real,
676 : /*! String field */ GFT_String
677 : } GDALRATFieldType;
678 :
679 : /** Field usage of raster attribute table */
680 : typedef enum {
681 : /*! General purpose field. */ GFU_Generic = 0,
682 : /*! Histogram pixel count */ GFU_PixelCount = 1,
683 : /*! Class name */ GFU_Name = 2,
684 : /*! Class range minimum */ GFU_Min = 3,
685 : /*! Class range maximum */ GFU_Max = 4,
686 : /*! Class value (min=max) */ GFU_MinMax = 5,
687 : /*! Red class color (0-255) */ GFU_Red = 6,
688 : /*! Green class color (0-255) */ GFU_Green = 7,
689 : /*! Blue class color (0-255) */ GFU_Blue = 8,
690 : /*! Alpha (0=transparent,255=opaque)*/ GFU_Alpha = 9,
691 : /*! Color Range Red Minimum */ GFU_RedMin = 10,
692 : /*! Color Range Green Minimum */ GFU_GreenMin = 11,
693 : /*! Color Range Blue Minimum */ GFU_BlueMin = 12,
694 : /*! Color Range Alpha Minimum */ GFU_AlphaMin = 13,
695 : /*! Color Range Red Maximum */ GFU_RedMax = 14,
696 : /*! Color Range Green Maximum */ GFU_GreenMax = 15,
697 : /*! Color Range Blue Maximum */ GFU_BlueMax = 16,
698 : /*! Color Range Alpha Maximum */ GFU_AlphaMax = 17,
699 : /*! Maximum GFU value */ GFU_MaxCount
700 : } GDALRATFieldUsage;
701 :
702 : GDALRasterAttributeTableH CPL_DLL CPL_STDCALL
703 : GDALCreateRasterAttributeTable(void);
704 : void CPL_DLL CPL_STDCALL GDALDestroyRasterAttributeTable(
705 : GDALRasterAttributeTableH );
706 :
707 : int CPL_DLL CPL_STDCALL GDALRATGetColumnCount( GDALRasterAttributeTableH );
708 :
709 : const char CPL_DLL * CPL_STDCALL GDALRATGetNameOfCol(
710 : GDALRasterAttributeTableH, int );
711 : GDALRATFieldUsage CPL_DLL CPL_STDCALL GDALRATGetUsageOfCol(
712 : GDALRasterAttributeTableH, int );
713 : GDALRATFieldType CPL_DLL CPL_STDCALL GDALRATGetTypeOfCol(
714 : GDALRasterAttributeTableH, int );
715 :
716 : int CPL_DLL CPL_STDCALL GDALRATGetColOfUsage( GDALRasterAttributeTableH,
717 : GDALRATFieldUsage );
718 : int CPL_DLL CPL_STDCALL GDALRATGetRowCount( GDALRasterAttributeTableH );
719 :
720 : const char CPL_DLL * CPL_STDCALL GDALRATGetValueAsString(
721 : GDALRasterAttributeTableH, int ,int);
722 : int CPL_DLL CPL_STDCALL GDALRATGetValueAsInt(
723 : GDALRasterAttributeTableH, int ,int);
724 : double CPL_DLL CPL_STDCALL GDALRATGetValueAsDouble(
725 : GDALRasterAttributeTableH, int ,int);
726 :
727 : void CPL_DLL CPL_STDCALL GDALRATSetValueAsString( GDALRasterAttributeTableH, int, int,
728 : const char * );
729 : void CPL_DLL CPL_STDCALL GDALRATSetValueAsInt( GDALRasterAttributeTableH, int, int,
730 : int );
731 : void CPL_DLL CPL_STDCALL GDALRATSetValueAsDouble( GDALRasterAttributeTableH, int, int,
732 : double );
733 : void CPL_DLL CPL_STDCALL GDALRATSetRowCount( GDALRasterAttributeTableH,
734 : int );
735 : CPLErr CPL_DLL CPL_STDCALL GDALRATCreateColumn( GDALRasterAttributeTableH,
736 : const char *,
737 : GDALRATFieldType,
738 : GDALRATFieldUsage );
739 : CPLErr CPL_DLL CPL_STDCALL GDALRATSetLinearBinning( GDALRasterAttributeTableH,
740 : double, double );
741 : int CPL_DLL CPL_STDCALL GDALRATGetLinearBinning( GDALRasterAttributeTableH,
742 : double *, double * );
743 : CPLErr CPL_DLL CPL_STDCALL GDALRATInitializeFromColorTable(
744 : GDALRasterAttributeTableH, GDALColorTableH );
745 : GDALColorTableH CPL_DLL CPL_STDCALL GDALRATTranslateToColorTable(
746 : GDALRasterAttributeTableH, int nEntryCount );
747 : void CPL_DLL CPL_STDCALL GDALRATDumpReadable( GDALRasterAttributeTableH,
748 : FILE * );
749 : GDALRasterAttributeTableH CPL_DLL CPL_STDCALL
750 : GDALRATClone( GDALRasterAttributeTableH );
751 :
752 : int CPL_DLL CPL_STDCALL GDALRATGetRowOfValue( GDALRasterAttributeTableH , double );
753 :
754 :
755 : /* ==================================================================== */
756 : /* GDAL Cache Management */
757 : /* ==================================================================== */
758 :
759 : void CPL_DLL CPL_STDCALL GDALSetCacheMax( int nBytes );
760 : int CPL_DLL CPL_STDCALL GDALGetCacheMax(void);
761 : int CPL_DLL CPL_STDCALL GDALGetCacheUsed(void);
762 : int CPL_DLL CPL_STDCALL GDALFlushCacheBlock(void);
763 :
764 : CPL_C_END
765 :
766 : #endif /* ndef GDAL_H_INCLUDED */
|