void InPlaceReprojection::updateBounds(PointBuffer& buffer) { const Bounds<double>& oldBounds = buffer.getSpatialBounds(); double minx = oldBounds.getMinimum(0); double miny = oldBounds.getMinimum(1); double minz = oldBounds.getMinimum(2); double maxx = oldBounds.getMaximum(0); double maxy = oldBounds.getMaximum(1); double maxz = oldBounds.getMaximum(2); try { m_reprojectionFilter.transform(minx, miny, minz); m_reprojectionFilter.transform(maxx, maxy, maxz); } catch (pdal::pdal_error&) { return; } Bounds<double> newBounds(minx, miny, minz, maxx, maxy, maxz); buffer.setSpatialBounds(newBounds); return; }
boost::uint32_t ByteSwap::processBuffer(PointBuffer& dstData, const PointBuffer& srcData) const { const Schema& dstSchema = dstData.getSchema(); schema::index_by_index const& dstDims = dstSchema.getDimensions().get<schema::index>(); dstData.setSpatialBounds(srcData.getSpatialBounds()); dstData.copyPointsFast(0, 0, srcData, srcData.getNumPoints()); dstData.setNumPoints(srcData.getNumPoints()); for (boost::uint32_t i = 0; i != dstData.getNumPoints(); ++i) { boost::uint8_t* data = dstData.getData(i); std::size_t position = 0; for (boost::uint32_t n = 0; n < dstDims.size(); ++n) { const Dimension& d = dstSchema.getDimension(n); std::size_t size = d.getByteSize(); boost::uint8_t* pos = data + position; SWAP_ENDIANNESS_N(*pos, size); position = position + size; } } return dstData.getNumPoints(); }
Reader::Reader(const Options& options, const PointBuffer& buffer) : pdal::Reader(options) , m_buffer(buffer) { setNumPoints(buffer.getNumPoints()); setBounds(buffer.getSpatialBounds()); setSchema(buffer.getSchema()); setPointCountType(PointCount_Fixed); return; }