| 346 | |
| 347 | |
| 348 | void 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. |
nothing calls this directly
no test coverage detected