1 /********************************************************************** 2 * 3 * geo_keyp.h - private interface for GeoTIFF geokey tag parsing 4 * 5 * Written by: Niles D. Ritter 6 * 7 **********************************************************************/ 8 9 #ifndef __geo_keyp_h_ 10 #define __geo_keyp_h_ 11 12 #include <stdlib.h> /* for size_t */ 13 14 /* 15 * This structure contains the internal program 16 * representation of the key entry. 17 */ 18 struct GeoKey { 19 int gk_key; /* GeoKey ID */ 20 size_t gk_size; /* data byte size */ 21 tagtype_t gk_type; /* TIFF data type */ 22 long gk_count; /* number of values */ 23 char* gk_data; /* pointer to data, or value */ 24 }; 25 typedef struct GeoKey GeoKey; 26 27 /* 28 * This structure represents the file-organization of 29 * the key entry. Note that it assumes that short entries 30 * are aligned along 2-byte boundaries. 31 */ 32 struct KeyEntry { 33 pinfo_t ent_key; /* GeoKey ID */ 34 pinfo_t ent_location; /* TIFF Tag ID or 0 */ 35 pinfo_t ent_count; /* GeoKey value count */ 36 pinfo_t ent_val_offset; /* value or tag offset */ 37 }; 38 typedef struct KeyEntry KeyEntry; 39 40 /* 41 * This is the header of the CoordSystemInfoTag. The 'Version' 42 * will only change if the CoorSystemInfoTag structure changes; 43 * The Major Revision will be incremented whenever a new set of 44 * Keys is added or changed, while the Minor revision will be 45 * incremented when only the set of Key-values is increased. 46 */ 47 struct KeyHeader{ 48 pinfo_t hdr_version; /* GeoTIFF Version */ 49 pinfo_t hdr_rev_major; /* GeoKey Major Revision # */ 50 pinfo_t hdr_rev_minor; /* GeoKey Minor Revision # */ 51 pinfo_t hdr_num_keys; /* Number of GeoKeys */ 52 }; 53 typedef struct KeyHeader KeyHeader; 54 55 /* 56 * This structure holds temporary data while reading or writing 57 * the tags. 58 */ 59 struct TempKeyData { 60 char *tk_asciiParams; 61 int tk_asciiParamsLength; 62 int tk_asciiParamsOffset; 63 }; 64 typedef struct TempKeyData TempKeyData; 65 66 67 struct gtiff { 68 tiff_t* gt_tif; /* TIFF file descriptor */ 69 TIFFMethod gt_methods; /* TIFF i/o methods */ 70 int gt_flags; /* file flags */ 71 72 pinfo_t gt_version; /* GeoTIFF Version */ 73 pinfo_t gt_rev_major;/* GeoKey Key Revision */ 74 pinfo_t gt_rev_minor;/* GeoKey Code Revision */ 75 76 int gt_num_keys; /* number of keys */ 77 GeoKey* gt_keys; /* array of keys */ 78 int* gt_keyindex; /* index of a key, if set*/ 79 int gt_keymin; /* smallest key set */ 80 int gt_keymax; /* largest key set */ 81 82 pinfo_t* gt_short; /* array of SHORT vals */ 83 double* gt_double; /* array of DOUBLE vals */ 84 int gt_nshorts; /* number of SHORT vals */ 85 int gt_ndoubles; /* number of DOUBLE vals */ 86 }; 87 88 typedef enum { 89 FLAG_FILE_OPEN=1, 90 FLAG_FILE_MODIFIED=2 91 } gtiff_flags; 92 93 #define MAX_KEYINDEX 65535 /* largest possible key */ 94 #define MAX_KEYS 100 /* maximum keys in a file */ 95 #define MAX_VALUES 1000 /* maximum values in a tag */ 96 97 #endif /* __geo_keyp_h_ */ 98 99