void E57Writer::write(const PointViewPtr view) { for (PointId id = 0; id < view->size(); ++id) { PointRef point = view->point(id); processOne(point); } }
bool processOne(PointRef& point) { PointRef bulkPoint = m_view->point(m_cnt); bulkPoint.getPackedData(m_dims, m_bulkBuf.data()); point.getPackedData(m_dims, m_buf.data()); EXPECT_EQ(memcmp(m_buf.data(), m_bulkBuf.data(), m_view->pointSize()), 0); m_cnt++; return true; }
point_count_t FauxReader::read(PointViewPtr view, point_count_t count) { for (PointId idx = 0; idx < count; ++idx) { PointRef point = view->point(idx); if (!processOne(point)) break; if (m_cb) m_cb(*view, idx); } return count; }
point_count_t TileDBReader::read(PointViewPtr view, point_count_t count) { PointRef point = view->point(0); PointId id; for (id = 0; id < count; ++id) { point.setPointId(id); if (!processOne(point)) break; } return id; }
void HAGFilter::filter(PointView& view) { PointViewPtr gView = view.makeNew(); PointViewPtr ngView = view.makeNew(); std::vector<PointId> gIdx, ngIdx; // First pass: Separate into ground and non-ground views. for (PointId i = 0; i < view.size(); ++i) { double c = view.getFieldAs<double>(Dimension::Id::Classification, i); if (c == 2) { gView->appendPoint(view, i); gIdx.push_back(i); } else { ngView->appendPoint(view, i); ngIdx.push_back(i); } } // Bail if there weren't any points classified as ground. if (gView->size() == 0) throwError("Input PointView does not have any points classified " "as ground"); // Build the 2D KD-tree. KD2Index kdi(*gView); kdi.build(); // Second pass: Find Z difference between non-ground points and the nearest // neighbor (2D) in the ground view. for (PointId i = 0; i < ngView->size(); ++i) { PointRef point = ngView->point(i); double z0 = point.getFieldAs<double>(Dimension::Id::Z); auto ids = kdi.neighbors(point, 1); double z1 = gView->getFieldAs<double>(Dimension::Id::Z, ids[0]); view.setField(Dimension::Id::HeightAboveGround, ngIdx[i], z0 - z1); } // Final pass: Ensure that all ground points have height value pegged at 0. for (auto const& i : gIdx) view.setField(Dimension::Id::HeightAboveGround, i, 0.0); }
PointViewSet RangeFilter::run(PointViewPtr inView) { PointViewSet viewSet; if (!inView->size()) return viewSet; PointViewPtr outView = inView->makeNew(); for (PointId i = 0; i < inView->size(); ++i) { PointRef point = inView->point(i); if (processOne(point)) outView->appendPoint(*inView, i); } viewSet.insert(outView); return viewSet; }
point_count_t SbetReader::read(PointViewPtr view, point_count_t count) { PointId nextId = view->size(); PointId idx = m_index; point_count_t numRead = 0; seek(idx); while (numRead < count && idx < m_numPts) { PointRef point = view->point(nextId); processOne(point); if (m_cb) m_cb(*view, nextId); idx++; nextId++; numRead++; } m_index = idx; return numRead; }