| 613 | } |
| 614 | |
| 615 | void LasReader::readExtraBytesVlr() |
| 616 | { |
| 617 | las::VlrList lVrlEB; |
| 618 | for (auto vlr : d->vlrs) |
| 619 | { |
| 620 | if (vlr.userId != las::SpecUserId || vlr.recordId != las::ExtraBytesRecordId) |
| 621 | continue; |
| 622 | |
| 623 | if (vlr.dataSize() % las::ExtraBytesSpecSize != 0) |
| 624 | { |
| 625 | log()->get(LogLevel::Warning) << "Bad size for extra bytes VLR. Ignoring.\n"; |
| 626 | continue; |
| 627 | } |
| 628 | lVrlEB.push_back(vlr); |
| 629 | } |
| 630 | |
| 631 | // Ignore EB VLRs if we the extra_dims option was provided. |
| 632 | if (d->extraDims.size()) |
| 633 | { |
| 634 | if (lVrlEB.size()) |
| 635 | log()->get(LogLevel::Warning) << "Ignoring extra bytes VLR(s) - `extra_dims` option " |
| 636 | "was specified.\n"; |
| 637 | return; |
| 638 | } |
| 639 | |
| 640 | if (lVrlEB.size() > 1) |
| 641 | log()->get(LogLevel::Warning) << "Found " << lVrlEB.size() << " extra byte VLRs. " |
| 642 | "Concatanating all extra byte records into one.\n"; |
| 643 | |
| 644 | std::vector<las::ExtraDim> extraDims; |
| 645 | for (auto vlr : lVrlEB) |
| 646 | { |
| 647 | las::ExtraDims evlr = las::ExtraBytesIf::toExtraDims(vlr.data(), vlr.dataSize(), |
| 648 | d->header.baseCount()); |
| 649 | extraDims.insert(extraDims.end(), evlr.begin(), evlr.end()); |
| 650 | } |
| 651 | d->extraDims = std::move(extraDims); |
| 652 | } |
| 653 | |
| 654 | |
| 655 | //ABELL - Not sure why this is its own function, but leaving it so as not to break |