| 670 | } |
| 671 | |
| 672 | BOOL LASquadtree::write(ByteStreamOut* stream) const |
| 673 | { |
| 674 | // which totals 28 bytes |
| 675 | // U32 levels 4 bytes |
| 676 | // U32 level_index 4 bytes (default 0) |
| 677 | // U32 implicit_levels 4 bytes (only used when level_index != 0)) |
| 678 | // F32 min_x 4 bytes |
| 679 | // F32 max_x 4 bytes |
| 680 | // F32 min_y 4 bytes |
| 681 | // F32 max_y 4 bytes |
| 682 | // which totals 28 bytes |
| 683 | |
| 684 | if (!stream->putBytes((const U8*)"LASS", 4)) |
| 685 | { |
| 686 | laserror("(LASquadtree): writing LASspatial signature"); |
| 687 | return FALSE; |
| 688 | } |
| 689 | |
| 690 | U32 type = LAS_SPATIAL_QUAD_TREE; |
| 691 | if (!stream->put32bitsLE((U8*)&type)) |
| 692 | { |
| 693 | laserror("(LASquadtree): writing LASspatial type %u", type); |
| 694 | return FALSE; |
| 695 | } |
| 696 | |
| 697 | if (!stream->putBytes((const U8*)"LASQ", 4)) |
| 698 | { |
| 699 | laserror("(LASquadtree): writing signature"); |
| 700 | return FALSE; |
| 701 | } |
| 702 | |
| 703 | U32 version = 0; |
| 704 | if (!stream->put32bitsLE((const U8*)&version)) |
| 705 | { |
| 706 | laserror("(LASquadtree): writing version"); |
| 707 | return FALSE; |
| 708 | } |
| 709 | |
| 710 | if (!stream->put32bitsLE((const U8*)&levels)) |
| 711 | { |
| 712 | laserror("(LASquadtree): writing levels %u", levels); |
| 713 | return FALSE; |
| 714 | } |
| 715 | U32 level_index = 0; |
| 716 | if (!stream->put32bitsLE((const U8*)&level_index)) |
| 717 | { |
| 718 | laserror("(LASquadtree): writing level_index %u", level_index); |
| 719 | return FALSE; |
| 720 | } |
| 721 | U32 implicit_levels = 0; |
| 722 | if (!stream->put32bitsLE((const U8*)&implicit_levels)) |
| 723 | { |
| 724 | laserror("(LASquadtree): writing implicit_levels %u", implicit_levels); |
| 725 | return FALSE; |
| 726 | } |
| 727 | if (!stream->put32bitsLE((const U8*)&min_x)) |
| 728 | { |
| 729 | laserror("(LASquadtree): writing min_x %g", min_x); |
nothing calls this directly
no test coverage detected