MCPcopy Create free account
hub / github.com/PDAL/PDAL / prepOutput

Method prepOutput

io/LasWriter.cpp:348–389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

346
347
348void LasWriter::prepOutput(std::ostream *outStream, const SpatialReference& srs)
349{
350 // Use stage SRS if provided.
351 m_srs = getSpatialReference().empty() ? srs : getSpatialReference();
352
353 handleHeaderForwards(m_forwardMetadata);
354
355 // Filling the header here gives the VLR functions below easy access to
356 // the version information and so on.
357 fillHeader();
358
359 // Spatial reference can potentially change for multiple output files.
360 addSpatialRefVlrs();
361
362 d->summary.clear();
363 m_ostream = outStream;
364 if (d->header.dataCompressed())
365 readyCompression();
366
367 // Compression should cause the last of the VLRs to get filled. We now
368 // have a valid count, so fill the header again.
369 fillHeader();
370
371 validateHeader();
372
373 // Write the header.
374 std::vector<char> headerBuf = d->header.data();
375 m_ostream->write(headerBuf.data(), headerBuf.size());
376 d->header.vlrOffset = (uint32_t)m_ostream->tellp();
377
378 for (const las::Vlr& vlr : m_vlrs)
379 {
380 std::vector<char> buf = vlr.headerData();
381 m_ostream->write(buf.data(), buf.size());
382 m_ostream->write(vlr.data(), vlr.dataSize());
383 }
384 d->header.pointOffset = (uint32_t)m_ostream->tellp();
385
386 // Set the point buffer size here in case we're using the streaming
387 // interface.
388 m_pointBuf.resize(d->header.pointSize);
389}
390
391
392/// Search for metadata associated with the provided recordId and userId.

Callers

nothing calls this directly

Calls 9

dataCompressedMethod · 0.80
headerDataMethod · 0.80
dataSizeMethod · 0.80
resizeMethod · 0.80
emptyMethod · 0.45
clearMethod · 0.45
dataMethod · 0.45
writeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected