svn-gvsig-desktop / tags / Root_v061 / libraries / libjni-ecw / include / NCSGeoTIFFBoxUtil.h @ 11717
History | View | Annotate | Download (5.8 KB)
1 |
/********************************************************
|
---|---|
2 |
** Copyright 2004 Earth Resource Mapping Ltd.
|
3 |
** This document contains proprietary source code of
|
4 |
** Earth Resource Mapping Ltd, and can only be used under
|
5 |
** one of the three licenses as described in the
|
6 |
** license.txt file supplied with this distribution.
|
7 |
** See separate license.txt file for license details
|
8 |
** and conditions.
|
9 |
**
|
10 |
** This software is covered by US patent #6,442,298,
|
11 |
** #6,102,897 and #6,633,688. Rights to use these patents
|
12 |
** is included in the license agreements.
|
13 |
**
|
14 |
** FILE: $Archive: /NCS/Source/include/NCSGeoTIFFBoxUtil.h $
|
15 |
** CREATED: 12/07/2004 3:27:34 PM
|
16 |
** AUTHOR: Tom Lynch
|
17 |
** PURPOSE: Static GeoTIFF file values for JPEG 2000 GeoTIFF UUID Box (GeoJP2)
|
18 |
** GeoTIFF related #defines
|
19 |
** Utility CNCSAffineTransform class definition
|
20 |
** EDITS: [xx] ddMmmyy NAME COMMENTS
|
21 |
** [01] 08Jul04 tfl Changes to write GeoJP2 headers correctly
|
22 |
** [02] 03Aug04 tfl More GeoTIFF Box header changes
|
23 |
** [03] 22Nov04 tfl Added photometric interpretation tag to GeoJP2 data to fix ERDAS load
|
24 |
*******************************************************/
|
25 |
|
26 |
#ifndef NCSGEOTIFFBOXUTIL_H
|
27 |
#define NCSGEOTIFFBOXUTIL_H
|
28 |
|
29 |
#define TIFF_BIGENDIAN_CODE 0x4949 //Two byte TIFF header codes flagging endianness |
30 |
#define TIFF_LITTLEENDIAN_CODE 0x4d4d |
31 |
#define TIFF_IDENTITY_CODE 0x2a //Further magic number identifying file as a TIFF (42) |
32 |
|
33 |
#ifndef NCSECWCLIENT_H
|
34 |
#include "NCSECWClient.h" //For NCSFileViewFileInfoEx |
35 |
#endif
|
36 |
#ifndef NCSJP2FILE_H
|
37 |
#include "NCSJP2File.h" //For TIFFTag |
38 |
#endif
|
39 |
|
40 |
#ifndef ECW_MAX_PROJECTION_LEN
|
41 |
#define ECW_MAX_PROJECTION_LEN 16 |
42 |
#endif
|
43 |
|
44 |
class CNCSAffineTransform |
45 |
{ |
46 |
|
47 |
public:
|
48 |
IEEE8 fScaleX; |
49 |
IEEE8 fScaleY; |
50 |
IEEE8 fRotX; |
51 |
IEEE8 fRotY; |
52 |
IEEE8 fTransX; |
53 |
IEEE8 fTransY; |
54 |
|
55 |
CNCSAffineTransform(); |
56 |
CNCSAffineTransform(IEEE4 fPrecision); |
57 |
~CNCSAffineTransform(); |
58 |
|
59 |
BOOLEAN GetFromFileInfoEx(NCSFileViewFileInfoEx &FileInfo); |
60 |
BOOLEAN GetFromFileInfo(NCSFileViewFileInfo &FileInfo); |
61 |
BOOLEAN GetFromGeoTIFFModelTransformationTag(CNCSJP2File::CNCSJP2PCSBox::TIFFTag *pTransformTag); |
62 |
BOOLEAN PopulateFileInfoEx(NCSFileViewFileInfoEx &FileInfo); |
63 |
BOOLEAN PopulateFileInfo(NCSFileViewFileInfo &FileInfo); |
64 |
BOOLEAN IsValid(); |
65 |
private:
|
66 |
void Standardize();
|
67 |
IEEE4 m_fPrecision; |
68 |
}; |
69 |
|
70 |
//This static array contains most of the default byte values in the GeoTIFF box
|
71 |
static UINT8 GeoTIFFInitialData[] =
|
72 |
{ |
73 |
0xb1,0x4b,0xf8,0xbd,0x8,0x3d,0x4b,0x43,0xa5,0xae,0x8c,0xd7,0xd5,0xa6,0xce,0x3,//UUID |
74 |
|
75 |
//GeoTIFF file header
|
76 |
0x49,0x49,//TIFF_BIGENDIAN_CODE (little-endian in accordance with GeoJP2 spec) |
77 |
0x2a,0x00,//TIFF_IDENTITY_CODE (42 little-endian) |
78 |
0x08,0x00,0x00,0x00,//Offset of first IFD (8 bytes so follows on immediately) |
79 |
|
80 |
//First IFD
|
81 |
0x0c,0x00,//0x0b == 10 IFD entries |
82 |
|
83 |
//Entry 0
|
84 |
0x00,0x01,//TIFF tag value == 256, image width |
85 |
0x03,0x00,//Type of field == 3, UINT16 |
86 |
0x01,0x00,0x00,0x00,//Only one such value |
87 |
0x01,0x00,0x00,0x00,//Width is 1 |
88 |
|
89 |
//Entry 1
|
90 |
0x01,0x01,//TIFF tag value == 257, image height (otherwise same as above) |
91 |
0x03,0x00, |
92 |
0x01,0x00,0x00,0x00, |
93 |
0x01,0x00,0x00,0x00, |
94 |
|
95 |
//Entry 2
|
96 |
0x02,0x01,//TIFF tag value == 258, bits per sample |
97 |
0x03,0x00,//Type is UINT16 again |
98 |
0x01,0x00,0x00,0x00, |
99 |
0x08,0x00,0x00,0x00,//8 bits for our single pixel |
100 |
|
101 |
//Entry 3
|
102 |
0x03,0x01,//TIFF tag value == 259, compression technique |
103 |
0x03,0x00, |
104 |
0x01,0x00,0x00,0x00, |
105 |
0x01,0x00,0x00,0x00,//no compression used |
106 |
|
107 |
//Entry 4
|
108 |
0x06,0x01, //Photometric Interpretation [03] |
109 |
0x03,0x00, //Type is SHORT |
110 |
0x01,0x00,0x00,0x00, |
111 |
0x01,0x00,0x00,0x00, //value 0x01 == BlackIsZero |
112 |
|
113 |
//Entry 5
|
114 |
0x11,0x01,//TIFF tag value == 273, strip offsets |
115 |
0x04,0x00,//Type is UINT32 (TIFF_LONG) |
116 |
0x01,0x00,0x00,0x00, |
117 |
0x00,0x00,0x00,0x00, |
118 |
|
119 |
//Entry 6
|
120 |
0x15,0x01,//TIFF tag value == 277, samples per pixel |
121 |
0x03,0x00, |
122 |
0x01,0x00,0x00,0x00, |
123 |
0x01,0x00,0x00,0x00, |
124 |
|
125 |
//Entry 7
|
126 |
0x17,0x01,//TIFF tag value == 279, strip byte count |
127 |
0x04,0x00, |
128 |
0x01,0x00,0x00,0x00, |
129 |
0x00,0x00,0x00,0x00, |
130 |
|
131 |
//Entry 8
|
132 |
0x1c,0x01,//TIFF tag value == 284, storage organisation |
133 |
0x03,0x00, |
134 |
0x01,0x00,0x00,0x00, |
135 |
0x01,0x00,0x00,0x00, //single contiguous image plane |
136 |
|
137 |
/*//Entry 8
|
138 |
0x0e,0x83,//TIFF tag value == 33550, ModelPixelScaleTag
|
139 |
0x0c,0x00,//Data type TIFF_DOUBLE, 64-bit floating point (IEEE8)
|
140 |
0x03,0x00,0x00,0x00,//3 such values
|
141 |
0x92,0x00,0x00,0x00,//value offset
|
142 |
|
143 |
//Entry 9
|
144 |
0x82,0x84,//TIFF tag value == 33922, ModelTiePointTag
|
145 |
0x0c,0x00,//IEEE8 data type
|
146 |
0x06,0x00,0x00,0x00,//6 values representing (XYZ)<-->(IJK)
|
147 |
0xaa,0x00,0x00,0x00,//offset to values
|
148 |
|
149 |
//Entry 10
|
150 |
0xaf,0x87,//TIFF tag value == 34735, GeoKeyDirectoryTag
|
151 |
0x03,0x00,
|
152 |
0x10,0x00,0x00,0x00,//16 values
|
153 |
0xda,0x00,0x00,0x00,
|
154 |
//End of IFD entries
|
155 |
|
156 |
0x00,0x00,//Presumably this is the pixel value
|
157 |
|
158 |
//Offset here is 0x92 - pixel scale values
|
159 |
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
160 |
0x4e,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
|
161 |
0x4e,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
|
162 |
|
163 |
//Offset here is 0xaa - tie point values
|
164 |
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
165 |
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
166 |
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
167 |
0x00,0x00,0x00,0x00,0x00,0x00,0x40,0xe6,
|
168 |
0x1a,0x41,0x00,0x00,0x00,0x00,0xcc,0x9e,
|
169 |
0x4c,0x41,0x00,0x00,0x00,0x00,0x00,0x00,
|
170 |
|
171 |
//Offset here is 0xda - GeoKeyDirectoryTag values
|
172 |
0x00,0x00,
|
173 |
0x01,0x00,
|
174 |
0x01,0x00,
|
175 |
0x00,0x00,
|
176 |
0x03,0x00,
|
177 |
0x00,0x04,
|
178 |
0x00,0x00,
|
179 |
0x01,0x00,
|
180 |
0x01,0x00,
|
181 |
0x01,0x04,
|
182 |
0x00,0x00,
|
183 |
0x01,0x00,
|
184 |
0x01,0x00,
|
185 |
0x00,0x0c,
|
186 |
0x00,0x00,
|
187 |
0x01,0x00,
|
188 |
0x57,0x68*/
|
189 |
}; |
190 |
|
191 |
#endif
|