MCPcopy Create free account
hub / github.com/LAStools/LAStools / append

Method append

LASzip/src/lasindex.cpp:321–460  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

319}
320
321BOOL LASindex::append(const char* file_name) const
322{
323#ifdef LASZIPDLL_EXPORTS
324 return FALSE;
325#else
326 LASreadOpener lasreadopener;
327
328 if (file_name == 0) return FALSE;
329
330 // open reader
331
332 LASreader* lasreader = lasreadopener.open(file_name);
333 if (lasreader == 0) return FALSE;
334 if (lasreader->header.laszip == 0) return FALSE;
335
336 // close reader
337
338 lasreader->close();
339
340 FILE* file = LASfopen(file_name, "rb");
341
342 ByteStreamIn* bytestreamin = 0;
343 if (Endian::IS_LITTLE_ENDIAN)
344 bytestreamin = new ByteStreamInFileLE(file);
345 else
346 bytestreamin = new ByteStreamInFileBE(file);
347
348 // maybe write LASindex EVLR start position into LASzip VLR
349
350 I64 offset_laz_vlr = -1;
351
352 // where to write LASindex EVLR that will contain the LAX file
353
354 I64 number_of_special_evlrs = lasreader->header.laszip->number_of_special_evlrs;
355 I64 offset_to_special_evlrs = lasreader->header.laszip->offset_to_special_evlrs;
356
357 if ((number_of_special_evlrs == -1) && (offset_to_special_evlrs == -1))
358 {
359 bytestreamin->seekEnd();
360 number_of_special_evlrs = 1;
361 offset_to_special_evlrs = bytestreamin->tell();
362
363 // find LASzip VLR
364
365 I64 total = lasreader->header.header_size + 2;
366 U32 number_of_variable_length_records = lasreader->header.number_of_variable_length_records + 1 + (lasreader->header.vlr_lastiling != 0) + (lasreader->header.vlr_lasoriginal != 0);
367
368 for (U32 u = 0; u < number_of_variable_length_records; u++)
369 {
370 bytestreamin->seek(total);
371
372 CHAR user_id[LAS_VLR_USER_ID_CHAR_LEN];
373 try { bytestreamin->getBytes((U8*)user_id, 16); } catch(...)
374 {
375 laserror("reading header.vlrs[%d].user_id", u);
376 return FALSE;
377 }
378 if (strcmp(user_id, "laszip encoded") == 0)

Callers 6

mainFunction · 0.80
json.hppFile · 0.80
concat_intoFunction · 0.80
get_cbor_stringMethod · 0.80
mainFunction · 0.80

Calls 12

LASfopenFunction · 0.85
laserrorFunction · 0.85
openMethod · 0.45
closeMethod · 0.45
seekEndMethod · 0.45
tellMethod · 0.45
seekMethod · 0.45
getBytesMethod · 0.45
get16bitsLEMethod · 0.45
put16bitsLEMethod · 0.45
putBytesMethod · 0.45
put64bitsLEMethod · 0.45

Tested by

no test coverage detected