-
Notifications
You must be signed in to change notification settings - Fork 5
/
LASHeader.cs
120 lines (82 loc) · 2.17 KB
/
LASHeader.cs
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
118
119
120
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Reflection;
namespace laslib
{
[Serializable]
[StructLayout(LayoutKind.Explicit, Size = 227)]
public struct LASHeader
{
[FieldOffset(0)]
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public char[] Signature;
[FieldOffset(24)]
public byte VersionMajor;
[FieldOffset(25)]
public byte VersionMinor;
[FieldOffset(90)]
public ushort DayOfYear;
[FieldOffset(92)]
public ushort Year;
[FieldOffset(94)]
public ushort Headersize;
[FieldOffset(96)]
public uint OffsetToData;
[FieldOffset(100)]
public uint NbrVariableLengthRecords;
[FieldOffset(104)]
public byte PointDataFormat;
[FieldOffset(105)]
public ushort PointDataRecordLength;
[FieldOffset(107)]
public uint NumberOfPointRecords;
[FieldOffset(111)]
public uint NumberOfPointsByReturn0;
[FieldOffset(115)]
public uint NumberOfPointsByReturn1;
[FieldOffset(119)]
public uint NumberOfPointsByReturn2;
[FieldOffset(123)]
public uint NumberOfPointsByReturn3;
[FieldOffset(127)]
public uint NumberOfPointsByReturn4;
[FieldOffset(131)]
public double ScaleFactorX;
[FieldOffset(139)]
public double ScaleFactorY;
[FieldOffset(147)]
public double ScaleFactorZ;
[FieldOffset(155)]
public double OffsetX;
[FieldOffset(163)]
public double OffsetY;
[FieldOffset(171)]
public double OffsetZ;
[FieldOffset(179)]
public double MaxX;
[FieldOffset(187)]
public double MinX;
[FieldOffset(195)]
public double MaxY;
[FieldOffset(203)]
public double MinY;
[FieldOffset(211)]
public double MaxZ;
[FieldOffset(219)]
public double MinZ;
public override string ToString()
{
Type type = typeof(LASHeader);
FieldInfo[] fields = type.GetFields();
StringBuilder sb = new StringBuilder();
sb.AppendLine("LAS File Header");
for (int i = 0; i < fields.Length; i++)
{
sb.AppendFormat("{0}: {1}\n", fields[i].Name, fields[i].GetValue(this));
}
return sb.ToString();
}
}
}