Fill the point information.
| 294 | |
| 295 | /// Fill the point information. |
| 296 | bool E57Reader::fillPoint(PointRef& point) |
| 297 | { |
| 298 | if (m_currentIndex >= m_pointsInCurrentBatch) |
| 299 | { |
| 300 | // Either we are at very begining or finished processing all points in |
| 301 | // current batch. Its time to read new points batch. |
| 302 | m_pointsInCurrentBatch = readNextBatch(); |
| 303 | } |
| 304 | |
| 305 | if (!m_pointsInCurrentBatch) |
| 306 | { |
| 307 | // We're done with reading |
| 308 | return false; |
| 309 | } |
| 310 | |
| 311 | for (auto& keyValue : m_doubleBuffers) |
| 312 | { |
| 313 | auto dim = e57plugin::e57ToPdal(keyValue.first); |
| 314 | |
| 315 | if (dim != Dimension::Id::Unknown) |
| 316 | { |
| 317 | point.setField(dim, m_scan->rescale(dim, keyValue.second[m_currentIndex])); |
| 318 | } |
| 319 | else |
| 320 | { |
| 321 | auto dim = m_extraDims->findDim(keyValue.first); |
| 322 | if (dim != m_extraDims->end()) |
| 323 | { |
| 324 | point.setField(dim->m_id, keyValue.second[m_currentIndex]); |
| 325 | } |
| 326 | } |
| 327 | } |
| 328 | |
| 329 | if (point.hasDim(Dimension::Id::SphericalRange) && |
| 330 | point.hasDim(Dimension::Id::SphericalAzimuth) && |
| 331 | point.hasDim(Dimension::Id::SphericalElevation)) |
| 332 | { |
| 333 | const double range = point.getFieldAs<double>(Dimension::Id::SphericalRange); |
| 334 | const double azimuth = point.getFieldAs<double>(Dimension::Id::SphericalAzimuth); |
| 335 | const double elevation = point.getFieldAs<double>(Dimension::Id::SphericalElevation); |
| 336 | point.setField(Dimension::Id::X, range * std::cos(elevation) * std::cos(azimuth)); |
| 337 | point.setField(Dimension::Id::Y, range * std::cos(elevation) * std::sin(azimuth)); |
| 338 | point.setField(Dimension::Id::Z, range * std::sin(elevation)); |
| 339 | } |
| 340 | |
| 341 | if (m_scan->hasPose()) |
| 342 | m_scan->transformPoint(point); |
| 343 | |
| 344 | ++m_currentIndex; |
| 345 | return true; |
| 346 | } |
| 347 | |
| 348 | point_count_t E57Reader::read(PointViewPtr view, point_count_t count) |
| 349 | { |