Skip to content

Commit

Permalink
Merge pull request #2451 from PDAL/las-writer-static
Browse files Browse the repository at this point in the history
Fix header-forwarding data structures in the LasWriter
  • Loading branch information
connormanning committed Apr 10, 2019
2 parents b7dc5ca + cc5f420 commit 58c77bc
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions io/LasWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,18 +273,15 @@ void LasWriter::fillForwardList()

static const StringList offset = { "offset_x", "offset_y", "offset_z" };

static StringList all;
all.insert(all.begin(), header.begin(), header.end());
all.insert(all.begin(), scale.begin(), scale.end());
all.insert(all.begin(), offset.begin(), offset.end());

// Build the forward list, replacing special keywords with the proper
// field names.
for (auto& name : m_forwardSpec)
{
if (name == "all")
{
m_forwards.insert(all.begin(), all.end());
m_forwards.insert(header.begin(), header.end());
m_forwards.insert(scale.begin(), scale.end());
m_forwards.insert(offset.begin(), offset.end());
m_forwardVlrs = true;
}
else if (name == "header")
Expand All @@ -297,7 +294,11 @@ void LasWriter::fillForwardList()
m_forwards.insert("dataformat_id");
else if (name == "vlr")
m_forwardVlrs = true;
else if (Utils::contains(all, name))
else if (
Utils::contains(header, name) ||
Utils::contains(scale, name) ||
Utils::contains(offset, name)
)
m_forwards.insert(name);
else
throwError("Error in 'forward' option. Unknown field for "
Expand Down

0 comments on commit 58c77bc

Please sign in to comment.