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

Method prepared

io/LasWriter.cpp:219–259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217
218
219void LasWriter::prepared(PointTableRef table)
220{
221 FlexWriter::validateFilename(table);
222
223 PointLayoutPtr layout = table.layout();
224
225 // Make sure the dataformatID is set so that we can get the proper
226 // dimensions being written as part of the standard LAS record.
227 fillHeader();
228
229 // If we've asked for all dimensions, add to extraDims all dimensions
230 // in the layout that aren't already destined for LAS output.
231 if (m_extraDims.size() == 1 && m_extraDims[0].m_name == "all")
232 {
233 m_extraDims.clear();
234 Dimension::IdList ids = las::pdrfDims(d->header.pointFormat());
235 DimTypeList dimTypes = layout->dimTypes();
236 int byteOffset = 0;
237 for (auto& dt : dimTypes)
238 if (!Utils::contains(ids, dt.m_id))
239 {
240 m_extraDims.push_back(
241 las::ExtraDim(layout->dimName(dt.m_id), dt.m_type, byteOffset));
242 byteOffset += Dimension::size(dt.m_type);
243 }
244 }
245
246 m_extraByteLen = 0;
247 for (auto& dim : m_extraDims)
248 {
249 dim.m_dimType.m_id = table.layout()->findDim(dim.m_name);
250 if (dim.m_dimType.m_id == Dimension::Id::Unknown)
251 throwError("Dimension '" + dim.m_name + "' specified in "
252 "'extra_dim' option not found.");
253 m_extraByteLen += Dimension::size(dim.m_dimType.m_type);
254 log()->get(LogLevel::Info) << getName() << ": Writing dimension " <<
255 dim.m_name <<
256 "(" << Dimension::interpretationName(dim.m_dimType.m_type) <<
257 ") " << " to LAS extra bytes." << std::endl;
258 }
259}
260
261
262// Capture user-specified VLRs

Callers

nothing calls this directly

Calls 14

validateFilenameFunction · 0.85
interpretationNameFunction · 0.85
dimNameMethod · 0.80
ExtraDimClass · 0.70
getNameFunction · 0.70
containsFunction · 0.50
sizeFunction · 0.50
logFunction · 0.50
sizeMethod · 0.45
clearMethod · 0.45
pointFormatMethod · 0.45
dimTypesMethod · 0.45

Tested by

no test coverage detected