Debian Codegraph @

frmts/gtiff/libgeotiff/geotiff.h

raw
1 /**********************************************************************
2 *
3 * geotiff.h - Public interface for Geotiff tag parsing.
4 *
5 * Written By: Niles D. Ritter
6 *
7 * copyright (c) 1995 Niles D. Ritter
8 *
9 * Permission granted to use this software, so long as this copyright
10 * notice accompanies any products derived therefrom.
11 **********************************************************************/
12
13 #ifndef LIBGEOTIFF_GEOTIFF_H_
14 #define LIBGEOTIFF_GEOTIFF_H_
15
16 /**
17 * \file geotiff.h
18 *
19 * Primary libgeotiff include file.
20 *
21 * This is the de facto registry for valid GeoTIFF GeoKeys
22 * and their associated symbolic values. This is also the only file
23 * of the GeoTIFF library which needs to be included in client source
24 * code.
25 */
26
27 /* This Version code should only change if a drastic
28 * alteration is made to the GeoTIFF key structure. Readers
29 * encountering a larger value should give up gracefully.
30 */
31 #define GvCurrentVersion 1
32
33 /* Versions of GeoTIFF specification and corresponding
34 * (version, key_revision, minor_revision) triplets.
35 * At that time, only 2 versions are known: */
36
37 /* GEOTIFF_SPEC_1_0 corresponds to the original GeoTIFF specification,
38 * "Revision 1.0, specification version 1.8.2 in November 1995 (N. Ritter & Ruth, 1995)"
39 * available at http://geotiff.maptools.org/spec/geotiffhome.html */
40 #define GEOTIFF_SPEC_1_0_VERSION 1
41 #define GEOTIFF_SPEC_1_0_KEY_REVISION 1
42 #define GEOTIFF_SPEC_1_0_MINOR_REVISION 0
43
44 /* GEOTIFF_SPEC_1_1 corresponds to the OGC GeoTIFF standard 19-008 */
45 #define GEOTIFF_SPEC_1_1_VERSION 1
46 #define GEOTIFF_SPEC_1_1_KEY_REVISION 1
47 #define GEOTIFF_SPEC_1_1_MINOR_REVISION 1
48
49 /* Library version */
50 #define LIBGEOTIFF_VERSION 1740
51
52 #include "geo_config.h"
53 #include "geokeys.h"
54
55 /**********************************************************************
56 * Do we want to build as a DLL on windows?
57 **********************************************************************/
58 #if !defined(GTIF_DLL)
59 # if defined(_WIN32) && defined(BUILD_AS_DLL)
60 # define GTIF_DLL __declspec(dllexport)
61 # else
62 # define GTIF_DLL
63 # endif
64 #endif
65
66 /**********************************************************************
67 *
68 * Public Structures & Definitions
69 *
70 **********************************************************************/
71
72 #if defined(__cplusplus)
73 extern "C" {
74 #endif
75
76 typedef struct gtiff GTIF; /* struct gtiff is private */
77 typedef struct _TIFFMethod TIFFMethod;
78 typedef unsigned short tifftag_t;
79 typedef unsigned short geocode_t;
80 typedef int (*GTIFPrintMethod)(char *string, void *aux);
81 typedef int (*GTIFReadMethod)(char *string, void *aux); // string 1024+ in size
82
83 typedef enum {
84 TYPE_BYTE=1,
85 TYPE_SHORT=2,
86 TYPE_LONG=3,
87 TYPE_RATIONAL=4,
88 TYPE_ASCII=5,
89 TYPE_FLOAT=6,
90 TYPE_DOUBLE=7,
91 TYPE_SBYTE=8,
92 TYPE_SSHORT=9,
93 TYPE_SLONG=10,
94 TYPE_UNKNOWN=11
95 } tagtype_t;
96
97 #define LIBGEOTIFF_WARNING 0
98 #define LIBGEOTIFF_ERROR 1
99
100 #ifndef GTIF_PRINT_FUNC_FORMAT
101 #if defined(__GNUC__) && __GNUC__ >= 3
102 #define GTIF_PRINT_FUNC_FORMAT( format_idx, arg_idx ) __attribute__((__format__ (__printf__, format_idx, arg_idx)))
103 #else
104 #define GTIF_PRINT_FUNC_FORMAT( format_idx, arg_idx )
105 #endif
106 #endif
107
108 #ifndef GTERRORCALLBACK_DEFINED
109 #define GTERRORCALLBACK_DEFINED
110 /* Defined in both geotiff.h and geo_kep.h */
111 typedef void (*GTErrorCallback) (struct gtiff*,
112 int level,
113 const char* msg, ...) GTIF_PRINT_FUNC_FORMAT(3,4);
114 #endif
115
116 /**********************************************************************
117 *
118 * Public Function Declarations
119 *
120 **********************************************************************/
121
122 /* TIFF-level interface */
123 GTIF GTIF_DLL *GTIFNew(void *tif);
124 GTIF GTIF_DLL *GTIFNewEx(void *tif,
125 GTErrorCallback error_callback, void* user_data);
126 GTIF GTIF_DLL *GTIFNewSimpleTags(void *tif);
127 GTIF GTIF_DLL *GTIFNewWithMethods(void *tif, TIFFMethod*);
128 GTIF GTIF_DLL *GTIFNewWithMethodsEx(void *tif, TIFFMethod* methods,
129 GTErrorCallback error_callback,
130 void* user_data);
131 void GTIF_DLL GTIFFree(GTIF *gtif);
132 int GTIF_DLL GTIFWriteKeys(GTIF *gtif);
133 /* versions must be an array of 3 int */
134 void GTIF_DLL GTIFDirectoryInfo(GTIF *gtif, int versions[3], int *keycount);
135 void GTIF_DLL *GTIFGetUserData(GTIF *gtif);
136 int GTIF_DLL GTIFSetVersionNumbers(GTIF* gtif,
137 unsigned short version,
138 unsigned short key_revision,
139 unsigned short minor_revision);
140
141 /* GeoKey Access */
142 int GTIF_DLL GTIFKeyInfo(GTIF *gtif, geokey_t key, int *size, tagtype_t* type);
143 int GTIF_DLL GTIFKeyGet(GTIF *gtif, geokey_t key, void *val, int index,
144 int count);
145 int GTIF_DLL GTIFKeyGetASCII(GTIF *gtif, geokey_t key, char* szStr,
146 int szStrMaxLen);
147 int GTIF_DLL GTIFKeyGetSHORT(GTIF *gtif, geokey_t key, unsigned short *val, int index,
148 int count);
149 int GTIF_DLL GTIFKeyGetDOUBLE(GTIF *gtif, geokey_t key, double *val, int index,
150 int count);
151 int GTIF_DLL GTIFKeySet(GTIF *gtif, geokey_t keyID, tagtype_t type,
152 int count,...);
153
154 /* Metadata Import-Export utilities */
155 void GTIF_DLL GTIFPrint(GTIF *gtif, GTIFPrintMethod print, void *aux);
156 int GTIF_DLL GTIFImport(GTIF *gtif, GTIFReadMethod scan, void *aux);
157 char GTIF_DLL *GTIFKeyName(geokey_t key);
158 const char GTIF_DLL *GTIFKeyNameEx(GTIF* gtif, geokey_t key);
159 char GTIF_DLL *GTIFValueName(geokey_t key,int value);
160 const char GTIF_DLL *GTIFValueNameEx(GTIF* gtif, geokey_t key,int value);
161 char GTIF_DLL *GTIFTypeName(tagtype_t type);
162 char GTIF_DLL *GTIFTagName(int tag);
163 int GTIF_DLL GTIFKeyCode(const char * key);
164 int GTIF_DLL GTIFValueCode(geokey_t key,const char *value);
165 int GTIF_DLL GTIFTypeCode(const char *type);
166 int GTIF_DLL GTIFTagCode(const char *tag);
167
168 /* Translation between image/PCS space */
169
170 int GTIF_DLL GTIFImageToPCS( GTIF *gtif, double *x, double *y );
171 int GTIF_DLL GTIFPCSToImage( GTIF *gtif, double *x, double *y );
172
173 #if defined(__cplusplus)
174 }
175 #endif
176
177 #endif /* LIBGEOTIFF_GEOTIFF_H_ */