Checks and collects point information
| 83 | |
| 84 | /// Checks and collects point information |
| 85 | void LAScheck::check_parse(const LASpoint* laspoint, ValidationResult& results) { |
| 86 | // add point to inventory |
| 87 | lasinventory.add(laspoint); |
| 88 | lassummary.add(laspoint); |
| 89 | |
| 90 | // check point against bounding box |
| 91 | if (!laspoint->inside_bounding_box(min_x, min_y, min_z, max_x, max_y, max_z)) { |
| 92 | points_outside_bounding_box++; |
| 93 | } |
| 94 | |
| 95 | // Return Number / Number of Returns consistency check |
| 96 | // point_data_format 0�5 : legacy return fields |
| 97 | if (lasheader->point_data_format <= 5) { |
| 98 | const U8 return_number = laspoint->get_return_number(); |
| 99 | const U8 number_of_returns = laspoint->get_number_of_returns(); |
| 100 | |
| 101 | if (number_of_returns == 0 || return_number == 0 || return_number > number_of_returns) { |
| 102 | points_return_combination++; |
| 103 | } |
| 104 | } |
| 105 | // point_data_format 6�10 : extended return fields (LAS 1.4) |
| 106 | else if (lasheader->point_data_format >= 6 && lasheader->point_data_format <= 10) { |
| 107 | const U8 extended_return_number = laspoint->get_extended_return_number(); |
| 108 | const U8 extended_number_of_returns = laspoint->get_extended_number_of_returns(); |
| 109 | |
| 110 | if (extended_number_of_returns == 0 || extended_return_number == 0 || extended_return_number > extended_number_of_returns) { |
| 111 | points_extended_return_combination++; |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | // check that the scan direction and edge of flight line are correctly set to 0 or 1 |
| 116 | |
| 117 | U8 scan_dir = laspoint->get_scan_direction_flag(); // Bit 6 |
| 118 | U8 edge = laspoint->get_edge_of_flight_line(); // Bit 7 |
| 119 | |
| 120 | // scan direction flag must be 0 or 1 |
| 121 | if (scan_dir != 0 && scan_dir != 1) { |
| 122 | scan_dir_valid = false; |
| 123 | } |
| 124 | // edge of flight line flag must be 0 or 1 |
| 125 | if (edge != 0 && edge != 1) { |
| 126 | edge_flight_line_valid = false; |
| 127 | } |
| 128 | |
| 129 | // check that the classification value is valid according to LAS version |
| 130 | |
| 131 | U8 classification = laspoint->get_classification(); |
| 132 | |
| 133 | // LAS 1.0�1.3: valid range is 0�31 |
| 134 | // LAS 1.4�1.5: valid range is 0�255 |
| 135 | if (lasheader->version_minor <= 3) { |
| 136 | if (classification > 31) { |
| 137 | classification_valid = false; |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | // point GPS time outside header range |
| 142 |