Debian Codegraph @

frmts/gtiff/libgeotiff/geo_keyp.h

raw symbols SCIP
1 /**********************************************************************
2 *
3 * geo_keyp.h - private interface for GeoTIFF geokey 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_GEO_KEYP_H_
14 #define LIBGEOTIFF_GEO_KEYP_H_
15
16 #include <stdlib.h> /* for size_t */
17
18 #include "proj.h"
19
20 /*
21 * This structure contains the internal program
22 * representation of the key entry.
23 */
24 struct GeoKey {
25 int gk_key; /* GeoKey ID */
26 size_t gk_size; /* data byte size */
27 tagtype_t gk_type; /* TIFF data type */
28 long gk_count; /* number of values */
29 char* gk_data; /* pointer to data, or value */
30 };
31 typedef struct GeoKey GeoKey;
32
33 /*
34 * This structure represents the file-organization of
35 * the key entry. Note that it assumes that short entries
36 * are aligned along 2-byte boundaries.
37 */
38 struct KeyEntry {
39 pinfo_t ent_key; /* GeoKey ID */
40 pinfo_t ent_location; /* TIFF Tag ID or 0 */
41 pinfo_t ent_count; /* GeoKey value count */
42 pinfo_t ent_val_offset; /* value or tag offset */
43 };
44 typedef struct KeyEntry KeyEntry;
45
46 /*
47 * This is the header of the CoordSystemInfoTag. The 'Version'
48 * will only change if the CoorSystemInfoTag structure changes;
49 * The Major Revision will be incremented whenever a new set of
50 * Keys is added or changed, while the Minor revision will be
51 * incremented when only the set of Key-values is increased.
52 */
53 struct KeyHeader{
54 pinfo_t hdr_version; /* GeoTIFF Version */
55 pinfo_t hdr_rev_major; /* GeoKey Major Revision # */
56 pinfo_t hdr_rev_minor; /* GeoKey Minor Revision # */
57 pinfo_t hdr_num_keys; /* Number of GeoKeys */
58 };
59 typedef struct KeyHeader KeyHeader;
60
61 /*
62 * This structure holds temporary data while reading or writing
63 * the tags.
64 */
65 struct TempKeyData {
66 char *tk_asciiParams;
67 int tk_asciiParamsLength;
68 int tk_asciiParamsOffset;
69 };
70 typedef struct TempKeyData TempKeyData;
71
72 struct gtiff;
73
74 #ifndef GTIF_PRINT_FUNC_FORMAT
75 #if defined(__GNUC__) && __GNUC__ >= 3
76 #define GTIF_PRINT_FUNC_FORMAT( format_idx, arg_idx ) __attribute__((__format__ (__printf__, format_idx, arg_idx)))
77 #else
78 #define GTIF_PRINT_FUNC_FORMAT( format_idx, arg_idx )
79 #endif
80 #endif
81
82 #ifndef GTERRORCALLBACK_DEFINED
83 #define GTERRORCALLBACK_DEFINED
84 /* Defined in both geotiff.h and geo_kep.h */
85 typedef void (*GTErrorCallback) (struct gtiff*,
86 int level,
87 const char* msg, ...) GTIF_PRINT_FUNC_FORMAT(3,4);
88 #endif
89
90 struct gtiff {
91 tiff_t* gt_tif; /* TIFF file descriptor */
92 struct _TIFFMethod gt_methods; /* TIFF i/o methods */
93 int gt_flags; /* file flags */
94
95 pinfo_t gt_version; /* GeoTIFF Version */
96 pinfo_t gt_rev_major;/* GeoKey Key Revision */
97 pinfo_t gt_rev_minor;/* GeoKey Code Revision */
98
99 int gt_num_keys; /* number of keys */
100 GeoKey* gt_keys; /* array of keys */
101 int* gt_keyindex; /* index of a key, if set*/
102 int gt_keymin; /* smallest key set */
103 int gt_keymax; /* largest key set */
104
105 pinfo_t* gt_short; /* array of SHORT vals */
106 double* gt_double; /* array of DOUBLE vals */
107 int gt_nshorts; /* number of SHORT vals */
108 int gt_ndoubles; /* number of DOUBLE vals */
109
110 GTErrorCallback gt_error_callback;
111 void* gt_user_data;
112
113 PJ_CONTEXT *pj_context; /* PROJ context */
114 int own_pj_context; /* whether we own the PROJ context */
115
116 char szTmpBufferForGTIFValueNameEx[160];
117 };
118
119 typedef enum {
120 FLAG_FILE_OPEN=1,
121 FLAG_FILE_MODIFIED=2
122 } gtiff_flags;
123
124 #define MAX_KEYINDEX 65535 /* largest possible key */
125 #define MAX_KEYS 100 /* maximum keys in a file */
126 #define MAX_VALUES 1000 /* maximum values in a tag */
127
128 #endif /* LIBGEOTIFF_GEO_KEYP_H_ */