laszip.hpp
Go to the documentation of this file.
1 /*
2 ===============================================================================
3 
4  FILE: laszip.hpp
5 
6  CONTENTS:
7 
8  Contains LASitem and LASchunk structs as well as the IDs of the currently
9  supported entropy coding scheme
10 
11  PROGRAMMERS:
12 
13  martin.isenburg@gmail.com
14 
15  COPYRIGHT:
16 
17  (c) 2007-2011, Martin Isenburg, LASSO - tools to catch reality
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  5 December 2011 -- learns the chunk table if it is missing (e.g. truncated LAZ)
29  6 October 2011 -- large file support, ability to read with missing chunk table
30  23 June 2011 -- turned on LASzip version 2.0 compressor with chunking
31  8 May 2011 -- added an option for variable chunking via chunk()
32  23 April 2011 -- changed interface for simplicity and chunking support
33  20 March 2011 -- incrementing LASZIP_VERSION to 1.2 for improved compression
34  10 January 2011 -- licensing change for LGPL release and liblas integration
35  12 December 2010 -- refactored from lasdefinitions after movies with silke
36 
37 ===============================================================================
38 */
39 #ifndef LASZIP_HPP
40 #define LASZIP_HPP
41 
42 #if defined(_MSC_VER) && (_MSC_VER < 1300)
43 #define LZ_WIN32_VC6
44 typedef __int64 SIGNED_INT64;
45 #else
46 typedef long long SIGNED_INT64;
47 #endif
48 
49 #define LASZIP_VERSION_MAJOR 2
50 #define LASZIP_VERSION_MINOR 0
51 #define LASZIP_VERSION_REVISION 3
52 
53 #define LASZIP_COMPRESSOR_NONE 0
54 #define LASZIP_COMPRESSOR_POINTWISE 1
55 #define LASZIP_COMPRESSOR_POINTWISE_CHUNKED 2
56 #define LASZIP_COMPRESSOR_TOTAL_NUMBER_OF 3
57 
58 #define LASZIP_COMPRESSOR_CHUNKED LASZIP_COMPRESSOR_POINTWISE_CHUNKED
59 #define LASZIP_COMPRESSOR_NOT_CHUNKED LASZIP_COMPRESSOR_POINTWISE
60 
61 #define LASZIP_COMPRESSOR_DEFAULT LASZIP_COMPRESSOR_CHUNKED
62 
63 #define LASZIP_CODER_ARITHMETIC 0
64 #define LASZIP_CODER_TOTAL_NUMBER_OF 1
65 
66 #define LASZIP_CHUNK_SIZE_DEFAULT 50000
67 
68 #define LASZIP_DLL
69 
70 class LASitem
71 {
72 public:
74  unsigned short size;
75  unsigned short version;
76  bool is_type(LASitem::Type t) const;
77  const char* get_name() const;
78 };
79 
81 {
82 public:
83 
84  // supported version control
85  bool check_compressor(const unsigned short compressor);
86  bool check_coder(const unsigned short coder);
87  bool check_item(const LASitem* item);
88  bool check_items(const unsigned short num_items, const LASitem* items);
89  bool check();
90 
91  // go back and forth between item array and point type & size
92  bool setup(unsigned short* num_items, LASitem** items, const unsigned char point_type, const unsigned short point_size, const unsigned short compressor=LASZIP_COMPRESSOR_NONE);
93  bool is_standard(const unsigned short num_items, const LASitem* items, unsigned char* point_type=0, unsigned short* record_length=0);
94  bool is_standard(unsigned char* point_type=0, unsigned short* record_length=0);
95 
96  // pack to and unpack from VLR
97  unsigned char* bytes;
98  bool unpack(const unsigned char* bytes, const int num);
99  bool pack(unsigned char*& bytes, int& num);
100 
101  // setup
102  bool setup(const unsigned char point_type, const unsigned short point_size, const unsigned short compressor=LASZIP_COMPRESSOR_DEFAULT);
103  bool setup(const unsigned short num_items, const LASitem* items, const unsigned short compressor);
104  bool set_chunk_size(const unsigned int chunk_size); /* for compressor only */
105  bool request_version(const unsigned short requested_version); /* for compressor only */
106 
107  // in case a function returns false this string describes the problem
108  const char* get_error() const;
109 
110  // stored in LASzip VLR data section
111  unsigned short compressor;
112  unsigned short coder;
113  unsigned char version_major;
114  unsigned char version_minor;
115  unsigned short version_revision;
116  unsigned int options;
117  unsigned int chunk_size;
118  SIGNED_INT64 num_points; /* not mandatory ... -1 if unknown */
119  SIGNED_INT64 num_bytes; /* not mandatory ... -1 if unknown */
120  unsigned short num_items;
122 
123  LASzip();
124  ~LASzip();
125 
126 private:
127  bool return_error(const char* err);
129 };
130 
131 #endif
LASitem::version
unsigned short version
Definition: laszip.hpp:75
LASzip::num_items
unsigned short num_items
Definition: laszip.hpp:120
SIGNED_INT64
long long SIGNED_INT64
Definition: laszip.hpp:46
LASitem::get_name
const char * get_name() const
Definition: laszip.cpp:798
LASZIP_COMPRESSOR_NONE
#define LASZIP_COMPRESSOR_NONE
Definition: laszip.hpp:53
LASitem::SHORT
@ SHORT
Definition: laszip.hpp:73
LASitem::POINT10
@ POINT10
Definition: laszip.hpp:73
LASitem::Type
Type
Definition: laszip.hpp:73
LASzip::version_revision
unsigned short version_revision
Definition: laszip.hpp:115
LASzip
Definition: laszip.hpp:80
LASZIP_COMPRESSOR_DEFAULT
#define LASZIP_COMPRESSOR_DEFAULT
Definition: laszip.hpp:61
LASzip::items
LASitem * items
Definition: laszip.hpp:121
LASitem::WAVEPACKET13
@ WAVEPACKET13
Definition: laszip.hpp:73
LASitem::POINT14
@ POINT14
Definition: laszip.hpp:73
LASitem::FLOAT
@ FLOAT
Definition: laszip.hpp:73
LASitem::is_type
bool is_type(LASitem::Type t) const
Definition: laszip.cpp:772
LASzip::chunk_size
unsigned int chunk_size
Definition: laszip.hpp:117
LASzip::version_major
unsigned char version_major
Definition: laszip.hpp:113
LASzip::compressor
unsigned short compressor
Definition: laszip.hpp:111
LASitem
Definition: laszip.hpp:70
LASzip::num_points
SIGNED_INT64 num_points
Definition: laszip.hpp:118
LASitem::RGB12
@ RGB12
Definition: laszip.hpp:73
LASzip::version_minor
unsigned char version_minor
Definition: laszip.hpp:114
LASitem::size
unsigned short size
Definition: laszip.hpp:74
LASzip::error_string
char * error_string
Definition: laszip.hpp:128
LASitem::DOUBLE
@ DOUBLE
Definition: laszip.hpp:73
LASitem::GPSTIME11
@ GPSTIME11
Definition: laszip.hpp:73
LASitem::RGBNIR14
@ RGBNIR14
Definition: laszip.hpp:73
LASitem::BYTE
@ BYTE
Definition: laszip.hpp:73
LASitem::type
enum LASitem::Type type
LASzip::num_bytes
SIGNED_INT64 num_bytes
Definition: laszip.hpp:119
LASitem::INT
@ INT
Definition: laszip.hpp:73
LASZIP_DLL
#define LASZIP_DLL
Definition: laszip.hpp:68
LASzip::bytes
unsigned char * bytes
Definition: laszip.hpp:97
LASzip::coder
unsigned short coder
Definition: laszip.hpp:112
LASzip::options
unsigned int options
Definition: laszip.hpp:116
LASitem::LONG
@ LONG
Definition: laszip.hpp:73


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Wed Mar 2 2022 00:37:24