| 215 | } |
| 216 | |
| 217 | void CopcWriter::handleForwardVlrs(MetadataNode& forwards) |
| 218 | { |
| 219 | if (!b->forwardVlrs) |
| 220 | return; |
| 221 | |
| 222 | MetadataNodeList nodes = forwards.findChildren([](MetadataNode n) |
| 223 | { return Utils::startsWith(n.name(), "vlr_"); }); |
| 224 | for (auto& n : nodes) |
| 225 | { |
| 226 | const MetadataNode& userIdNode = n.findChild("user_id"); |
| 227 | const MetadataNode& recordIdNode = n.findChild("record_id"); |
| 228 | if (userIdNode.valid() && recordIdNode.valid()) |
| 229 | { |
| 230 | |
| 231 | const MetadataNode& descriptionNode = n.findChild("description"); |
| 232 | const std::vector<uint8_t>& data = Utils::base64_decode(n.findChild("data").value()); |
| 233 | const char *d = (const char *)data.data(); |
| 234 | std::vector<char> buf(d, d + data.size()); |
| 235 | las::Evlr e(userIdNode.value(), (uint16_t)std::stoi(recordIdNode.value()), |
| 236 | descriptionNode.value(), std::move(buf)); |
| 237 | b->vlrs.push_back(e); |
| 238 | } |
| 239 | } |
| 240 | } |
| 241 | |
| 242 | void CopcWriter::prepared(PointTableRef table) |
| 243 | { |