Skip to content

Commit

Permalink
Merge branch 'master' of github.com:PDAL/PDAL
Browse files Browse the repository at this point in the history
  • Loading branch information
hobu committed Nov 15, 2014
2 parents 8977ab0 + 8c94b7f commit d649a2a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/pdal/drivers/bpf/BpfReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class PDAL_DLL BpfReader : public Reader

bool readUlemData();
bool readUlemFiles();
bool readHeaderExtraData();
bool readPolarData();
point_count_t readPointMajor(PointBuffer& data, point_count_t count);
point_count_t readDimMajor(PointBuffer& data, point_count_t count);
Expand Down
17 changes: 17 additions & 0 deletions src/drivers/bpf/BpfReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ void BpfReader::initialize()
readPolarData();
}

// Read thing after the standard header as metadata.
readHeaderExtraData();

// Fast forward file to end of header as reported by base header.
std::streampos pos = m_stream.position();
if (pos > m_header.m_len)
Expand Down Expand Up @@ -117,6 +120,7 @@ bool BpfReader::readUlemData()
return (bool)m_stream;
}


bool BpfReader::readUlemFiles()
{
BpfUlemFile file;
Expand All @@ -126,6 +130,19 @@ bool BpfReader::readUlemFiles()
return (bool)m_stream;
}


/// Encode all data that follows the headers as metadata.
/// \return Whether the stream is still valid.
bool BpfReader::readHeaderExtraData()
{
std::streampos size = m_header.m_len - m_stream.position();
std::vector<uint8_t> buf(size);
m_stream.get(buf);
m_metadata.addEncoded("header_data", buf.data(), buf.size());
return (bool)m_stream;
}


bool BpfReader::readPolarData()
{
if (!m_polarHeader.read(m_stream))
Expand Down

0 comments on commit d649a2a

Please sign in to comment.