| 487 | |
| 488 | |
| 489 | bool EsriReader::processPoint(PointRef& dst, const TileContents& tile) |
| 490 | { |
| 491 | using namespace Dimension; |
| 492 | |
| 493 | auto pointInObb = [this](Eigen::Vector3d coord) |
| 494 | { |
| 495 | if (m_args->obb.valid()) |
| 496 | { |
| 497 | coord -= m_args->obb.center(); |
| 498 | coord = math::rotate(coord, m_args->obb.quat().inverse()); |
| 499 | if (!m_args->obb.bounds().contains(coord.x(), coord.y(), coord.z())) |
| 500 | return false; |
| 501 | } |
| 502 | return true; |
| 503 | }; |
| 504 | |
| 505 | Eigen::Vector3d coord { tile.m_xyz[m_pointId].x, tile.m_xyz[m_pointId].y, |
| 506 | tile.m_xyz[m_pointId].z }; |
| 507 | |
| 508 | if (pointInObb(coord)) |
| 509 | { |
| 510 | dst.setField(Id::X, coord.x()); |
| 511 | dst.setField(Id::Y, coord.y()); |
| 512 | dst.setField(Id::Z, coord.z()); |
| 513 | |
| 514 | for (const DimData& dim : m_esriDims) |
| 515 | { |
| 516 | if (dim.name == "RGB") |
| 517 | { |
| 518 | dst.setField(Id::Red, tile.m_rgb[m_pointId].r); |
| 519 | dst.setField(Id::Green, tile.m_rgb[m_pointId].g); |
| 520 | dst.setField(Id::Blue, tile.m_rgb[m_pointId].b); |
| 521 | } |
| 522 | else if (dim.name == "INTENSITY") |
| 523 | dst.setField(Id::Intensity, tile.m_intensity[m_pointId]); |
| 524 | else if (dim.name == "RETURNS") |
| 525 | { |
| 526 | const std::vector<char>& d = tile.m_data[dim.pos]; |
| 527 | dst.setField(Id::ReturnNumber, d[m_pointId] & 0x0F); |
| 528 | dst.setField(Id::NumberOfReturns, d[m_pointId] >> 4); |
| 529 | } |
| 530 | else |
| 531 | { |
| 532 | const std::vector<char>& d = tile.m_data[dim.pos]; |
| 533 | dst.setField(dim.dstId, dim.type, |
| 534 | d.data() + m_pointId * Dimension::size(dim.type)); |
| 535 | } |
| 536 | } |
| 537 | } |
| 538 | m_pointId++; |
| 539 | return true; |
| 540 | } |
| 541 | |
| 542 | // Traverse tree through nodepages. Create a nodebox for each node in |
| 543 | // the tree and test if it overlaps with the bounds created by user. |