lasdefinitions.hpp
Go to the documentation of this file.
1 /*
2 ===============================================================================
3 
4  FILE: LASdefinitions.hpp
5 
6  CONTENTS:
7 
8  Contains the Header and Point classes for reading and writing LIDAR points
9  in the LAS format
10 
11  Version 1.4, Nov 14, 2011.
12  Version 1.3, Oct 24, 2010.
13  Version 1.2, April 29, 2008.
14  Version 1.1, March 07, 2005.
15  Version 1.0, May 09, 2003
16 
17  PROGRAMMERS:
18 
19  martin.isenburg@gmail.com
20 
21  COPYRIGHT:
22 
23  (c) 2005-2011, Martin Isenburg, LASSO - tools to catch reality
24 
25  This is free software; you can redistribute and/or modify it under the
26  terms of the GNU Lesser General Licence as published by the Free Software
27  Foundation. See the COPYING file for more information.
28 
29  This software is distributed WITHOUT ANY WARRANTY and without even the
30  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
31 
32  CHANGE HISTORY:
33 
34  21 December 2011 -- support for LAS 1.4 and attributed extra bytes
35  10 January 2011 -- licensing change for LGPL release and liblas integration
36  16 December 2010 -- updated to support generic LASitem point formats
37  3 December 2010 -- updated to (somewhat) support LAS format 1.3
38  7 September 2008 -- updated to support LAS format 1.2
39  11 June 2007 -- number of return / scan direction bitfield order was wrong
40  18 February 2007 -- created after repairing 2 vacuum cleaners in the garden
41 
42 ===============================================================================
43 */
44 #ifndef LAS_DEFINITIONS_HPP
45 #define LAS_DEFINITIONS_HPP
46 
47 #define LAS_TOOLS_VERSION 111229
48 
49 #include <stdio.h>
50 #include <string.h>
51 #include <stdlib.h>
52 #include <assert.h>
53 
54 #include "mydefs.hpp"
55 #include "laszip.hpp"
56 
57 #define LAS_TOOLS_FORMAT_DEFAULT 0
58 #define LAS_TOOLS_FORMAT_LAS 1
59 #define LAS_TOOLS_FORMAT_LAZ 2
60 #define LAS_TOOLS_FORMAT_BIN 3
61 #define LAS_TOOLS_FORMAT_SHP 4
62 #define LAS_TOOLS_FORMAT_QFIT 5
63 #define LAS_TOOLS_FORMAT_TXT 6
64 
66 {
67 public:
69  void zero() {memset(data, 0, 29);};
70  inline U8 getIndex() const {return data[0];};
71  inline U64 getOffset() const {return ((U64*)&(data[1]))[0];};
72  inline U32 getSize() const {return ((U32*)&(data[9]))[0];};
73  inline F32 getLocation() const {return ((F32*)&(data[13]))[0];};
74  inline F32 getXt() const {return ((F32*)&(data[17]))[0];};
75  inline F32 getYt() const {return ((F32*)&(data[21]))[0];};
76  inline F32 getZt() const {return ((F32*)&(data[25]))[0];};
77  inline void setIndex(U8 index) {data[0] = index;};
78  inline void setOffset(U64 offset) {((U64*)&(data[1]))[0] = offset;};
79  inline void setSize(U32 size) {((U32*)&(data[9]))[0] = size;};
80  inline void setLocation(F32 location) { ((F32*)&(data[13]))[0] = location;};
81  inline void setXt(F32 xt) {((F32*)&(data[17]))[0] = xt;};
82  inline void setYt(F32 yt) {((F32*)&(data[21]))[0] = yt;};
83  inline void setZt(F32 zt) {((F32*)&(data[25]))[0] = zt;};
84  inline void flipDirection() {((F32*)&(data[17]))[0] *= -1; ((F32*)&(data[21]))[0] *= -1; ((F32*)&(data[25]))[0] *= -1;};
85 private:
86  U8 data[29];
87 };
88 
90 {
91 public:
98 
99  inline F64 get_x(const I32 x) const { return x_scale_factor*x+x_offset; };
100  inline F64 get_y(const I32 y) const { return y_scale_factor*y+y_offset; };
101  inline F64 get_z(const I32 z) const { return z_scale_factor*z+z_offset; };
102 
103  inline I32 get_x(const F64 x) const { if (x >= x_offset) return (I32)((x-x_offset)/x_scale_factor+0.5); else return (I32)((x-x_offset)/x_scale_factor-0.5); };
104  inline I32 get_y(const F64 y) const { if (y >= y_offset) return (I32)((y-y_offset)/y_scale_factor+0.5); else return (I32)((y-y_offset)/y_scale_factor-0.5); };
105  inline I32 get_z(const F64 z) const { if (z >= z_offset) return (I32)((z-z_offset)/z_scale_factor+0.5); else return (I32)((z-z_offset)/z_scale_factor-0.5); };
106 
108  {
109  x_scale_factor = 0.01;
110  y_scale_factor = 0.01;
111  z_scale_factor = 0.01;
112  x_offset = 0.0;
113  y_offset = 0.0;
114  z_offset = 0.0;
115  };
116 
117  LASquantizer & operator=(const LASquantizer & quantizer)
118  {
119  this->x_scale_factor = quantizer.x_scale_factor;
120  this->y_scale_factor = quantizer.y_scale_factor;
121  this->z_scale_factor = quantizer.z_scale_factor;
122  this->x_offset = quantizer.x_offset;
123  this->y_offset = quantizer.y_offset;
124  this->z_offset = quantizer.z_offset;
125  return *this;
126  };
127 };
128 
129 #define LAS_ATTRIBUTE_U8 0
130 #define LAS_ATTRIBUTE_I8 1
131 #define LAS_ATTRIBUTE_U16 2
132 #define LAS_ATTRIBUTE_I16 3
133 #define LAS_ATTRIBUTE_U32 4
134 #define LAS_ATTRIBUTE_I32 5
135 #define LAS_ATTRIBUTE_U64 6
136 #define LAS_ATTRIBUTE_I64 7
137 #define LAS_ATTRIBUTE_F32 8
138 #define LAS_ATTRIBUTE_F64 9
139 
141 {
142 public:
143  U8 reserved[2]; // 2 bytes
144  U8 data_type; // 1 byte
145  U8 options; // 1 byte
146  char name[32]; // 32 bytes
147  U8 unused[4]; // 4 bytes
148  U64I64F64 no_data[3]; // 24 = 3*8 bytes
149  U64I64F64 min[3]; // 24 = 3*8 bytes
150  U64I64F64 max[3]; // 24 = 3*8 bytes
151  F64 scale[3]; // 24 = 3*8 bytes
152  F64 offset[3]; // 24 = 3*8 bytes
153  char description[32]; // 32 bytes
154 
156  {
157  if (size == 0) throw;
158  memset(this, 0, sizeof(LASattribute));
159  scale[0] = scale[1] = scale[2] = 1.0;
160  this->options = size;
161  };
162 
163  LASattribute(U32 type, const char* name, const char* description=0, U32 dim=1)
164  {
165  if (type > LAS_ATTRIBUTE_F64) throw;
166  if (dim < 1 || dim > 3) throw;
167  if (name == 0) throw;
168  memset(this, 0, sizeof(LASattribute));
169  scale[0] = scale[1] = scale[2] = 1.0;
170  this->data_type = type*dim+1;
171  strncpy(this->name, name, 32);
172  if (description) strncpy(this->description, description, 32);
173  }
174 
175  inline BOOL set_no_data(U8 no_data, I32 dim=0) { if ((0 == get_type()) && (dim < get_dim())) { this->no_data[dim].u64 = no_data; options |= 0x01; return TRUE; } return FALSE; }
176  inline BOOL set_no_data(I8 no_data, I32 dim=0) { if ((1 == get_type()) && (dim < get_dim())) { this->no_data[dim].i64 = no_data; options |= 0x01; return TRUE; } return FALSE; }
177  inline BOOL set_no_data(U16 no_data, I32 dim=0) { if ((2 == get_type()) && (dim < get_dim())) { this->no_data[dim].u64 = no_data; options |= 0x01; return TRUE; } return FALSE; }
178  inline BOOL set_no_data(I16 no_data, I32 dim=0) { if ((3 == get_type()) && (dim < get_dim())) { this->no_data[dim].i64 = no_data; options |= 0x01; return TRUE; } return FALSE; }
179  inline BOOL set_no_data(U32 no_data, I32 dim=0) { if ((4 == get_type()) && (dim < get_dim())) { this->no_data[dim].u64 = no_data; options |= 0x01; return TRUE; } return FALSE; }
180  inline BOOL set_no_data(I32 no_data, I32 dim=0) { if ((5 == get_type()) && (dim < get_dim())) { this->no_data[dim].i64 = no_data; options |= 0x01; return TRUE; } return FALSE; }
181  inline BOOL set_no_data(U64 no_data, I32 dim=0) { if ((6 == get_type()) && (dim < get_dim())) { this->no_data[dim].u64 = no_data; options |= 0x01; return TRUE; } return FALSE; }
182  inline BOOL set_no_data(I64 no_data, I32 dim=0) { if ((7 == get_type()) && (dim < get_dim())) { this->no_data[dim].i64 = no_data; options |= 0x01; return TRUE; } return FALSE; }
183  inline BOOL set_no_data(F32 no_data, I32 dim=0) { if ((8 == get_type()) && (dim < get_dim())) { this->no_data[dim].f64 = no_data; options |= 0x01; return TRUE; } return FALSE; }
184  inline BOOL set_no_data(F64 no_data, I32 dim=0) { if ((9 == get_type()) && (dim < get_dim())) { this->no_data[dim].f64 = no_data; options |= 0x01; return TRUE; } return FALSE; }
185 
186  inline void set_min(U8* min, I32 dim=0) { this->min[dim] = cast(min); options |= 0x02; }
187  inline void update_min(U8* min, I32 dim=0) { this->min[dim] = smallest(cast(min), this->min[dim]); }
188  inline BOOL set_min(U8 min, I32 dim=0) { if ((0 == get_type()) && (dim < get_dim())) { this->min[dim].u64 = min; options |= 0x02; return TRUE; } return FALSE; }
189  inline BOOL set_min(I8 min, I32 dim=0) { if ((1 == get_type()) && (dim < get_dim())) { this->min[dim].i64 = min; options |= 0x02; return TRUE; } return FALSE; }
190  inline BOOL set_min(U16 min, I32 dim=0) { if ((2 == get_type()) && (dim < get_dim())) { this->min[dim].u64 = min; options |= 0x02; return TRUE; } return FALSE; }
191  inline BOOL set_min(I16 min, I32 dim=0) { if ((3 == get_type()) && (dim < get_dim())) { this->min[dim].i64 = min; options |= 0x02; return TRUE; } return FALSE; }
192  inline BOOL set_min(U32 min, I32 dim=0) { if ((4 == get_type()) && (dim < get_dim())) { this->min[dim].u64 = min; options |= 0x02; return TRUE; } return FALSE; }
193  inline BOOL set_min(I32 min, I32 dim=0) { if ((5 == get_type()) && (dim < get_dim())) { this->min[dim].i64 = min; options |= 0x02; return TRUE; } return FALSE; }
194  inline BOOL set_min(U64 min, I32 dim=0) { if ((6 == get_type()) && (dim < get_dim())) { this->min[dim].u64 = min; options |= 0x02; return TRUE; } return FALSE; }
195  inline BOOL set_min(I64 min, I32 dim=0) { if ((7 == get_type()) && (dim < get_dim())) { this->min[dim].i64 = min; options |= 0x02; return TRUE; } return FALSE; }
196  inline BOOL set_min(F32 min, I32 dim=0) { if ((8 == get_type()) && (dim < get_dim())) { this->min[dim].f64 = min; options |= 0x02; return TRUE; } return FALSE; }
197  inline BOOL set_min(F64 min, I32 dim=0) { if ((9 == get_type()) && (dim < get_dim())) { this->min[dim].f64 = min; options |= 0x02; return TRUE; } return FALSE; }
198 
199  inline void set_max(U8* max, I32 dim=0) { this->max[dim] = cast(max); options |= 0x04; }
200  inline void update_max(U8* max, I32 dim=0) { this->max[dim] = biggest(cast(max), this->max[dim]); }
201  inline BOOL set_max(U8 max, I32 dim=0) { if ((0 == get_type()) && (dim < get_dim())) { this->max[dim].u64 = max; options |= 0x04; return TRUE; } return FALSE; }
202  inline BOOL set_max(I8 max, I32 dim=0) { if ((1 == get_type()) && (dim < get_dim())) { this->max[dim].i64 = max; options |= 0x04; return TRUE; } return FALSE; }
203  inline BOOL set_max(U16 max, I32 dim=0) { if ((2 == get_type()) && (dim < get_dim())) { this->max[dim].u64 = max; options |= 0x04; return TRUE; } return FALSE; }
204  inline BOOL set_max(I16 max, I32 dim=0) { if ((3 == get_type()) && (dim < get_dim())) { this->max[dim].i64 = max; options |= 0x04; return TRUE; } return FALSE; }
205  inline BOOL set_max(U32 max, I32 dim=0) { if ((4 == get_type()) && (dim < get_dim())) { this->max[dim].u64 = max; options |= 0x04; return TRUE; } return FALSE; }
206  inline BOOL set_max(I32 max, I32 dim=0) { if ((5 == get_type()) && (dim < get_dim())) { this->max[dim].i64 = max; options |= 0x04; return TRUE; } return FALSE; }
207  inline BOOL set_max(U64 max, I32 dim=0) { if ((6 == get_type()) && (dim < get_dim())) { this->max[dim].u64 = max; options |= 0x04; return TRUE; } return FALSE; }
208  inline BOOL set_max(I64 max, I32 dim=0) { if ((7 == get_type()) && (dim < get_dim())) { this->max[dim].i64 = max; options |= 0x04; return TRUE; } return FALSE; }
209  inline BOOL set_max(F32 max, I32 dim=0) { if ((8 == get_type()) && (dim < get_dim())) { this->max[dim].f64 = max; options |= 0x04; return TRUE; } return FALSE; }
210  inline BOOL set_max(F64 max, I32 dim=0) { if ((9 == get_type()) && (dim < get_dim())) { this->max[dim].f64 = max; options |= 0x04; return TRUE; } return FALSE; }
211 
212  inline BOOL set_scale(F64 scale, I32 dim=0) { if (data_type) { this->scale[dim] = scale; options |= 0x08; return TRUE; } return FALSE; }
213  inline BOOL set_offset(F64 offset, I32 dim=0) { if (data_type) { this->offset[dim] = offset; options |= 0x10; return TRUE; } return FALSE; }
214 
215  inline BOOL has_no_data() const { return options & 0x01; }
216  inline BOOL has_min() const { return options & 0x02; }
217  inline BOOL has_max() const { return options & 0x04; }
218  inline BOOL has_scale() const { return options & 0x08; }
219  inline BOOL has_offset() const { return options & 0x10; }
220 
221  inline U32 get_size() const
222  {
223  if (data_type)
224  {
225  const U32 size_table[10] = { 1, 1, 2, 2, 4, 4, 8, 8, 4, 8 };
226  U32 type = get_type();
227  U32 dim = get_dim();
228  return size_table[type]*dim;
229  }
230  else
231  {
232  return options;
233  }
234  }
235 
236 private:
237  inline I32 get_type() const
238  {
239  return ((I32)data_type - 1)%10;
240  }
241  inline I32 get_dim() const
242  {
243  return 1 + ((I32)data_type - 1)/10;
244  }
245  inline U64I64F64 cast(U8* value) const
246  {
247  I32 type = get_type();
248  U64I64F64 casted_value;
249  if (type == 0)
250  casted_value.u64 = *((U8*)value);
251  else if (type == 1)
252  casted_value.i64 = *((I8*)value);
253  else if (type == 2)
254  casted_value.u64 = *((U16*)value);
255  else if (type == 3)
256  casted_value.i64 = *((I16*)value);
257  else if (type == 4)
258  casted_value.u64 = *((U32*)value);
259  else if (type == 5)
260  casted_value.i64 = *((I32*)value);
261  else if (type == 6)
262  casted_value.u64 = *((U64*)value);
263  else if (type == 7)
264  casted_value.i64 = *((I64*)value);
265  else if (type == 8)
266  casted_value.f64 = *((F32*)value);
267  else
268  casted_value.f64 = *((F64*)value);
269  return casted_value;
270  }
272  {
273  I32 type = get_type();
274  if (type >= 8) // float compare
275  {
276  if (a.f64 < b.f64) return a;
277  else return b;
278  }
279  if (type & 1) // int compare
280  {
281  if (a.i64 < b.i64) return a;
282  else return b;
283  }
284  if (a.u64 < b.u64) return a;
285  else return b;
286  }
288  {
289  I32 type = get_type();
290  if (type >= 8) // float compare
291  {
292  if (a.f64 > b.f64) return a;
293  else return b;
294  }
295  if (type & 1) // int compare
296  {
297  if (a.i64 > b.i64) return a;
298  else return b;
299  }
300  if (a.u64 > b.u64) return a;
301  else return b;
302  }
303 };
304 
306 {
307 public:
312 
314  {
315  number_extra_attributes = 0;
316  extra_attributes = 0;
317  extra_attribute_array_offsets = 0;
318  extra_attribute_sizes = 0;
319  }
320 
322  {
323  clean_extra_attributes();
324  }
325 
327  {
328  if (number_extra_attributes)
329  {
330  number_extra_attributes = 0;
331  free(extra_attributes); extra_attributes = 0;
332  free(extra_attribute_array_offsets); extra_attribute_array_offsets = 0;
333  free(extra_attribute_sizes); extra_attribute_sizes = 0;
334  }
335  }
336 
337  BOOL init_extra_attributes(U32 number_extra_attributes, LASattribute* extra_attributes)
338  {
339  U32 i;
340  clean_extra_attributes();
341  this->number_extra_attributes = number_extra_attributes;
342  this->extra_attributes = (LASattribute*)malloc(sizeof(LASattribute)*number_extra_attributes);
343  memcpy(this->extra_attributes, extra_attributes, sizeof(LASattribute)*number_extra_attributes);
344  extra_attribute_array_offsets = (I32*)malloc(sizeof(I32)*number_extra_attributes);
345  extra_attribute_sizes = (I32*)malloc(sizeof(I32)*number_extra_attributes);
346  extra_attribute_array_offsets[0] = 0;
347  extra_attribute_sizes[0] = extra_attributes[0].get_size();
348  for (i = 1; i < number_extra_attributes; i++)
349  {
350  extra_attribute_array_offsets[i] = extra_attribute_array_offsets[i-1] + extra_attribute_sizes[i-1];
351  extra_attribute_sizes[i] = extra_attributes[i].get_size();
352  }
353  return TRUE;
354  }
355 
356  I32 add_extra_attribute(const LASattribute extra_attribute)
357  {
358  if (extra_attribute.get_size())
359  {
360  if (extra_attributes)
361  {
362  number_extra_attributes++;
363  extra_attributes = (LASattribute*)realloc(extra_attributes, sizeof(LASattribute)*number_extra_attributes);
364  extra_attribute_array_offsets = (I32*)realloc(extra_attribute_array_offsets, sizeof(I32)*number_extra_attributes);
365  extra_attribute_sizes = (I32*)realloc(extra_attribute_sizes, sizeof(I32)*number_extra_attributes);
366  extra_attributes[number_extra_attributes-1] = extra_attribute;
367  extra_attribute_array_offsets[number_extra_attributes-1] = extra_attribute_array_offsets[number_extra_attributes-2] + extra_attribute_sizes[number_extra_attributes-2];
368  extra_attribute_sizes[number_extra_attributes-1] = extra_attributes[number_extra_attributes-1].get_size();
369  }
370  else
371  {
372  number_extra_attributes = 1;
373  extra_attributes = (LASattribute*)malloc(sizeof(LASattribute));
374  extra_attribute_array_offsets = (I32*)malloc(sizeof(I32));
375  extra_attribute_sizes = (I32*)malloc(sizeof(I32));
376  extra_attributes[0] = extra_attribute;
377  extra_attribute_array_offsets[0] = 0;
378  extra_attribute_sizes[0] = extra_attributes[0].get_size();
379  }
380  return number_extra_attributes-1;
381  }
382  return -1;
383  };
384 
386  {
387  return (extra_attributes ? extra_attribute_array_offsets[number_extra_attributes-1] + extra_attribute_sizes[number_extra_attributes-1] : 0);
388  }
389 
390  I32 get_extra_attribute_index(const char* name) const
391  {
392  I32 i;
393  for (i = 0; i < number_extra_attributes; i++)
394  {
395  if (strcmp(extra_attributes[i].name, name) == 0)
396  {
397  return i;
398  }
399  }
400  return -1;
401  }
402 
403  I32 get_extra_attribute_array_offset(const char* name) const
404  {
405  I32 i;
406  for (i = 0; i < number_extra_attributes; i++)
407  {
408  if (strcmp(extra_attributes[i].name, name) == 0)
409  {
410  return extra_attribute_array_offsets[i];
411  }
412  }
413  return -1;
414  }
415 
417  {
418  if (index < number_extra_attributes)
419  {
420  return extra_attribute_array_offsets[index];
421  }
422  return -1;
423  }
424 
426  {
427  if (index < 0 || index >= number_extra_attributes)
428  {
429  return FALSE;
430  }
431  for (index = index + 1; index < number_extra_attributes; index++)
432  {
433  extra_attributes[index-1] = extra_attributes[index];
434  if (index > 1)
435  {
436  extra_attribute_array_offsets[index-1] = extra_attribute_array_offsets[index-2] + extra_attribute_sizes[index-2];
437  }
438  else
439  {
440  extra_attribute_array_offsets[index-1] = 0;
441  }
442  extra_attribute_sizes[index-1] = extra_attribute_sizes[index];
443  }
444  number_extra_attributes--;
445  if (number_extra_attributes)
446  {
447  extra_attributes = (LASattribute*)realloc(extra_attributes, sizeof(LASattribute)*number_extra_attributes);
448  extra_attribute_array_offsets = (I32*)realloc(extra_attribute_array_offsets, sizeof(I32)*number_extra_attributes);
449  extra_attribute_sizes = (I32*)realloc(extra_attribute_sizes, sizeof(I32)*number_extra_attributes);
450  }
451  else
452  {
453  free(extra_attributes); extra_attributes = 0;
454  free(extra_attribute_array_offsets); extra_attribute_array_offsets = 0;
455  free(extra_attribute_sizes); extra_attribute_sizes = 0;
456  }
457 
458  return TRUE;
459  }
460 
461  BOOL remove_extra_attribute(const char* name)
462  {
463  I32 index = get_extra_attribute_index(name);
464  if (index != -1)
465  {
466  return remove_extra_attribute(index);
467  }
468  return FALSE;
469  }
470 };
471 
472 class LASpoint
473 {
474 public:
475 
476 // these fields contain the data that describe each point
477 
490 
491  // LAS 1.4 only
496 
498  U16 rgb[4];
501 
502 // for converting between x,y,z integers and scaled/translated coordinates
503 
505  F64 coordinates[3];
506 
507 // for attributed access to the extra bytes
508 
510 
511 // this field provides generic access to the point data
512 
514 
515 // these fields describe the point format LAS specific
516 
522 
523 // these fields describe the point format terms of generic items
524 
527 
528 // copy functions
529 
530  LASpoint(const LASpoint & other)
531  {
532  *this = other;
533  }
534 
535  LASpoint & operator=(const LASpoint & other)
536  {
537  x = other.x;
538  y = other.y;
539  z = other.z;
540  intensity = other.intensity;
541  return_number = other.return_number;
542  number_of_returns_of_given_pulse = other.number_of_returns_of_given_pulse;
543  scan_direction_flag = other.scan_direction_flag;
544  edge_of_flight_line = other.edge_of_flight_line;
545  classification = other.classification;
546  scan_angle_rank = other.scan_angle_rank;
547  user_data = other.user_data;
548  point_source_ID = other.point_source_ID;
549 
550  if (other.have_gps_time)
551  {
552  gps_time = other.gps_time;
553  }
554  if (other.have_rgb)
555  {
556  rgb[0] = other.rgb[0];
557  rgb[1] = other.rgb[1];
558  rgb[2] = other.rgb[2];
559  }
560  if (other.have_wavepacket)
561  {
562  wavepacket = other.wavepacket;
563  }
564  if (other.extra_bytes && extra_bytes)
565  {
566  memcpy(extra_bytes, other.extra_bytes, extra_bytes_number);
567  }
568  return *this;
569  };
570 
571  void copy_to(U8* buffer) const
572  {
573  U32 i;
574  U32 b = 0;
575  for (i = 0; i < num_items; i++)
576  {
577  memcpy(&buffer[b], point[i], items[i].size);
578  b += items[i].size;
579  }
580  };
581 
582  void copy_from(const U8* buffer)
583  {
584  U32 i;
585  U32 b = 0;
586  for (i = 0; i < num_items; i++)
587  {
588  memcpy(point[i], &buffer[b], items[i].size);
589  b += items[i].size;
590  }
591  };
592 
593 // these functions set the desired point format (and maybe add on extra attributes)
594 
595  BOOL init(const LASquantizer* quantizer, const U8 point_type, const U16 point_size, const LASattributer* attributer=0)
596  {
597  // clean the point
598 
599  clean();
600 
601  // switch over the point types we know
602 
603  if (!LASzip().setup(&num_items, &items, point_type, point_size))
604  {
605  fprintf(stderr,"ERROR: unknown point type %d with point size %d\n", (I32)point_type, (I32)point_size);
606  return FALSE;
607  }
608 
609  // create point's item pointers
610 
611  point = new U8*[num_items];
612 
613  U16 i;
614  for (i = 0; i < num_items; i++)
615  {
616  total_point_size += items[i].size;
617  switch (items[i].type)
618  {
619  case LASitem::POINT14:
620  have_gps_time = true;
621  case LASitem::POINT10:
622  this->point[i] = (U8*)&(this->x);
623  break;
624  case LASitem::GPSTIME11:
625  have_gps_time = true;
626  this->point[i] = (U8*)&(this->gps_time);
627  break;
628  case LASitem::RGB12:
629  case LASitem::RGBNIR14:
630  have_rgb = true;
631  this->point[i] = (U8*)(this->rgb);
632  break;
634  have_wavepacket = true;
635  this->point[i] = (U8*)&(this->wavepacket);
636  break;
637  case LASitem::BYTE:
638  extra_bytes_number = items[i].size;
639  extra_bytes = new U8[extra_bytes_number];
640  this->point[i] = extra_bytes;
641  break;
642  default:
643  return FALSE;
644  }
645  }
646  this->quantizer = quantizer;
647  this->attributer = attributer;
648  return TRUE;
649  };
650 
651  BOOL init(const LASquantizer* quantizer, const U32 num_items, const LASitem* items, const LASattributer* attributer=0)
652  {
653  U32 i,e;
654 
655  // clean the point
656 
657  clean();
658 
659  // create item description
660 
661  this->num_items = num_items;
662  if (this->items) delete [] this->items;
663  this->items = new LASitem[num_items];
664  if (this->point) delete [] this->point;
665  this->point = new U8*[num_items];
666 
667  for (i = 0, e = 0; i < num_items; i++)
668  {
669  this->items[i] = items[i];
670  total_point_size += items[i].size;
671 
672  switch (items[i].type)
673  {
674  case LASitem::POINT10:
675  this->point[i] = (U8*)&(this->x);
676  break;
677  case LASitem::GPSTIME11:
678  have_gps_time = true;
679  this->point[i] = (U8*)&(this->gps_time);
680  break;
681  case LASitem::RGB12:
682  have_rgb = true;
683  this->point[i] = (U8*)(this->rgb);
684  break;
686  have_wavepacket = true;
687  this->point[i] = (U8*)&(this->wavepacket);
688  break;
689  case LASitem::BYTE:
690  extra_bytes_number = items[i].size;
691  extra_bytes = new U8[extra_bytes_number];
692  this->point[i] = extra_bytes;
693  break;
694  default:
695  return FALSE;
696  }
697  }
698  this->quantizer = quantizer;
699  this->attributer = attributer;
700  return TRUE;
701  };
702 
703  BOOL inside_rectangle(const F64 r_min_x, const F64 r_min_y, const F64 r_max_x, const F64 r_max_y) const
704  {
705  F64 xy;
706  xy = get_x();
707  if (xy < r_min_x || xy > r_max_x) return FALSE;
708  xy = get_y();
709  if (xy < r_min_y || xy > r_max_y) return FALSE;
710  return TRUE;
711  }
712 
713  BOOL inside_tile(const F32 ll_x, const F32 ll_y, const F32 ur_x, const F32 ur_y) const
714  {
715  F64 xy;
716  xy = get_x();
717  if (xy < ll_x || xy >= ur_x) return FALSE;
718  xy = get_y();
719  if (xy < ll_y || xy >= ur_y) return FALSE;
720  return TRUE;
721  }
722 
723  BOOL inside_circle(const F64 center_x, const F64 center_y, F64 squared_radius) const
724  {
725  F64 dx = center_x - get_x();
726  F64 dy = center_y - get_y();
727  return ((dx*dx+dy*dy) < squared_radius);
728  }
729 
730  BOOL is_zero() const
731  {
732  if (((U32*)&(this->x))[0] || ((U32*)&(this->x))[1] || ((U32*)&(this->x))[2] || ((U32*)&(this->x))[3] || ((U32*)&(this->x))[4])
733  {
734  return FALSE;
735  }
736  if (have_gps_time)
737  {
738  if (this->gps_time)
739  {
740  return FALSE;
741  }
742  }
743  if (have_rgb)
744  {
745  if (this->rgb[0] || this->rgb[1] || this->rgb[2])
746  {
747  return FALSE;
748  }
749  }
750  return TRUE;
751  }
752 
753  void zero()
754  {
755  x=0;
756  y=0;
757  z=0;
758  intensity=0;
759  edge_of_flight_line=0;
760  scan_direction_flag=0;
761  number_of_returns_of_given_pulse = 1;
762  return_number = 1;
763  classification = 0;
764  scan_angle_rank = 0;
765  user_data = 0;
766  point_source_ID = 0;
767 
768  // LAS 1.4 only
769  extended_classification = 0;
770  extended_return_number = 1;
771  extended_number_of_returns_of_given_pulse = 1;
772  extended_scanner_channel = 0;
773 
774  gps_time = 0.0;
775  rgb[0] = rgb[1] = rgb[2] = 0;
776  wavepacket.zero();
777  };
778 
779  void clean()
780  {
781  zero();
782 
783  if (extra_bytes)
784  {
785  delete [] extra_bytes;
786  extra_bytes = 0;
787  };
788 
789  if (point) delete [] point;
790  point = 0;
791 
792  have_gps_time = FALSE;
793  have_rgb = FALSE;
794  have_wavepacket = FALSE;
795  extra_bytes_number = 0;
796  total_point_size = 0;
797 
798  num_items = 0;
799  if (items) delete [] items;
800  items = 0;
801  };
802 
804  {
805  extra_bytes = 0;
806  point = 0;
807  items = 0;
808  clean();
809  };
810 
811  inline F64 get_x() const { return quantizer->get_x(x); };
812  inline F64 get_y() const { return quantizer->get_y(y); };
813  inline F64 get_z() const { return quantizer->get_z(z); };
814 
815  inline void set_x(const F64 x) { this->x = quantizer->get_x(x); };
816  inline void set_y(const F64 y) { this->y = quantizer->get_y(y); };
817  inline void set_z(const F64 z) { this->z = quantizer->get_z(z); };
818 
819  inline void compute_coordinates()
820  {
821  coordinates[0] = get_x();
822  coordinates[1] = get_y();
823  coordinates[2] = get_z();
824  };
825 
826  inline void compute_xyz()
827  {
828  set_x(coordinates[0]);
829  set_y(coordinates[1]);
830  set_z(coordinates[2]);
831  };
832 
833  inline void compute_xyz(const LASquantizer* quantizer)
834  {
835  x = quantizer->get_x(coordinates[0]);
836  y = quantizer->get_y(coordinates[1]);
837  z = quantizer->get_z(coordinates[2]);
838  };
839 
840  // generic extra attribute functions
841 
842  inline void get_extra_attribute(I32 index, U8* data) const
843  {
844  memcpy(data, extra_bytes + attributer->extra_attribute_array_offsets[index], attributer->extra_attribute_sizes[index]);
845  }
846 
847  inline void set_extra_attribute(I32 index, const U8* data)
848  {
849  memcpy(extra_bytes + attributer->extra_attribute_array_offsets[index], data, attributer->extra_attribute_sizes[index]);
850  }
851 
852  // typed and offset attribute functions (more efficient)
853 
854  inline void get_extra_attribute(I32 offset, U8 &data) const { data = extra_bytes[offset]; }
855  inline void set_extra_attribute(I32 offset, U8 data) { extra_bytes[offset] = data; }
856  inline void get_extra_attribute(I32 offset, I8 &data) const { data = (I8)(extra_bytes[offset]); }
857  inline void set_extra_attribute(I32 offset, I8 data) { extra_bytes[offset] = data; }
858  inline void get_extra_attribute(I32 offset, U16 &data) const { data = *((U16*)(extra_bytes + offset)); }
859  inline void set_extra_attribute(I32 offset, U16 data) { *((U16*)(extra_bytes + offset)) = data; }
860  inline void get_extra_attribute(I32 offset, I16 &data) const { data = *((I16*)(extra_bytes + offset)); }
861  inline void set_extra_attribute(I32 offset, I16 data) { *((I16*)(extra_bytes + offset)) = data; }
862  inline void get_extra_attribute(I32 offset, U32 &data) const { data = *((U32*)(extra_bytes + offset)); }
863  inline void set_extra_attribute(I32 offset, U32 data) { *((U32*)(extra_bytes + offset)) = data; }
864  inline void get_extra_attribute(I32 offset, I32 &data) const { data = *((I32*)(extra_bytes + offset)); }
865  inline void set_extra_attribute(I32 offset, I32 data) { *((I32*)(extra_bytes + offset)) = data; }
866  inline void get_extra_attribute(I32 offset, U64 &data) const { data = *((U64*)(extra_bytes + offset)); }
867  inline void set_extra_attribute(I32 offset, U64 data) { *((U64*)(extra_bytes + offset)) = data; }
868  inline void get_extra_attribute(I32 offset, I64 &data) const { data = *((I64*)(extra_bytes + offset)); }
869  inline void set_extra_attribute(I32 offset, I64 data) { *((I64*)(extra_bytes + offset)) = data; }
870  inline void get_extra_attribute(I32 offset, F32 &data) const { data = *((F32*)(extra_bytes + offset)); }
871  inline void set_extra_attribute(I32 offset, F32 data) { *((F32*)(extra_bytes + offset)) = data; }
872  inline void get_extra_attribute(I32 offset, F64 &data) const { data = *((F64*)(extra_bytes + offset)); }
873  inline void set_extra_attribute(I32 offset, F64 data) { *((F64*)(extra_bytes + offset)) = data; }
874 
876  {
877  clean();
878  };
879 };
880 
881 class LASvlr
882 {
883 public:
885  I8 user_id[16];
888  I8 description[32];
890 };
891 
893 {
894 public:
899 };
900 
902 {
903 public:
908 };
909 
911 {
912 public:
914  I8 description[15];
915 };
916 
918 {
919 public:
921  void clean() {memset(data, 0, 26);};
922  inline U8 getBitsPerSample() const {return data[0];};
923  inline U8 getCompressionType() const {return data[1];};
924  inline U32 getNumberOfSamples() const {return ((U32*)&(data[2]))[0];};
925  inline U32 getTemporalSpacing() const {return ((U32*)&(data[6]))[0];};
926  inline F64 getDigitizerGain() const {return ((F64*)&(data[10]))[0];};
927  inline F64 getDigitizerOffset() const {return ((F64*)&(data[18]))[0];};
928  inline void setBitsPerSample(U8 bps) {data[0] = bps;};
929  inline void setCompressionType(U8 compression) {data[1] = compression;};
930  inline void setNumberOfSamples(U32 samples) {((U32*)&(data[2]))[0] = samples;};
931  inline void setTemporalSpacing(U32 spacing) {((U32*)&(data[6]))[0] = spacing;};
932  inline void setDigitizerGain(F64 gain) {((F64*)&(data[10]))[0] = gain;};
933  inline void setDigitizerOffset(F64 offset) {((F64*)&(data[18]))[0] = offset;};
934 private:
935  U8 data[26];
936 };
937 
939 {
940 public:
950 };
951 
952 class LASheader : public LASquantizer, public LASattributer
953 {
954 public:
955  I8 file_signature[4];
961  U8 project_ID_GUID_data_4[8];
964  I8 system_identifier[32];
965  I8 generating_software[32];
974  U32 number_of_points_by_return[5];
981 
982  // LAS 1.3 only
984 
985  // LAS 1.4 only
989  U64 extended_number_of_points_by_return[15];
990 
993 
1001 
1004 
1007 
1009  {
1010  clean_las_header();
1011  };
1012 
1013  // clean functions
1014 
1016  {
1017  memset((void*)this, 0, sizeof(LASheader));
1018  file_signature[0] = 'L'; file_signature[1] = 'A'; file_signature[2] = 'S'; file_signature[3] = 'F';
1019  version_major = 1;
1020  version_minor = 2;
1021  header_size = 227;
1022  offset_to_point_data = 227;
1023  point_data_record_length = 20;
1024  x_scale_factor = 0.01;
1025  y_scale_factor = 0.01;
1026  z_scale_factor = 0.01;
1027  };
1028 
1030  {
1031  if (user_data_in_header)
1032  {
1033  header_size -= user_data_in_header_size;
1034  delete [] user_data_in_header;
1035  user_data_in_header = 0;
1036  user_data_in_header_size = 0;
1037  }
1038  };
1039 
1040  void clean_vlrs()
1041  {
1042  if (vlrs)
1043  {
1044  U32 i;
1045  for (i = 0; i < number_of_variable_length_records; i++)
1046  {
1047  offset_to_point_data -= (54 + vlrs[i].record_length_after_header);
1048  if (vlrs[i].data && (vlrs[i].data != (char*)extra_attributes))
1049  {
1050  delete [] vlrs[i].data;
1051  }
1052  }
1053  free(vlrs);
1054  vlrs = 0;
1055  vlr_geo_keys = 0;
1056  vlr_geo_key_entries = 0;
1057  vlr_geo_double_params = 0;
1058  vlr_geo_ascii_params = 0;
1059  vlr_classification = 0;
1060  if (vlr_wave_packet_descr) delete [] vlr_wave_packet_descr;
1061  vlr_wave_packet_descr = 0;
1062  number_of_variable_length_records = 0;
1063  }
1064  };
1065 
1067  {
1068  if (laszip)
1069  {
1070  delete laszip;
1071  }
1072  laszip = 0;
1073  };
1074 
1076  {
1077  if (vlr_lastiling)
1078  {
1079  delete vlr_lastiling;
1080  }
1081  vlr_lastiling = 0;
1082  };
1083 
1085  {
1086  if (user_data_after_header)
1087  {
1088  offset_to_point_data -= user_data_after_header_size;
1089  delete [] user_data_after_header;
1090  user_data_after_header = 0;
1091  user_data_after_header_size = 0;
1092  }
1093  };
1094 
1095  void clean()
1096  {
1097  clean_user_data_in_header();
1098  clean_vlrs();
1099  clean_laszip();
1100  clean_lastiling();
1101  clean_user_data_after_header();
1102  clean_extra_attributes();
1103  clean_las_header();
1104  };
1105 
1106  LASheader & operator=(const LASquantizer & quantizer)
1107  {
1108  this->x_scale_factor = quantizer.x_scale_factor;
1109  this->y_scale_factor = quantizer.y_scale_factor;
1110  this->z_scale_factor = quantizer.z_scale_factor;
1111  this->x_offset = quantizer.x_offset;
1112  this->y_offset = quantizer.y_offset;
1113  this->z_offset = quantizer.z_offset;
1114  return *this;
1115  };
1116 
1117  BOOL check() const
1118  {
1119  if (strncmp(file_signature, "LASF", 4) != 0)
1120  {
1121  fprintf(stderr,"ERROR: wrong file signature '%s'\n", file_signature);
1122  return FALSE;
1123  }
1124  if ((version_major != 1) || (version_minor > 4))
1125  {
1126  fprintf(stderr,"WARNING: unknown version %d.%d (should be 1.0 or 1.1 or 1.2 or 1.3 or 1.4)\n", version_major, version_minor);
1127  }
1128  if (header_size < 227)
1129  {
1130  fprintf(stderr,"ERROR: header size is %d but should be at least 227\n", header_size);
1131  return FALSE;
1132  }
1133  if (offset_to_point_data < header_size)
1134  {
1135  fprintf(stderr,"ERROR: offset to point data %d is smaller than header size %d\n", offset_to_point_data, header_size);
1136  return FALSE;
1137  }
1138  if (x_scale_factor == 0)
1139  {
1140  fprintf(stderr,"WARNING: x scale factor is zero.\n");
1141  }
1142  if (y_scale_factor == 0)
1143  {
1144  fprintf(stderr,"WARNING: y scale factor is zero.\n");
1145  }
1146  if (z_scale_factor == 0)
1147  {
1148  fprintf(stderr,"WARNING: z scale factor is zero.\n");
1149  }
1150  if (max_x < min_x || max_y < min_y || max_z < min_z)
1151  {
1152  fprintf(stderr,"WARNING: invalid bounding box [ %g %g %g / %g %g %g ]\n", min_x, min_y, min_z, max_x, max_y, max_z);
1153  }
1154  return TRUE;
1155  };
1156 
1157  void add_vlr(const char* user_id, U16 record_id, U16 record_length_after_header, char* data)
1158  {
1159  U32 i = 0;
1160  if (vlrs)
1161  {
1162  for (i = 0; i < number_of_variable_length_records; i++)
1163  {
1164  if ((strcmp(vlrs[i].user_id, user_id) == 0) && (vlrs[i].record_id == record_id))
1165  {
1166  if (vlrs[i].record_length_after_header)
1167  {
1168  offset_to_point_data -= vlrs[i].record_length_after_header;
1169  delete [] vlrs[i].data;
1170  }
1171  break;
1172  }
1173  }
1174  if (i == number_of_variable_length_records)
1175  {
1176  number_of_variable_length_records++;
1177  offset_to_point_data += 54;
1178  vlrs = (LASvlr*)realloc(vlrs, sizeof(LASvlr)*number_of_variable_length_records);
1179  }
1180  }
1181  else
1182  {
1183  number_of_variable_length_records = 1;
1184  offset_to_point_data += 54;
1185  vlrs = (LASvlr*)malloc(sizeof(LASvlr)*number_of_variable_length_records);
1186  }
1187  vlrs[i].reserved = 0xAABB;
1188  strncpy(vlrs[i].user_id, user_id, 16);
1189  vlrs[i].record_id = record_id;
1190  vlrs[i].record_length_after_header = record_length_after_header;
1191  sprintf(vlrs[i].description, "by LAStools of Martin Isenburg");
1192  if (record_length_after_header)
1193  {
1194  offset_to_point_data += record_length_after_header;
1195  vlrs[i].data = data;
1196  }
1197  else
1198  {
1199  vlrs[i].data = 0;
1200  }
1201  };
1202 
1204  {
1205  if (vlrs)
1206  {
1207  if (i < number_of_variable_length_records)
1208  {
1209  offset_to_point_data -= (54 + vlrs[i].record_length_after_header);
1210  if (vlrs[i].record_length_after_header)
1211  {
1212  delete [] vlrs[i].data;
1213  }
1214  number_of_variable_length_records--;
1215  if (number_of_variable_length_records)
1216  {
1217  vlrs[i] = vlrs[number_of_variable_length_records];
1218  vlrs = (LASvlr*)realloc(vlrs, sizeof(LASvlr)*number_of_variable_length_records);
1219  }
1220  else
1221  {
1222  free(vlrs);
1223  vlrs = 0;
1224  }
1225  }
1226  return TRUE;
1227  }
1228  return FALSE;
1229  };
1230 
1231  BOOL remove_vlr(const char* user_id, U16 record_id)
1232  {
1233  U32 i;
1234  for (i = 0; i < number_of_variable_length_records; i++)
1235  {
1236  if ((strcmp(vlrs[i].user_id, user_id) == 0) && (vlrs[i].record_id == record_id))
1237  {
1238  return remove_vlr(i);
1239  }
1240  }
1241  return FALSE;
1242  };
1243 
1244  void set_lastiling(U32 level, U32 level_index, U32 implicit_levels, BOOL overlap, BOOL reversible, F32 min_x, F32 max_x, F32 min_y, F32 max_y)
1245  {
1246  clean_lastiling();
1247  vlr_lastiling = new LASvlr_lastiling();
1248  vlr_lastiling->level = level;
1249  vlr_lastiling->level_index = level_index;
1250  vlr_lastiling->implicit_levels = implicit_levels;
1251  vlr_lastiling->overlap = overlap;
1252  vlr_lastiling->reversible = reversible;
1253  vlr_lastiling->min_x = min_x;
1254  vlr_lastiling->max_x = max_x;
1255  vlr_lastiling->min_y = min_y;
1256  vlr_lastiling->max_y = max_y;
1257  };
1258 
1259  void set_geo_keys(const I32 number_of_keys, const LASvlr_key_entry* geo_keys)
1260  {
1261  vlr_geo_keys = new LASvlr_geo_keys[number_of_keys+1];
1262  vlr_geo_keys->key_directory_version = 1;
1263  vlr_geo_keys->key_revision = 1;
1264  vlr_geo_keys->minor_revision = 0;
1265  vlr_geo_keys->number_of_keys = number_of_keys;
1266  vlr_geo_key_entries = (LASvlr_key_entry*)&vlr_geo_keys[1];
1267  memcpy(vlr_geo_key_entries, geo_keys, sizeof(LASvlr_key_entry)*number_of_keys);
1268  add_vlr("LASF_Projection", 34735, sizeof(LASvlr_geo_keys)*(number_of_keys+1), (char*)vlr_geo_keys);
1269  }
1270 
1271  void set_geo_double_params(const I32 num_geo_double_params, const F64* geo_double_params)
1272  {
1273  vlr_geo_double_params = new F64[num_geo_double_params];
1274  memcpy(vlr_geo_double_params, geo_double_params, sizeof(F64)*num_geo_double_params);
1275  add_vlr("LASF_Projection", 34736, sizeof(F64)*num_geo_double_params, (char*)vlr_geo_double_params);
1276  }
1277 
1279  {
1280  if (vlr_geo_double_params)
1281  {
1282  remove_vlr("LASF_Projection", 34736);
1283  vlr_geo_double_params = 0;
1284  }
1285  }
1286 
1288  {
1289  if (vlr_geo_ascii_params)
1290  {
1291  remove_vlr("LASF_Projection", 34737);
1292  vlr_geo_ascii_params = 0;
1293  }
1294  }
1295 
1297  {
1298  if (number_extra_attributes)
1299  {
1300  U16 record_length_after_header = sizeof(LASattribute)*number_extra_attributes;
1301  char* data = new char[record_length_after_header];
1302  memcpy(data, extra_attributes, record_length_after_header);
1303  add_vlr("LASF_Spec", 4, record_length_after_header, data);
1304  }
1305  else
1306  {
1307  remove_vlr("LASF_Spec", 4);
1308  }
1309  }
1310 
1312  {
1313  clean();
1314  };
1315 };
1316 
1317 #endif
LASpoint(const LASpoint &other)
LASattribute(U32 type, const char *name, const char *description=0, U32 dim=1)
BOOL set_max(F32 max, I32 dim=0)
F64 f64
Definition: mydefs.hpp:61
U8 edge_of_flight_line
void get_extra_attribute(I32 offset, F32 &data) const
int BOOL
Definition: mydefs.hpp:57
BOOL set_max(I64 max, I32 dim=0)
void del_geo_ascii_params()
BOOL set_max(F64 max, I32 dim=0)
void set_extra_attribute(I32 offset, F64 data)
U64 start_of_first_extended_variable_length_record
BOOL set_min(I32 min, I32 dim=0)
BOOL check() const
#define FALSE
Definition: mydefs.hpp:133
U32 number_of_point_records
I64 i64
Definition: mydefs.hpp:61
BOOL set_min(F32 min, I32 dim=0)
void set_extra_attribute(I32 offset, F32 data)
void setOffset(U64 offset)
void get_extra_attribute(I32 offset, I32 &data) const
const kaboom::Options * options
F64 * vlr_geo_double_params
float F32
Definition: mydefs.hpp:51
void setXt(F32 xt)
void clean_las_header()
void copy_to(U8 *buffer) const
U16 point_data_record_length
BOOL set_no_data(I32 no_data, I32 dim=0)
U32 project_ID_GUID_data_1
void setZt(F32 zt)
BOOL set_no_data(F32 no_data, I32 dim=0)
void get_extra_attribute(I32 offset, U16 &data) const
BOOL init(const LASquantizer *quantizer, const U32 num_items, const LASitem *items, const LASattributer *attributer=0)
U16 record_length_after_header
U32 total_point_size
U32 getSize() const
void update_extra_bytes_vlr()
I32 extra_bytes_number
BOOL set_min(I8 min, I32 dim=0)
I32 get_type() const
LASheader & operator=(const LASquantizer &quantizer)
U32 number_of_extended_variable_length_records
BOOL has_offset() const
void clean_extra_attributes()
short I16
Definition: mydefs.hpp:36
unsigned int U32
Definition: mydefs.hpp:39
void get_extra_attribute(I32 offset, I8 &data) const
void set_geo_double_params(const I32 num_geo_double_params, const F64 *geo_double_params)
void setYt(F32 yt)
LASpoint & operator=(const LASpoint &other)
void setDigitizerGain(F64 gain)
U64 start_of_waveform_data_packet_record
U8 scan_direction_flag
U64 extended_number_of_point_records
U16 key_id
F64 get_y() const
BOOL set_max(I8 max, I32 dim=0)
BOOL set_no_data(I64 no_data, I32 dim=0)
BOOL inside_rectangle(const F64 r_min_x, const F64 r_min_y, const F64 r_max_x, const F64 r_max_y) const
I16 get_total_extra_attributes_size() const
BOOL set_max(U64 max, I32 dim=0)
void set_min(U8 *min, I32 dim=0)
F32 getXt() const
BOOL have_gps_time
BOOL set_min(U16 min, I32 dim=0)
void del_geo_double_params()
LASvlr * vlrs
BOOL set_no_data(F64 no_data, I32 dim=0)
const LASattributer * attributer
void clean_user_data_after_header()
void setDigitizerOffset(F64 offset)
unsigned short U16
Definition: mydefs.hpp:40
BOOL init(const LASquantizer *quantizer, const U8 point_type, const U16 point_size, const LASattributer *attributer=0)
void setIndex(U8 index)
LASvlr_key_entry * vlr_geo_key_entries
LASquantizer & operator=(const LASquantizer &quantizer)
void clean_user_data_in_header()
U32 number_of_variable_length_records
U64I64F64 cast(U8 *value) const
long long I64
Definition: mydefs.hpp:48
void update_min(U8 *min, I32 dim=0)
F32 getYt() const
void set_x(const F64 x)
void get_extra_attribute(I32 offset, U8 &data) const
BOOL set_max(U8 max, I32 dim=0)
LASwavepacket wavepacket
unsigned char U8
Definition: mydefs.hpp:41
U8 extended_return_number
F32 getLocation() const
F64 get_x() const
U16 project_ID_GUID_data_2
U8 getIndex() const
BOOL set_min(U32 min, I32 dim=0)
BOOL inside_circle(const F64 center_x, const F64 center_y, F64 squared_radius) const
void set_extra_attribute(I32 index, const U8 *data)
void setLocation(F32 location)
F32 getZt() const
void copy_from(const U8 *buffer)
LASvlr_geo_keys * vlr_geo_keys
LASvlr_wave_packet_descr ** vlr_wave_packet_descr
void setNumberOfSamples(U32 samples)
BOOL set_no_data(U64 no_data, I32 dim=0)
void set_extra_attribute(I32 offset, I16 data)
LASvlr_classification * vlr_classification
U64 getOffset() const
BOOL set_max(U16 max, I32 dim=0)
BOOL set_max(I32 max, I32 dim=0)
void add_vlr(const char *user_id, U16 record_id, U16 record_length_after_header, char *data)
BOOL is_zero() const
void compute_xyz()
LASzip * laszip
I8 * user_data_after_header
char I8
Definition: mydefs.hpp:37
BOOL remove_vlr(const char *user_id, U16 record_id)
I32 get_x(const F64 x) const
U16 file_creation_year
unsigned short size
Definition: laszip.hpp:74
U64I64F64 biggest(U64I64F64 a, U64I64F64 b) const
BOOL set_min(F64 min, I32 dim=0)
void compute_xyz(const LASquantizer *quantizer)
I8 * vlr_geo_ascii_params
F64 get_y(const I32 y) const
void update_max(U8 *max, I32 dim=0)
void setCompressionType(U8 compression)
U8 extended_number_of_returns_of_given_pulse
U16 count
BOOL remove_vlr(U32 i)
int I32
Definition: mydefs.hpp:35
void compute_coordinates()
BOOL has_min() const
LASattribute(U8 size)
BOOL set_min(U64 min, I32 dim=0)
BOOL set_scale(F64 scale, I32 dim=0)
I32 * extra_attribute_sizes
void get_extra_attribute(I32 offset, I16 &data) const
BOOL set_min(I16 min, I32 dim=0)
void set_y(const F64 y)
void set_max(U8 *max, I32 dim=0)
BOOL inside_tile(const F32 ll_x, const F32 ll_y, const F32 ur_x, const F32 ur_y) const
void set_z(const F64 z)
void set_extra_attribute(I32 offset, U64 data)
I32 get_dim() const
BOOL set_no_data(I16 no_data, I32 dim=0)
F64 get_z(const I32 z) const
BOOL has_max() const
U32 user_data_in_header_size
BOOL set_max(I16 max, I32 dim=0)
void set_extra_attribute(I32 offset, I8 data)
F64 get_z() const
BOOL has_scale() const
I32 get_y(const F64 y) const
void setSize(U32 size)
BOOL set_min(I64 min, I32 dim=0)
U8 extended_classification
I32 add_extra_attribute(const LASattribute extra_attribute)
void set_extra_attribute(I32 offset, U32 data)
I32 get_extra_attribute_index(const char *name) const
void clean_laszip()
U16 tiff_tag_location
BOOL remove_extra_attribute(const char *name)
BOOL set_no_data(I8 no_data, I32 dim=0)
BOOL set_no_data(U32 no_data, I32 dim=0)
U32 offset_to_point_data
#define TRUE
Definition: mydefs.hpp:137
U64 u64
Definition: mydefs.hpp:61
unsigned long long U64
Definition: mydefs.hpp:47
BOOL set_max(U32 max, I32 dim=0)
I8 * user_data_in_header
LASitem * items
U16 project_ID_GUID_data_3
BOOL init_extra_attributes(U32 number_extra_attributes, LASattribute *extra_attributes)
void set_extra_attribute(I32 offset, U8 data)
void set_geo_keys(const I32 number_of_keys, const LASvlr_key_entry *geo_keys)
BOOL set_no_data(U16 no_data, I32 dim=0)
LASvlr_lastiling * vlr_lastiling
I32 get_extra_attribute_array_offset(const char *name) const
U32 get_size() const
U16 value_offset
void get_extra_attribute(I32 offset, I64 &data) const
BOOL set_min(U8 min, I32 dim=0)
F64 get_x(const I32 x) const
BOOL have_wavepacket
U64I64F64 smallest(U64I64F64 a, U64I64F64 b) const
BOOL has_no_data() const
void get_extra_attribute(I32 offset, U32 &data) const
const LASquantizer * quantizer
U32 user_data_after_header_size
I32 get_z(const F64 z) const
void set_lastiling(U32 level, U32 level_index, U32 implicit_levels, BOOL overlap, BOOL reversible, F32 min_x, F32 max_x, F32 min_y, F32 max_y)
void get_extra_attribute(I32 index, U8 *data) const
I32 get_extra_attribute_array_offset(I32 index) const
void set_extra_attribute(I32 offset, U16 data)
void setTemporalSpacing(U32 spacing)
void set_extra_attribute(I32 offset, I32 data)
BOOL set_offset(F64 offset, I32 dim=0)
void set_extra_attribute(I32 offset, I64 data)
LASattribute * extra_attributes
void get_extra_attribute(I32 offset, U64 &data) const
#define LAS_ATTRIBUTE_F64
I32 * extra_attribute_array_offsets
double F64
Definition: mydefs.hpp:52
BOOL remove_extra_attribute(I32 index)
void get_extra_attribute(I32 offset, F64 &data) const
U8 number_of_returns_of_given_pulse
BOOL set_no_data(U8 no_data, I32 dim=0)
U8 extended_scanner_channel
void clean_lastiling()


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 Mon Feb 28 2022 22:46:06