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

Method processBlock

io/GDALReader.cpp:251–295  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249}
250
251point_count_t GDALReader::BlockReader::processBlock(PointViewPtr view)
252{
253 if (!readBlock())
254 {
255 return 0;
256 }
257
258 point_count_t cnt = 0;
259
260 int readCol = m_currentBlock.m_blockCol * m_blockWidth;
261 int readRow = m_currentBlock.m_blockRow * m_blockHeight;
262
263 for (int rowInBlock = 0; rowInBlock < m_blockHeight; ++rowInBlock)
264 {
265 int row = rowInBlock + readRow;
266 // We need to check for invalid indices because block sizes don't
267 // have to divide the raster size evenly
268 if (row >= m_reader.m_height)
269 break;
270
271 int rowOffset = rowInBlock * m_blockWidth;
272 for (int colInBlock = 0; colInBlock < m_blockWidth; ++colInBlock)
273 {
274 int col = colInBlock + readCol;
275 // We need to check for invalid indices because block sizes don't
276 // have to divide the raster size evenly
277 if (col >= m_reader.m_width)
278 break;
279
280 PointRef point = view->point(view->size());
281 m_reader.m_raster->pixelToCoord(col, row, m_coords);
282 point.setField(Dimension::Id::X, m_coords[0]);
283 point.setField(Dimension::Id::Y, m_coords[1]);
284 for (size_t band = 0; band < m_currentBlock.m_data.size(); ++band)
285 {
286 Dimension::Id id = m_reader.m_bandIds[band];
287 point.setField(id, m_currentBlock.m_data.at(band).at(
288 rowOffset + colInBlock));
289 }
290 cnt++;
291 }
292 }
293
294 return cnt;
295}
296
297bool GDALReader::BlockReader::processOne(PointRef& point)
298{

Callers 1

readMethod · 0.80

Calls 5

pointMethod · 0.80
pixelToCoordMethod · 0.80
atMethod · 0.80
sizeMethod · 0.45
setFieldMethod · 0.45

Tested by

no test coverage detected