MCPcopy Create free account
hub / github.com/PDAL/PDAL / readMetadata

Method readMetadata

plugins/rdb/io/RdbReader.cpp:186–304  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184
185
186void RdbReader::readMetadata(RdbPointcloud &reader, MetadataNode root)
187{
188 struct Converter // simple JSON to MetadataNode converter
189 {
190 static void add(
191 MetadataNode& parent,
192 const std::string& name,
193 const std::string& value
194 )
195 {
196 try
197 {
198 NL::json node = NL::json::parse(value);
199 add(parent, name, node);
200 }
201 catch (const NL::json::parse_error&)
202 {
203 parent.add(name, value);
204 }
205 }
206
207 static void add(
208 MetadataNode& parent,
209 const std::string& name,
210 const NL::json& node
211 )
212 {
213 if (node.is_null())
214 parent.add(name, "");
215 else if (node.is_boolean())
216 parent.add(name, node.get<bool>());
217 else if (node.is_number_unsigned())
218 parent.add(name, node.get<uint64_t>());
219 else if (node.is_number_integer())
220 parent.add(name, node.get<int64_t>());
221 else if (node.is_number_float())
222 parent.add(name, node.get<double>());
223 else if (node.is_string())
224 parent.add(name, node.get<std::string>());
225 else if (node.is_object())
226 {
227 MetadataNode object = parent.add(name);
228 for (auto it : node.items())
229 add(object, it.key(), it.value());
230 }
231 else if (node.is_array())
232 {
233 for (size_t i = 0; i < node.size(); ++i)
234 add(parent, name, node.at(i));
235 }
236 }
237 };
238
239 // get database object
240 using namespace riegl::rdb::pointcloud;
241 riegl::rdb::Pointcloud& rdb = reader.pointcloud();
242
243 // basic database information

Callers

nothing calls this directly

Calls 5

addFunction · 0.50
indexMethod · 0.45
addMethod · 0.45
getBoundingBoxMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected