Changeset 532
- Timestamp:
- 03/16/08 17:08:53 (16 months ago)
- Files:
-
- 1 modified
-
trunk/apps/txt2las.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/apps/txt2las.c
r530 r532 97 97 const char* l = line; 98 98 99 point = LASPoint_Create(); 99 100 100 while (p[0]) 101 101 { … … 330 330 LASHeaderH header = NULL; 331 331 LASWriterH writer = NULL; 332 LASError err; 332 333 333 334 int xyz_min_quant[3] = {0, 0, 0}; … … 537 538 while (fgets(line, sizeof(char) * MAX_CHARACTERS_PER_LINE, file_in)) 538 539 { 539 if (parse(parse_less, line, xyz, &point, &gps_time)) 540 point = LASPoint_Create(); 541 if (parse(parse_less, line, xyz, point, &gps_time)) 540 542 { 541 543 /* init the bounding box */ … … 557 559 line, 558 560 parse_less); 559 } 561 562 } 563 LASPoint_Destroy(point); 564 point = NULL; 560 565 } 561 566 … … 571 576 while (fgets(line, sizeof(char) * MAX_CHARACTERS_PER_LINE, file_in)) 572 577 { 573 if (parse(parse_less, line, xyz, &point, &gps_time)) 578 point = LASPoint_Create(); 579 if (parse(parse_less, line, xyz, point, &gps_time)) 574 580 { 575 581 /* update bounding box */ … … 587 593 line, 588 594 parse_less); 589 } 595 596 } 597 LASPoint_Destroy(point); 598 point = NULL; 590 599 } 591 600 … … 672 681 if (strstr(parse_string,"t")) 673 682 { 683 fprintf(stderr, "Setting to LAS version 1.1!!!\n"); 674 684 LASHeader_SetDataFormatId(header, 1); 675 685 } … … 726 736 while (fgets(line, sizeof(char) * MAX_CHARACTERS_PER_LINE, file_in)) 727 737 { 728 if (parse(parse_string, line, xyz, &point, &gps_time)) 738 point = LASPoint_Create(); 739 if (parse(parse_string, line, xyz, point, &gps_time)) 729 740 { 730 741 /* init the bounding box */ … … 739 750 740 751 /* compute the quantized x, y, and z values */ 741 LASPoint_SetX(point, 0.5 + (xyz[0] - xyz_offset[0]) / xyz_scale[0]);742 LASPoint_SetY(point, 0.5 + (xyz[1] - xyz_offset[1]) / xyz_scale[1]);743 LASPoint_Set X(point, 0.5 + (xyz[2] - xyz_offset[2]) / xyz_scale[2]);752 LASPoint_SetX(point, xyz[0]); 753 LASPoint_SetY(point, xyz[1]); 754 LASPoint_SetZ(point, xyz[2]); 744 755 745 756 /* write the first point */ 746 LASWriter_WritePoint(writer, point); 747 printf("Writing point..."); 757 err = LASWriter_WritePoint(writer, point); 758 if (err) { 759 LASError_Print("could not write point"); 760 exit(1); 761 } 748 762 749 763 /* we can stop this loop */ … … 756 770 parse_string); 757 771 } 772 LASPoint_Destroy(point); 773 point = NULL; 758 774 } 759 775 … … 769 785 while (fgets(line, sizeof(char) * MAX_CHARACTERS_PER_LINE, file_in)) 770 786 { 787 point = LASPoint_Create(); 771 788 if (parse(parse_string, line, xyz, &point, &gps_time)) 772 789 { … … 781 798 782 799 /* compute the quantized x, y, and z values */ 783 LASPoint_SetX(point, 0.5 + (xyz[0] - xyz_offset[0]) / xyz_scale[0]);784 LASPoint_SetY(point, 0.5 + (xyz[1] - xyz_offset[1]) / xyz_scale[1]);785 LASPoint_Set X(point, 0.5 + (xyz[2] - xyz_offset[2]) / xyz_scale[2]);800 LASPoint_SetX(point, xyz[0]); 801 LASPoint_SetY(point, xyz[1]); 802 LASPoint_SetZ(point, xyz[2]); 786 803 787 804 /* write the first point */ 788 LASWriter_WritePoint(writer, point); 805 err = LASWriter_WritePoint(writer, point); 806 if (err) { 807 LASError_Print("could not write point"); 808 exit(1); 809 } 810 789 811 } 790 812 else … … 794 816 parse_string); 795 817 } 818 LASPoint_Destroy(point); 819 point = NULL; 796 820 } 797 821
