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

Method close

LASlib/src/laswriter_las.cpp:1281–1442  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1279}
1280
1281I64 LASwriterLAS::close(BOOL update_npoints)
1282{
1283 I64 bytes = 0;
1284
1285 if (p_count != npoints)
1286 {
1287 if (npoints || !update_npoints)
1288 {
1289 LASMessage(LAS_WARNING, "written %lld points but expected %lld points", p_count, npoints);
1290 }
1291 }
1292
1293 if (writer)
1294 {
1295 writer->done();
1296 delete writer;
1297 writer = 0;
1298 }
1299
1300 if (writing_las_1_4 && number_of_extended_variable_length_records)
1301 {
1302 I64 real_start_of_first_extended_variable_length_record = stream->tell();
1303
1304 // write extended variable length records variable after variable (to avoid alignment issues)
1305 U64 copc_root_hier_size = 0;
1306 U64 copc_root_hier_offset = 0;
1307 for (U32 i = 0; i < number_of_extended_variable_length_records; i++)
1308 {
1309 if ((strcmp(evlrs[i].user_id, "copc") == 0) && evlrs[i].record_id == 1000)
1310 copc_root_hier_offset = stream->tell() + 60;
1311
1312 // check variable length records contents
1313
1314 if (evlrs[i].reserved != 0xAABB)
1315 {
1316 // LASMessage(LAS_WARNING, "wrong evlrs[%d].reserved: %d != 0xAABB", i, evlrs[i].reserved);
1317 }
1318
1319 // write variable length records variable after variable (to avoid alignment issues)
1320
1321 if (!stream->put16bitsLE((const U8*)&(evlrs[i].reserved)))
1322 {
1323 laserror("writing evlrs[%d].reserved", i);
1324 return FALSE;
1325 }
1326 if (!stream->putBytes((const U8*)evlrs[i].user_id, 16))
1327 {
1328 laserror("writing evlrs[%d].user_id", i);
1329 return FALSE;
1330 }
1331 if (!stream->put16bitsLE((const U8*)&(evlrs[i].record_id)))
1332 {
1333 laserror("writing evlrs[%d].record_id", i);
1334 return FALSE;
1335 }
1336 if (!stream->put64bitsLE((const U8*)&(evlrs[i].record_length_after_header)))
1337 {
1338 laserror("writing evlrs[%d].record_length_after_header", i);

Callers

nothing calls this directly

Calls 11

LASMessageFunction · 0.85
laserrorFunction · 0.85
doneMethod · 0.45
tellMethod · 0.45
put16bitsLEMethod · 0.45
putBytesMethod · 0.45
put64bitsLEMethod · 0.45
seekMethod · 0.45
seekEndMethod · 0.45
isSeekableMethod · 0.45
put32bitsLEMethod · 0.45

Tested by

no test coverage detected