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