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

Method read

io/QfitReader.cpp:323–400  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

321
322
323point_count_t QfitReader::read(PointViewPtr data, point_count_t count)
324{
325 if (!m_istream->good())
326 throwError("Corrupted file/file read error.");
327 if (m_istream->stream()->eof())
328 throwError("End of file detected.");
329
330 count = (std::min)(m_numPoints - m_index, count);
331 std::vector<char> buf(m_size);
332 PointId nextId = data->size();
333 point_count_t numRead = 0;
334 while (count--)
335 {
336 m_istream->get(buf);
337 SwitchableExtractor extractor(buf.data(), m_size, m_littleEndian);
338
339 // always read the base fields
340 {
341 int32_t time, y, xi, z, start_pulse, reflected_pulse, scan_angle,
342 pitch, roll;
343 extractor >> time >> y >> xi >> z >> start_pulse >>
344 reflected_pulse >> scan_angle >> pitch >> roll;
345 double x = xi / 1000000.0;
346 if (m_flip_x && x > 180)
347 x -= 360;
348
349 data->setField(Dimension::Id::OffsetTime, nextId, time);
350 data->setField(Dimension::Id::Y, nextId, y / 1000000.0);
351 data->setField(Dimension::Id::X, nextId, x);
352 data->setField(Dimension::Id::Z, nextId, z * m_scale_z);
353 data->setField(Dimension::Id::StartPulse, nextId, start_pulse);
354 data->setField(Dimension::Id::ReflectedPulse, nextId,
355 reflected_pulse);
356 data->setField(Dimension::Id::Azimuth, nextId,
357 scan_angle / 1000.0);
358 data->setField(Dimension::Id::Pitch, nextId, pitch / 1000.0);
359 data->setField(Dimension::Id::Roll, nextId, roll / 1000.0);
360 }
361
362 if (m_format == QFIT_Format_12)
363 {
364 int32_t pdop, pulse_width;
365 extractor >> pdop >> pulse_width;
366 data->setField(Dimension::Id::Pdop, nextId, pdop / 10.0);
367 data->setField(Dimension::Id::PulseWidth, nextId, pulse_width);
368 }
369 else if (m_format == QFIT_Format_14)
370 {
371 int32_t passive_signal, passive_y, passive_x, passive_z;
372 extractor >> passive_signal >> passive_y >> passive_x >> passive_z;
373 double x = passive_x / 1000000.0;
374 if (m_flip_x && x > 180)
375 x -= 360;
376 data->setField(Dimension::Id::PassiveSignal, nextId, passive_signal);
377 data->setField(Dimension::Id::PassiveY, nextId,
378 passive_y / 1000000.0);
379 data->setField(Dimension::Id::PassiveX, nextId, x);
380 data->setField(Dimension::Id::PassiveZ, nextId,

Callers

nothing calls this directly

Calls 5

eofMethod · 0.45
sizeMethod · 0.45
getMethod · 0.45
dataMethod · 0.45
setFieldMethod · 0.45

Tested by

no test coverage detected