| 140 | } |
| 141 | |
| 142 | BOOL LASreaderBuffered::open() |
| 143 | { |
| 144 | if (!lasreadopener.active()) |
| 145 | { |
| 146 | laserror("no input name"); |
| 147 | return FALSE; |
| 148 | } |
| 149 | |
| 150 | // open the main file |
| 151 | |
| 152 | lasreader = lasreadopener.open(); |
| 153 | if (lasreader == 0) |
| 154 | { |
| 155 | laserror("opening '%s'", lasreadopener.get_file_name()); |
| 156 | return FALSE; |
| 157 | } |
| 158 | |
| 159 | // populate the merged header |
| 160 | header = lasreader->header; |
| 161 | |
| 162 | // unlink pointers in other header so their data does not get deallocated twice |
| 163 | lasreader->header.unlink(); |
| 164 | |
| 165 | // special check for attributes in extra bytes |
| 166 | if (header.number_attributes) |
| 167 | { |
| 168 | header.number_attributes = 0; |
| 169 | header.init_attributes(lasreader->header.number_attributes, lasreader->header.attributes); |
| 170 | } |
| 171 | |
| 172 | // initialize the point with the header info |
| 173 | |
| 174 | if (header.laszip) |
| 175 | { |
| 176 | if (!point.init(&header, header.laszip->num_items, header.laszip->items, &header)) return FALSE; |
| 177 | } |
| 178 | else |
| 179 | { |
| 180 | if (!point.init(&header, header.point_data_format, header.point_data_record_length, &header)) return FALSE; |
| 181 | } |
| 182 | |
| 183 | // maybe we have to look for neighbors from which we load buffer points |
| 184 | |
| 185 | if (lasreadopener_neighbors.active()) |
| 186 | { |
| 187 | F64 xyz; |
| 188 | |
| 189 | lasreadopener_neighbors.set_inside_rectangle(header.min_x - buffer_size, header.min_y - buffer_size, header.max_x + buffer_size, header.max_y + buffer_size); |
| 190 | |
| 191 | // store current counts and bounding box in LASoriginal VLR |
| 192 | |
| 193 | header.set_lasoriginal(); |
| 194 | |
| 195 | // force identical scale on the neighbors |
| 196 | |
| 197 | lasreadopener_neighbors.set_scale_factor(&header.x_scale_factor); |
| 198 | |
| 199 | // force identical offset on the neighbors |
nothing calls this directly
no test coverage detected