| 651 | //--------------------------------------------------------------------------- |
| 652 | |
| 653 | static void write_points_explicit_chunk_seek(LASzipper* zipper, PointData& data) |
| 654 | { |
| 655 | if (zipper==NULL) |
| 656 | return; |
| 657 | |
| 658 | double start_time, end_time; |
| 659 | unsigned char c; |
| 660 | unsigned int i,j; |
| 661 | unsigned int next_chunk = settings->num_points/10; |
| 662 | |
| 663 | start_time = taketime(); |
| 664 | |
| 665 | // the two branches of this IF are the same, except for the use of a random number; |
| 666 | // we keep the random case separate, so that we can get fastest timing tests w/o random data |
| 667 | if (settings->use_random) |
| 668 | { |
| 669 | for (i = 0; i < settings->num_points; i++) |
| 670 | { |
| 671 | srand(i); |
| 672 | c = rand() % 256; |
| 673 | for (j = 0; j < data.point_size; j++) |
| 674 | { |
| 675 | data.point_data[j] = c; |
| 676 | c = rand() % 256; |
| 677 | } |
| 678 | zipper->write(data.point); |
| 679 | if (i == next_chunk) |
| 680 | { |
| 681 | zipper->chunk(); |
| 682 | next_chunk += settings->num_points/10; |
| 683 | next_chunk -= c; |
| 684 | } |
| 685 | } |
| 686 | } |
| 687 | else |
| 688 | { |
| 689 | for (i = 0; i < settings->num_points; i++) |
| 690 | { |
| 691 | c = (unsigned char)i; |
| 692 | for (j = 0; j < data.point_size; j++) |
| 693 | { |
| 694 | data.point_data[j] = c; |
| 695 | c++; |
| 696 | } |
| 697 | zipper->write(data.point); |
| 698 | if (i == next_chunk) |
| 699 | { |
| 700 | zipper->chunk(); |
| 701 | next_chunk += settings->num_points/10; |
| 702 | next_chunk -= (rand() % 256); |
| 703 | } |
| 704 | } |
| 705 | } |
| 706 | |
| 707 | if (!zipper->close()) |
| 708 | { |
| 709 | log("ERROR on zipper->close(): %s\n", zipper->get_error()); |
| 710 | } |