83 if (num < 34)
return return_error(
"too few bytes to unpack");
84 if (((num - 34) % 6) != 0)
return return_error(
"wrong number bytes to unpack");
85 if (((num - 34) / 6) == 0)
return return_error(
"zero items to unpack");
124 assert((
bytes + num) == b);
139 if (!
check())
return false;
143 if (this->bytes)
delete [] this->
bytes;
144 this->bytes =
bytes =
new U8[num];
178 assert((
bytes + num) == b);
208 sprintf(
error,
"coder %d not supported",
coder);
305 if (this->items)
delete [] this->
items;
314 this->items[i] =
items[i];
327 I32 extra_bytes_number = 0;
333 extra_bytes_number = (
I32)point_size - 20;
336 have_gps_time =
TRUE;
337 extra_bytes_number = (
I32)point_size - 28;
341 extra_bytes_number = (
I32)point_size - 26;
344 have_gps_time =
TRUE;
346 extra_bytes_number = (
I32)point_size - 34;
349 have_gps_time =
TRUE;
350 have_wavepacket =
TRUE;
351 extra_bytes_number = (
I32)point_size - 57;
354 have_gps_time =
TRUE;
356 have_wavepacket =
TRUE;
357 extra_bytes_number = (
I32)point_size - 63;
361 extra_bytes_number = (
I32)point_size - 30;
366 extra_bytes_number = (
I32)point_size - 36;
372 extra_bytes_number = (
I32)point_size - 38;
376 have_wavepacket =
TRUE;
377 extra_bytes_number = (
I32)point_size - 59;
383 have_wavepacket =
TRUE;
384 extra_bytes_number = (
I32)point_size - 67;
390 sprintf(
error,
"point type %d unknown", point_type);
395 if (extra_bytes_number < 0)
398 sprintf(
error,
"point size %d too small for point type %d by %d bytes", point_size, point_type, -extra_bytes_number);
404 (*num_items) = 1 + !!(have_gps_time) + !!(have_rgb) + !!(have_wavepacket) + !!(extra_bytes_number);
411 (*items)[0].size = 30;
412 (*items)[0].version = 0;
417 (*items)[0].size = 20;
418 (*items)[0].version = 0;
423 (*items)[i].size = 8;
424 (*items)[i].version = 0;
432 (*items)[i].size = 8;
433 (*items)[i].version = 0;
438 (*items)[i].size = 6;
439 (*items)[i].version = 0;
446 (*items)[i].size = 29;
447 (*items)[i].version = 0;
450 if (extra_bytes_number)
453 (*items)[i].size = extra_bytes_number;
454 (*items)[i].version = 0;
478 if (requested_version > 0)
return return_error(
"without compression version is always 0");
482 if (requested_version < 1)
return return_error(
"with compression version is at least 1");
483 if (requested_version > 2)
return return_error(
"version larger than 2 not supported");
488 switch (
items[i].type)
516 if (point_type) *point_type = 127;
537 if (point_type) *point_type = 0;
538 if (record_length) assert(*record_length == 20);
547 if (point_type) *point_type = 1;
548 if (record_length) assert(*record_length == 28);
557 if (point_type) *point_type = 3;
558 if (record_length) assert(*record_length == 34);
567 if (point_type) *point_type = 5;
568 if (record_length) assert(*record_length == 63);
577 if (point_type) *point_type = 5;
578 if (record_length) assert(*record_length == (63 +
items[4].size));
588 if (point_type) *point_type = 3;
589 if (record_length) assert(*record_length == (34 +
items[3].size));
599 if (point_type) *point_type = 4;
600 if (record_length) assert(*record_length == 57);
609 if (point_type) *point_type = 4;
610 if (record_length) assert(*record_length == (57 +
items[3].size));
620 if (point_type) *point_type = 1;
621 if (record_length) assert(*record_length == (28 +
items[2].size));
631 if (point_type) *point_type = 2;
632 if (record_length) assert(*record_length == 26);
641 if (point_type) *point_type = 2;
642 if (record_length) assert(*record_length == (26 +
items[2].size));
652 if (point_type) *point_type = 0;
653 if (record_length) assert(*record_length == (20 +
items[1].size));
664 if (point_type) *point_type = 6;
665 if (record_length) assert(*record_length == 30);
674 if (point_type) *point_type = 7;
675 if (record_length) assert(*record_length == 36);
684 if (point_type) *point_type = 7;
685 if (record_length) assert(*record_length == (36 +
items[2].size));
695 if (point_type) *point_type = 8;
696 if (record_length) assert(*record_length == 38);
705 if (point_type) *point_type = 10;
706 if (record_length) assert(*record_length == 67);
715 if (point_type) *point_type = 10;
716 if (record_length) assert(*record_length == (67 +
items[3].size));
726 if (point_type) *point_type = 8;
727 if (record_length) assert(*record_length == (38 +
items[2].size));
737 if (point_type) *point_type = 9;
738 if (record_length) assert(*record_length == 59);
747 if (point_type) *point_type = 9;
748 if (record_length) assert(*record_length == (59 +
items[2].size));
758 if (point_type) *point_type = 6;
759 if (record_length) assert(*record_length == (30 +
items[1].size));
767 return_error(
"first LASitem is neither POINT10 nor POINT14");
769 return return_error(
"LASitem array does not match LAS specification 1.4");
774 if (t !=
type)
return false;
778 if (
size != 20)
return false;
781 if (
size != 8)
return false;
784 if (
size != 6)
return false;
787 if (
size != 29)
return false;
790 if (
size < 1)
return false;
812 return "WAVEPACKET13";