xtiffio.h File Reference

Definitions relating GeoTIFF functions from geotiff.h to the TIFF library (usually libtiff). More...

#include "tiffio.h"
#include "geo_config.h"
Include dependency graph for xtiffio.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define TIFFTAG_GEOPIXELSCALE   33550
#define TIFFTAG_INTERGRAPH_MATRIX   33920
#define TIFFTAG_GEOTIEPOINTS   33922
#define TIFFTAG_GEOTRANSMATRIX   34264
#define TIFFTAG_GEOKEYDIRECTORY   34735
#define TIFFTAG_GEODOUBLEPARAMS   34736
#define TIFFTAG_GEOASCIIPARAMS   34737
#define TIFFPRINT_GEOKEYDIRECTORY   0x80000000
#define TIFFPRINT_GEOKEYPARAMS   0x40000000

Functions

void CPL_DLL XTIFFInitialize ()
 Registers an extension with libtiff for adding GeoTIFF tags.
TIFF CPL_DLL * XTIFFOpen (const char *name, const char *mode)
 GeoTIFF compatible TIFF file open function.
TIFF CPL_DLL * XTIFFFdOpen (int fd, const char *name, const char *mode)
void CPL_DLL XTIFFClose (TIFF *tif)
 Close a file opened with XTIFFOpen().
TIFF CPL_DLL * XTIFFClientOpen (const char *name, const char *mode, thandle_t thehandle, TIFFReadWriteProc, TIFFReadWriteProc, TIFFSeekProc, TIFFCloseProc, TIFFSizeProc, TIFFMapFileProc, TIFFUnmapFileProc)

Detailed Description

Definitions relating GeoTIFF functions from geotiff.h to the TIFF library (usually libtiff).


Function Documentation

void CPL_DLL XTIFFClose ( TIFF *  tif  ) 

Close a file opened with XTIFFOpen().

Parameters:
tif The file handle returned by XTIFFOpen().

If a GTIF structure was created with GTIFNew() for this file, it should be freed with GTIFFree() before calling XTIFFClose().

00203 {
00204     TIFFClose(tif);
00205 }

void CPL_DLL XTIFFInitialize ( void   ) 

Registers an extension with libtiff for adding GeoTIFF tags.

After this one-time intialization, any TIFF open function may be called in the usual manner to create a TIFF file that compatible with libgeotiff. The XTIFF open functions are simply for convenience: they call this and then pass their parameters on to the appropriate TIFF open function.

This function may be called any number of times safely, since it will only register the extension the first time it is called.

00101 {
00102     static int first_time=1;
00103         
00104     if (! first_time) return; /* Been there. Done that. */
00105     first_time = 0;
00106         
00107     /* Grab the inherited method and install */
00108     _ParentExtender = TIFFSetTagExtender(_XTIFFDefaultDirectory);
00109 }

TIFF CPL_DLL* XTIFFOpen ( const char *  name,
const char *  mode 
)

GeoTIFF compatible TIFF file open function.

Parameters:
name The filename of a TIFF file to open.
mode The open mode ("r", "w" or "a").
Returns:
a TIFF * for the file, or NULL if the open failed.

This function is used to open GeoTIFF files instead of TIFFOpen() from libtiff. Internally it calls TIFFOpen(), but sets up some extra hooks so that GeoTIFF tags can be extracted from the file. If XTIFFOpen() isn't used, GTIFNew() won't work properly. Files opened with XTIFFOpen() should be closed with XTIFFClose().

The name of the file to be opened should be passed as name, and an opening mode ("r", "w" or "a") acceptable to TIFFOpen() should be passed as the mode.

If XTIFFOpen() fails it will return NULL. Otherwise, normal TIFFOpen() error reporting steps will have already taken place.

00136 {
00137     TIFF *tif;
00138 
00139     /* Set up the callback */
00140     XTIFFInitialize();  
00141         
00142     /* Open the file; the callback will set everything up
00143      */
00144     tif = TIFFOpen(name, mode);
00145     if (!tif) return tif;
00146         
00147     return tif;
00148 }


Generated on 8 Nov 2011 for libgeotiff-1.3.0 by  doxygen 1.6.1