00001 /********************************************************************** 00002 * 00003 * geo_keyp.h - private interface for GeoTIFF geokey tag parsing 00004 * 00005 * Written by: Niles D. Ritter 00006 * 00007 **********************************************************************/ 00008 00009 #ifndef __geo_keyp_h_ 00010 #define __geo_keyp_h_ 00011 00012 #include <stdlib.h> /* for size_t */ 00013 00014 /* 00015 * This structure contains the internal program 00016 * representation of the key entry. 00017 */ 00018 struct GeoKey { 00019 int gk_key; /* GeoKey ID */ 00020 size_t gk_size; /* data byte size */ 00021 tagtype_t gk_type; /* TIFF data type */ 00022 long gk_count; /* number of values */ 00023 char* gk_data; /* pointer to data, or value */ 00024 }; 00025 typedef struct GeoKey GeoKey; 00026 00027 /* 00028 * This structure represents the file-organization of 00029 * the key entry. Note that it assumes that short entries 00030 * are aligned along 2-byte boundaries. 00031 */ 00032 struct KeyEntry { 00033 pinfo_t ent_key; /* GeoKey ID */ 00034 pinfo_t ent_location; /* TIFF Tag ID or 0 */ 00035 pinfo_t ent_count; /* GeoKey value count */ 00036 pinfo_t ent_val_offset; /* value or tag offset */ 00037 }; 00038 typedef struct KeyEntry KeyEntry; 00039 00040 /* 00041 * This is the header of the CoordSystemInfoTag. The 'Version' 00042 * will only change if the CoorSystemInfoTag structure changes; 00043 * The Major Revision will be incremented whenever a new set of 00044 * Keys is added or changed, while the Minor revision will be 00045 * incremented when only the set of Key-values is increased. 00046 */ 00047 struct KeyHeader{ 00048 pinfo_t hdr_version; /* GeoTIFF Version */ 00049 pinfo_t hdr_rev_major; /* GeoKey Major Revision # */ 00050 pinfo_t hdr_rev_minor; /* GeoKey Minor Revision # */ 00051 pinfo_t hdr_num_keys; /* Number of GeoKeys */ 00052 }; 00053 typedef struct KeyHeader KeyHeader; 00054 00055 00056 struct gtiff { 00057 tiff_t* gt_tif; /* TIFF file descriptor */ 00058 TIFFMethod gt_methods; /* TIFF i/o methods */ 00059 int gt_flags; /* file flags */ 00060 00061 pinfo_t gt_version; /* GeoTIFF Version */ 00062 pinfo_t gt_rev_major;/* GeoKey Key Revision */ 00063 pinfo_t gt_rev_minor;/* GeoKey Code Revision */ 00064 00065 int gt_num_keys; /* number of keys */ 00066 GeoKey* gt_keys; /* array of keys */ 00067 int* gt_keyindex; /* index of a key, if set*/ 00068 int gt_keymin; /* smallest key set */ 00069 int gt_keymax; /* largest key set */ 00070 00071 pinfo_t* gt_short; /* array of SHORT vals */ 00072 double* gt_double; /* array of DOUBLE vals */ 00073 char* gt_ascii; /* array of ASCII string */ 00074 int gt_nshorts; /* number of SHORT vals */ 00075 int gt_ndoubles; /* number of DOUBLE vals */ 00076 int gt_nascii; /* number of ASCII chars */ 00077 }; 00078 00079 typedef enum { 00080 FLAG_FILE_OPEN=1, 00081 FLAG_FILE_MODIFIED=2 00082 } gtiff_flags; 00083 00084 #define MAX_KEYINDEX 65535 /* largest possible key */ 00085 #define MAX_KEYS 100 /* maximum keys in a file */ 00086 #define MAX_VALUES 1000 /* maximum values in a tag */ 00087 00088 #endif /* __geo_keyp_h_ */ 00089