| 718 | //--------------------------------------------------------------------------- |
| 719 | |
| 720 | static void run_test(const char* filename, PointData& data, unsigned short compressor, int requested_version=-1, int chunk_size=-1, bool random_seeks=false) |
| 721 | { |
| 722 | // |
| 723 | // COMPRESSION |
| 724 | // |
| 725 | |
| 726 | // setting up LASzip parameters |
| 727 | LASzip laszip; |
| 728 | if (!laszip.setup(data.point_type, data.point_size, compressor)) |
| 729 | { |
| 730 | log("ERROR on laszip.setup(): %s\n", laszip.get_error()); |
| 731 | } |
| 732 | if (requested_version > -1) laszip.request_version((unsigned short)requested_version); |
| 733 | if (chunk_size > -1) laszip.set_chunk_size((unsigned int)chunk_size); |
| 734 | |
| 735 | // packing up LASzip |
| 736 | unsigned char* bytes; |
| 737 | int num; |
| 738 | if (!laszip.pack(bytes, num)) |
| 739 | { |
| 740 | log("ERROR on laszip.pack(): %s\n", laszip.get_error()); |
| 741 | } |
| 742 | |
| 743 | // creating the output stream |
| 744 | OStream* ost = new OStream(settings->use_iostream, filename); |
| 745 | |
| 746 | // creating the zipper |
| 747 | LASzipper* laszipper = make_zipper(ost, &laszip); |
| 748 | |
| 749 | // allocating the data to read from |
| 750 | data.setup(laszip.num_items, laszip.items); |
| 751 | |
| 752 | // writing the points |
| 753 | if (chunk_size == 0) |
| 754 | { |
| 755 | if (random_seeks) |
| 756 | write_points_explicit_chunk_seek(laszipper, data); |
| 757 | else |
| 758 | write_points_explicit_chunk(laszipper, data); |
| 759 | } |
| 760 | else |
| 761 | { |
| 762 | if (random_seeks) |
| 763 | write_points_seek(laszipper, data); |
| 764 | else |
| 765 | write_points(laszipper, data); |
| 766 | } |
| 767 | |
| 768 | // cleaning up |
| 769 | delete laszipper; |
| 770 | delete ost; |
| 771 | |
| 772 | // |
| 773 | // DECOMPRESSION |
| 774 | // |
| 775 | |
| 776 | // setting up LASzip parameters |
| 777 | LASzip laszip_dec; |
no test coverage detected