-
-
Notifications
You must be signed in to change notification settings - Fork 181
/
dted.hexpat
117 lines (106 loc) · 2.47 KB
/
dted.hexpat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#pragma description Digital Terrain Elevation Data
#pragma endian big
import std.core;
import std.io;
import std.mem;
import std.string;
enum Magic:u24 {
UHL = 0x55484C,
DSI = 0x445349,
ACC = 0x414343,
};
struct UHL {
Magic magic;
char one;
char lon[8];
char lat[8];
char lon_data_interval[4];
char lat_data_interval[4];
char accuracy[4];
char security_code[3];
char uniq_ref[12];
char lon_lines[4];
char lat_points[4];
char multi_accuracy;
char reserved[24];
};
struct DSI {
Magic magic;
char classification;
char stuff1[29];
char stuff2[26];
char product_level[5];
char uniq_ref[15];
char reserved[8];
char data_edition[2];
char match_version;
char maint_date[4];
char match_date[4];
char main_desc_code[4];
char producer_code[8];
char reserved2[16];
char product_spec[9];
char numbers[2];
char product_spec_date[4];
char vertical_datum[3];
char horizontal_datum[5];
char digitizing_system[10];
char compilation_date[4];
char reserved3[22];
char lat_origin[9];
char lon_origin[10];
char lat_sw_corner[7];
char lon_sw_corner[8];
char lat_nw_corner[7];
char lon_nw_corner[8];
char lat_ne_corner[7];
char lon_ne_corner[8];
char lat_se_corner[7];
char lon_se_corner[8];
char clockwise_orientation[9];
char lat_interval[4];
char lon_interval[4];
char lat_lines[4];
char lon_lines[4];
char partial_cell[2];
char reserved4[101];
char reserved5[100];
char reserved6[156];
};
struct ACCSub {
char abs_vertical_accuracy[4];
char abs_horizontal_accuracy[4];
char rel_vertical_accuracy[4];
char rel_horizontal_accuracy[4];
char num_coords[2];
char pairs[19*14];
};
struct ACC {
Magic magic;
char abs_horizontal_accuracy[4];
char abs_vertical_accuracy[4];
char rel_horizontal_accuracy[4];
char rel_vertical_accuracy[4];
char reserved1[4];
char reserved2[1];
char reserved3[31];
char multi_accuracy_outline[2]; // determines sub regions
ACCSub subs[9];
char reserved4[18];
char reserved5[69];
};
struct DataRecords {
char magic;
s24 data_block_count;
s16 lon_count;
s16 lat_count;
s16 elevation[std::string::parse_int(parent.dsi.lat_lines, 10)];
u32 checksum;
};
struct DTED {
UHL uhl;
DSI dsi;
ACC acc;
DataRecords records[std::string::parse_int(this.dsi.lon_lines, 10)];
};
DTED dted @ 0x00;