| 646 | |
| 647 | |
| 648 | EsriReader::TileContents EsriReader::loadPath(const std::string& filepath) |
| 649 | { |
| 650 | auto checkSize = [](const DimData& dim, size_t exp, size_t actual) |
| 651 | { |
| 652 | std::string err; |
| 653 | if (exp != actual) |
| 654 | err = "Bad fetch of data for field '" + dim.name + "'."; |
| 655 | return err; |
| 656 | }; |
| 657 | |
| 658 | TileContents tile(filepath, m_extraDimCount); |
| 659 | |
| 660 | const std::string geomUrl = filepath + "/geometries/"; |
| 661 | auto xyzFetch = m_interface->fetchBinary(geomUrl, "0", ".bin.pccxyz"); |
| 662 | tile.m_xyz = i3s::decompressXYZ(&xyzFetch); |
| 663 | |
| 664 | size_t size = tile.m_xyz.size(); |
| 665 | const std::string attrUrl = filepath + "/attributes/"; |
| 666 | for (const DimData& dim : m_esriDims) |
| 667 | { |
| 668 | if (dim.name == "RGB") |
| 669 | { |
| 670 | auto data = m_interface->fetchBinary(attrUrl, std::to_string(dim.key), |
| 671 | ".bin.pccrgb"); |
| 672 | tile.m_rgb = i3s::decompressRGB(&data); |
| 673 | tile.m_error = checkSize(dim, size, tile.m_rgb.size()); |
| 674 | } |
| 675 | else if (dim.name == "INTENSITY") |
| 676 | { |
| 677 | auto data = m_interface->fetchBinary(attrUrl, std::to_string(dim.key), |
| 678 | ".bin.pccint"); |
| 679 | tile.m_intensity = i3s::decompressIntensity(&data); |
| 680 | tile.m_error = checkSize(dim, size, tile.m_intensity.size()); |
| 681 | } |
| 682 | else |
| 683 | { |
| 684 | std::vector<char>& data = tile.m_data[dim.pos]; |
| 685 | data = m_interface->fetchBinary(attrUrl, std::to_string(dim.key), ".bin.gz"); |
| 686 | tile.m_error = checkSize(dim, size * Dimension::size(dim.type), |
| 687 | data.size()); |
| 688 | } |
| 689 | if (tile.m_error.size()) |
| 690 | break; |
| 691 | } |
| 692 | return tile; |
| 693 | } |
| 694 | |
| 695 | } //namespace pdal |
| 696 |
nothing calls this directly
no test coverage detected