| 454 | |
| 455 | |
| 456 | void BpfReader::readDimMajor(PointRef& point) |
| 457 | { |
| 458 | if (m_streams.empty()) |
| 459 | { |
| 460 | for (std::size_t dim(0); dim < m_dims.size(); ++dim) |
| 461 | { |
| 462 | std::streamoff offset = sizeof(float) * dim * numPoints(); |
| 463 | |
| 464 | m_streams.emplace_back(new ILeStream()); |
| 465 | m_streams.back()->open(m_filename); |
| 466 | |
| 467 | #ifdef PDAL_HAVE_ZLIB |
| 468 | if (m_header.m_compression) |
| 469 | { |
| 470 | m_charbufs.emplace_back(new Charbuf()); |
| 471 | m_charbufs.back()->initialize( |
| 472 | m_deflateBuf.data(), m_deflateBuf.size(), m_start); |
| 473 | |
| 474 | m_streams.back()->pushStream( |
| 475 | new std::istream(m_charbufs.back().get())); |
| 476 | } |
| 477 | #endif // PDAL_HAVE_ZLIB |
| 478 | |
| 479 | m_streams.back()->seek(m_start + offset); |
| 480 | } |
| 481 | } |
| 482 | |
| 483 | double x(0), y(0), z(0); |
| 484 | float f(0); |
| 485 | double d(0); |
| 486 | |
| 487 | for (size_t dim = 0; dim < m_dims.size(); ++dim) |
| 488 | { |
| 489 | *m_streams[dim] >> f; |
| 490 | d = f + m_dims[dim].m_offset; |
| 491 | if (m_dims[dim].m_id == Dimension::Id::X) |
| 492 | x = d; |
| 493 | else if (m_dims[dim].m_id == Dimension::Id::Y) |
| 494 | y = d; |
| 495 | else if (m_dims[dim].m_id == Dimension::Id::Z) |
| 496 | z = d; |
| 497 | else |
| 498 | point.setField(m_dims[dim].m_id, d); |
| 499 | } |
| 500 | |
| 501 | // Transformation only applies to X, Y and Z |
| 502 | m_header.m_xform.apply(x, y, z); |
| 503 | point.setField(Dimension::Id::X, x); |
| 504 | point.setField(Dimension::Id::Y, y); |
| 505 | point.setField(Dimension::Id::Z, z); |
| 506 | m_index++; |
| 507 | } |
| 508 | |
| 509 | |
| 510 | point_count_t BpfReader::readDimMajor(PointViewPtr data, point_count_t count) |