1 /*
2 ===============================================================================
3 
4   FILE:  laz_vlr.hpp
5 
6   CONTENTS:
7     LAZ io
8 
9   PROGRAMMERS:
10 
11     martin.isenburg@rapidlasso.com  -  http://rapidlasso.com
12     uday.karan@gmail.com - Hobu, Inc.
13 
14   COPYRIGHT:
15 
16     (c) 2007-2014, martin isenburg, rapidlasso - tools to catch reality
17     (c) 2014, Uday Verma, Hobu, Inc.
18 
19     This is free software; you can redistribute and/or modify it under the
20     terms of the GNU Lesser General Licence as published by the Free Software
21     Foundation. See the COPYING file for more information.
22 
23     This software is distributed WITHOUT ANY WARRANTY and without even the
24     implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
25 
26   CHANGE HISTORY:
27 
28 ===============================================================================
29 */
30 
31 #pragma once
32 
33 #include "vlr.hpp"
34 #include "utils.hpp"
35 
36 namespace lazperf
37 {
38 
39 #pragma pack(push, 1)
40 
41 // A Single LAZ Item representation
42 struct laz_vlr : public vlr
43 {
44     enum
45     {
46         BYTE = 0,
47         POINT10 = 6,
48         GPSTIME = 7,
49         RGB12 = 8,
50         POINT14 = 10,
51         RGB14 = 11,
52         RGBNIR14 = 12,
53         BYTE14 = 14
54     };
55 
56 
57     struct laz_item
58     {
59         uint16_t type;
60         uint16_t size;
61         uint16_t version;
62 
pointlazperf::laz_vlr::laz_item63         static const laz_item point()
64         {
65             return laz_item{ POINT10, 20, 2 };
66         }
gpstimelazperf::laz_vlr::laz_item67         static const laz_item gpstime()
68         {
69             return laz_item{ GPSTIME, 8, 2 };
70         }
rgblazperf::laz_vlr::laz_item71         static const laz_item rgb()
72         {
73             return laz_item{ RGB12, 6, 2 };
74         }
eblazperf::laz_vlr::laz_item75         static const laz_item eb(uint16_t count)
76         {
77             return laz_item{ BYTE, count, 2 };
78         }
point14lazperf::laz_vlr::laz_item79         static const laz_item point14()
80         {
81             return laz_item{ POINT14, 30, 3 };
82         }
rgb14lazperf::laz_vlr::laz_item83         static const laz_item rgb14()
84         {
85             return laz_item{ RGB14, 6, 3 };
86         }
rgbnir14lazperf::laz_vlr::laz_item87         static const laz_item rgbnir14()
88         {
89             return laz_item{ RGBNIR14, 8, 3 };
90         }
eb14lazperf::laz_vlr::laz_item91         static const laz_item eb14(uint16_t count)
92         {
93             return laz_item{ BYTE14, count, 3 };
94         }
95     };
96 
97 
98     uint16_t compressor;
99     uint16_t coder;
100 
101     uint8_t ver_major;
102     uint8_t ver_minor;
103     uint16_t revision;
104 
105     uint32_t options;
106     uint32_t chunk_size;
107     int64_t num_points;
108     int64_t num_bytes;
109 
110     std::vector<laz_item> items;
111 
112     laz_vlr();
113     laz_vlr(int format, int ebCount, uint32_t chunksize);
114     laz_vlr(const char *data);
115     ~laz_vlr();
116 
117     virtual size_t size() const;
118     virtual vlr::vlr_header header();
119     void fill(const char *data);
120     std::vector<uint8_t> data() const;
121 };
122 #pragma pack(pop)
123 
124 } // namesapce lazperf
125 
126