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

Method run

kernels/InfoKernel.cpp:241–305  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

239}
240
241MetadataNode InfoKernel::run(const std::string& filename)
242{
243 MetadataNode root;
244 std::unique_ptr<arbiter::LocalHandle> localHandle;
245 std::string readerDriver = m_driverOverride.size()
246 ? m_driverOverride : StageFactory::inferReaderDriver(filename);
247
248 uint64_t pointCountOverride = 0;
249
250 if (!m_needPoints && readerDriver == "readers.las" && Utils::isRemote(filename))
251 {
252 auto pointless = getPointlessLasFile(filename);
253 pointCountOverride = pointless.pointCount;
254 localHandle = std::move(pointless.handle);
255 makeReader(localHandle->localPath());
256 }
257 else
258 makeReader(filename);
259
260 root.add("filename", filename);
261 root.add("pdal_version", Config::fullVersionString());
262
263 if (m_showSummary)
264 {
265 QuickInfo qi = m_manager.getStage()->preview();
266 if (!qi.valid())
267 throw pdal_error("No summary data available for '" +
268 filename + "'.");
269
270 // Correct our point count with the actual value.
271 if (pointCountOverride)
272 {
273 m_reader->getMetadata().addOrUpdate("count", pointCountOverride);
274 qi.m_pointCount = pointCountOverride;
275 }
276 root.add(qi.dumpSummary().clone("summary"));
277 }
278 else
279 {
280 makePipeline();
281 if (m_needPoints || m_showMetadata)
282 m_manager.execute(ExecMode::PreferStream);
283 else
284 m_manager.prepare();
285
286 // Correct our point count with the actual value.
287 if (pointCountOverride)
288 m_reader->getMetadata().addOrUpdate("count", pointCountOverride);
289
290 dump(root);
291 }
292
293 std::time_t now
294 = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
295 std::stringstream t;
296 t << std::put_time( std::localtime( &now ), "%FT%T%z" );
297 root.add("reader", m_reader->getName());
298 root.add("now", t.str());

Callers

nothing calls this directly

Calls 14

isRemoteFunction · 0.85
getPointlessLasFileFunction · 0.85
fullVersionStringFunction · 0.85
dumpSummaryMethod · 0.80
strMethod · 0.80
fileSizeFunction · 0.50
sizeMethod · 0.45
addMethod · 0.45
previewMethod · 0.45
validMethod · 0.45
getMetadataMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected