|
50 | 50 | LASDatasets.make_consistent_header!(h, pc, LasVariableLengthRecord[], LasVariableLengthRecord[], UInt8[]) |
51 | 51 | las = LASDataset(h, pc, LasVariableLengthRecord[], LasVariableLengthRecord[], UInt8[]) |
52 | 52 | @test las == LASDataset(deepcopy(pc)) |
| 53 | + |
| 54 | + # check how we're modifying the synthetic flag - if we have no synthetics, it shouldn't be set |
| 55 | + just_synth_flag(global_encoding::UInt16) = global_encoding & 0x0008 |
| 56 | + @test just_synth_flag(h.global_encoding) == 0x00 |
| 57 | + # but if we set some, our flag should be adjusted |
| 58 | + pc = Table(pc, synthetic = trues(num_points)) |
| 59 | + h = LasHeader(; las_version = v"1.1", data_format_id = UInt8(1), data_record_length = UInt16(28)) |
| 60 | + LASDatasets.make_consistent_header!(h, pc, LasVariableLengthRecord[], LasVariableLengthRecord[], UInt8[]) |
| 61 | + @test just_synth_flag(h.global_encoding) > 0 |
| 62 | + # if we set all these to false, though, then we shouldn't set the flag either |
| 63 | + pc.synthetic .= false |
| 64 | + LASDatasets.make_consistent_header!(h, pc, LasVariableLengthRecord[], LasVariableLengthRecord[], UInt8[]) |
| 65 | + @test just_synth_flag(h.global_encoding) == 0x00 |
| 66 | + |
53 | 67 |
|
54 | 68 | # now try incorporating some user fields |
55 | 69 | spicy_pc = Table(pc, thing = rand(num_points), other_thing = rand(Int16, num_points)) |
|
58 | 72 | this_header = get_header(las) |
59 | 73 | @test point_record_length(this_header) == LASDatasets.byte_size(LasPoint1) + 10 |
60 | 74 | # our user fields should be populated in the dataset |
61 | | - @test sort(collect(columnnames(las.pointcloud))) == [:classification, :gps_time, :id, :other_thing, :position, :thing] |
| 75 | + @test sort(collect(columnnames(las.pointcloud))) == [:classification, :gps_time, :id, :other_thing, :position, :synthetic, :thing] |
62 | 76 | this_pc = get_pointcloud(las) |
63 | 77 | @test this_pc.thing == spicy_pc.thing |
64 | 78 | @test this_pc.other_thing == spicy_pc.other_thing |
|
0 commit comments