| 462 | |
| 463 | |
| 464 | void LasReader::ready(PointTableRef table) |
| 465 | { |
| 466 | if (getNumPoints() == 0) |
| 467 | return; |
| 468 | |
| 469 | d->pool.resize(d->opts.numThreads); |
| 470 | LasStreamPtr lasStream(createStream()); |
| 471 | std::istream& stream(*lasStream); |
| 472 | |
| 473 | d->currentTile.reset(); |
| 474 | d->tiles.clear(); |
| 475 | |
| 476 | d->index = 0; |
| 477 | if (d->header.dataCompressed()) |
| 478 | { |
| 479 | const las::Vlr *vlr = las::findVlr(las::LaszipUserId, las::LaszipRecordId, d->vlrs); |
| 480 | if (!vlr) |
| 481 | throwError("LAZ file missing required laszip VLR."); |
| 482 | lazperf::laz_vlr laz_vlr; |
| 483 | laz_vlr.fill(vlr->data(), vlr->dataSize()); |
| 484 | try |
| 485 | { |
| 486 | d->chunkInfo.load(stream, d->header.pointOffset, d->header.pointCount(), |
| 487 | laz_vlr.chunk_size); |
| 488 | } |
| 489 | catch (const pdal_error& e) |
| 490 | { |
| 491 | throwError(e.what()); |
| 492 | } |
| 493 | |
| 494 | d->nextFetchChunk = 0; |
| 495 | d->nextFetchPoint = 0; |
| 496 | if (d->opts.start > 0) |
| 497 | { |
| 498 | if (d->opts.start >= d->header.pointCount()) |
| 499 | throwError("'start' option set past end of file."); |
| 500 | d->nextFetchChunk = d->chunkInfo.chunk(d->opts.start); |
| 501 | d->nextFetchPoint = d->chunkInfo.index(d->opts.start, d->nextFetchChunk); |
| 502 | } |
| 503 | d->nextReadChunk = d->nextFetchChunk; |
| 504 | } |
| 505 | else |
| 506 | { |
| 507 | d->nextFetchPoint = d->opts.start; |
| 508 | d->nextFetchChunk = 0; |
| 509 | d->nextReadChunk = 0; |
| 510 | } |
| 511 | |
| 512 | for (int i = 0; i < d->opts.numThreads; ++i) |
| 513 | d->queueNext(); |
| 514 | } |
| 515 | |
| 516 | void LasReader::queueNextCompressedChunk() |
| 517 | { |
nothing calls this directly
no test coverage detected