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

Method readyFile

io/BpfWriter.cpp:160–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158
159
160void BpfWriter::readyFile(const std::string& filename,
161 const SpatialReference& srs)
162{
163 m_curFilename = filename;
164 m_stream.open(filename);
165 if (!m_stream.isOpen())
166 throwError("Unable to open stream for " + filename);
167 m_header.m_version = 3;
168 m_header.m_numDim = m_dims.size();
169 m_header.m_numPts = 0;
170 m_header.setLog(log());
171
172 if (m_coordId.m_auto)
173 {
174 if (!m_header.m_coordId)
175 {
176 if (m_header.trySetSpatialReference(srs))
177 m_header.m_coordType = Utils::toNative(BpfCoordType::UTM);
178 }
179 }
180
181 // We will re-write the header and dimensions to account for the point
182 // count and dimension min/max.
183 try
184 {
185 m_header.write(m_stream);
186 }
187 catch (const BpfHeader::error& err)
188 {
189 throwError(err.what());
190 }
191 m_header.writeDimensions(m_stream, m_dims);
192 for (auto& file : m_bundledFiles)
193 file.write(m_stream);
194 m_stream.put((const char *)m_extraData.data(), m_extraData.size());
195
196 if (m_stream.position() > (std::numeric_limits<int32_t>::max)())
197 throwError("Data too large. BPF only supports 2^32 - 1 bytes.");
198 m_header.m_len = static_cast<int32_t>(m_stream.position());
199
200 m_header.m_xform.m_vals[0] = m_scaling.m_xXform.m_scale.m_val;
201 m_header.m_xform.m_vals[5] = m_scaling.m_yXform.m_scale.m_val;
202 m_header.m_xform.m_vals[10] = m_scaling.m_zXform.m_scale.m_val;
203}
204
205
206void BpfWriter::loadBpfDimensions(PointLayoutPtr layout)

Callers

nothing calls this directly

Calls 13

writeDimensionsMethod · 0.80
logFunction · 0.50
toNativeFunction · 0.50
openMethod · 0.45
isOpenMethod · 0.45
sizeMethod · 0.45
setLogMethod · 0.45
writeMethod · 0.45
whatMethod · 0.45
putMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected