Skip to content

Commit

Permalink
use mapDimensions and copyLikeDimensions to copy over buffer data ins…
Browse files Browse the repository at this point in the history
…tead of explicitly copying only X, Y, Z float dimensions
  • Loading branch information
hobu committed Jun 10, 2013
1 parent 72813cc commit 918693d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 21 deletions.
29 changes: 9 additions & 20 deletions src/drivers/buffer/Reader.cpp
Expand Up @@ -96,30 +96,19 @@ boost::uint32_t Reader::processBuffer(PointBuffer& data, boost::uint64_t index)
boost::uint64_t numPointsAvailable = getNumPoints() - index;
if (numPointsAvailable < numPointsWanted)
numPointsWanted = numPointsAvailable;

DimensionMap* d = PointBuffer::mapDimensions(m_buffer, data);

const Dimension& dimX = schema.getDimension("X");
const Dimension& dimY = schema.getDimension("Y");
const Dimension& dimZ = schema.getDimension("Z");

boost::uint32_t cnt = 0;
data.setNumPoints(0);

for (boost::uint32_t pointIndex=0; pointIndex<numPointsWanted; pointIndex++)
{
float x = m_buffer.getField<float>(dimX, pointIndex);
float y = m_buffer.getField<float>(dimY, pointIndex);
float z = m_buffer.getField<float>(dimZ, pointIndex);

data.setField<float>(dimX, pointIndex, x);
data.setField<float>(dimY, pointIndex, y);
data.setField<float>(dimZ, pointIndex, z);

++cnt;
data.setNumPoints(cnt);
assert(cnt <= data.getCapacity());
}
PointBuffer::copyLikeDimensions(m_buffer, data,
*d,
index,
0,
numPointsWanted);

return cnt;
data.setNumPoints(numPointsWanted);
return numPointsWanted;
}


Expand Down
2 changes: 1 addition & 1 deletion src/gitsha.cpp
@@ -1,3 +1,3 @@
#include <pdal/gitsha.h>
#define GIT_SHA1 "9703f2b4d21e4c0e01b41e03d9ccda49adaffd5e"
#define GIT_SHA1 "018e060b2900c224ce3da2e444ffc24e955603cf"
const char g_GIT_SHA1[] = GIT_SHA1;

0 comments on commit 918693d

Please sign in to comment.