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

Method process

kernels/TileKernel.cpp:198–284  ·  view source on GitHub ↗

We calculate the origin specially in order to avoid a "first point" check for every point iteration, seeing as we might have BILLIONS of points to process.

Source from the content-addressed store, hash-verified

196// check for every point iteration, seeing as we might have BILLIONS
197// of points to process.
198void TileKernel::process(const Readers& readers)
199{
200 using std::placeholders::_1;
201 using std::placeholders::_2;
202 using std::placeholders::_3;
203 SplitterFilter::PointAdder adder =
204 std::bind(&TileKernel::adder, this, _1, _2, _3);
205
206 bool haveOrigin(false);
207 StageWrapper::ready(m_splitter, m_table);
208 for (auto&& rp : readers)
209 {
210 Streamable& r = *(rp.second);
211 std::vector<bool> skips(m_table.capacity());
212 PointId idx(0);
213 PointRef point(m_table, idx);
214
215 StreamableWrapper::ready(r, m_table);
216 if (m_repro)
217 StreamableWrapper::spatialReferenceChanged(*m_repro,
218 r.getSpatialReference());
219
220 // Read first point.
221 bool finished(false);
222 finished = !StreamableWrapper::processOne(r, point);
223 if (!haveOrigin && !finished)
224 {
225 if (std::isnan(m_xOrigin))
226 m_xOrigin = point.getFieldAs<double>(Dimension::Id::X);
227 if (std::isnan(m_yOrigin))
228 m_yOrigin = point.getFieldAs<double>(Dimension::Id::Y);
229 m_splitter.setOrigin(m_xOrigin, m_yOrigin);
230 haveOrigin = true;
231 }
232
233 idx++;
234
235 while (!finished)
236 {
237 // Read subsequent points.
238 while (true)
239 {
240 point.setPointId(idx);
241 finished = !StreamableWrapper::processOne(r, point);
242 if (finished || idx == m_table.capacity() - 1)
243 break;
244 idx++;
245 }
246
247 // "end" points just beyond the last valid point ID
248 PointId end = finished ? idx : m_table.capacity();
249
250 SpatialReference srs = r.getSpatialReference();
251 if (!srs.empty())
252 m_table.setSpatialReference(srs);
253 // Reproject if necessary.
254 if (m_repro)
255 {

Callers

nothing calls this directly

Calls 12

spatialReferenceChangedFunction · 0.85
processOneFunction · 0.85
getSpatialReferenceMethod · 0.80
setOriginMethod · 0.80
setPointIdMethod · 0.80
readyFunction · 0.50
doneFunction · 0.50
capacityMethod · 0.45
emptyMethod · 0.45
setSpatialReferenceMethod · 0.45
processPointMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected