Skip to content

Commit

Permalink
Put encoded LAS VLR in its own node.
Browse files Browse the repository at this point in the history
Close #1648
  • Loading branch information
abellgithub committed Aug 28, 2017
1 parent 4f25afc commit 31683bc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions io/LasReader.cpp
Expand Up @@ -450,9 +450,11 @@ void LasReader::extractVlrMetadata(MetadataNode& forward, MetadataNode& m)

std::ostringstream name;
name << "vlr_" << i++;
MetadataNode vlrNode = m.addEncoded(name.str(),
(const uint8_t *)vlr.data(), vlr.dataLen(), vlr.description());
MetadataNode vlrNode(name.str());
m.add(vlrNode);

vlrNode.addEncoded("data",
(const uint8_t *)vlr.data(), vlr.dataLen(), vlr.description());
vlrNode.add("user_id", vlr.userId(),
"User ID of the record or pre-defined value from the "
"specification.");
Expand Down
4 changes: 3 additions & 1 deletion test/unit/io/LasReaderTest.cpp
Expand Up @@ -243,7 +243,9 @@ TEST(LasReaderTest, test_vlr)
std::string name("vlr_");
name += std::to_string(i);
MetadataNode m = root.findChild(name);
EXPECT_TRUE(!m.value().empty()) << "No node " << i;
EXPECT_TRUE(!m.empty()) << "No node " << i;
m = m.findChild("data");
EXPECT_TRUE(!m.empty()) << "No value for node " << i;
}
}

Expand Down

0 comments on commit 31683bc

Please sign in to comment.