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

Method setupWriter

plugins/e57/io/E57Writer.cpp:365–414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

363}
364
365void E57Writer::setupWriter()
366{
367 // Create the scan node itself. It will contain a CompressedVectorNode
368 // that will store the points
369 m_scanNode.reset(new e57::StructureNode(*m_imageFile));
370 m_scanNode->set("guid",
371 e57::StringNode(*m_imageFile, uuidGenerator::generate_uuid()));
372
373 // Prototype and buffer arrays for the CompressedVectorNodeWriter
374 e57::StructureNode proto = e57::StructureNode(*m_imageFile);
375 e57::FloatPrecision precision =
376 m_doublePrecision ? e57::E57_DOUBLE : e57::E57_SINGLE;
377 for (auto& e57Dimension: m_dimensionsToWrite)
378 {
379 if ((e57Dimension.find("color") != std::string::npos) ||
380 e57Dimension.find("intensity") != std::string::npos ||
381 e57Dimension.find("classification") != std::string::npos)
382 {
383 auto bounds = e57plugin::getPdalBounds(e57plugin::e57ToPdal(e57Dimension));
384 proto.set(e57Dimension,
385 e57::IntegerNode(*m_imageFile, 0, bounds.first,bounds.second));
386 }
387 else
388 proto.set(e57Dimension,
389 e57::FloatNode(*m_imageFile, 0.0, precision));
390 }
391
392 // Create CompressedVector for storing points.
393 e57::VectorNode codecs = e57::VectorNode(*m_imageFile, true);
394 e57::CompressedVectorNode points =
395 e57::CompressedVectorNode(*m_imageFile, proto, codecs);
396
397 // Add the points to the file hierarchy
398 m_scanNode->set("points", points);
399 e57::VectorNode data3D(*m_imageFile, true);
400 m_rootNode->set("data3D", data3D);
401 data3D.append(*m_scanNode);
402
403 // Instantiate writer
404 try
405 {
406 m_chunkWriter.reset(new ChunkWriter(m_dimensionsToWrite, points));
407 }
408 catch (e57::E57Exception &e)
409 {
410 std::string msg = "E57 error with code " +
411 std::to_string(e.errorCode()) + " - " + e.context();
412 throwError(msg);
413 }
414}
415
416} // namespace pdal;

Callers

nothing calls this directly

Calls 14

StringNodeClass · 0.85
generate_uuidFunction · 0.85
StructureNodeClass · 0.85
getPdalBoundsFunction · 0.85
e57ToPdalFunction · 0.85
IntegerNodeClass · 0.85
FloatNodeClass · 0.85
VectorNodeClass · 0.85
errorCodeMethod · 0.80
resetMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected