Esempio n. 1
0
point_count_t OciReader::readPointMajor(PointView& view,
    BlockPtr block, point_count_t numPts)
{
    size_t numRemaining = block->numRemaining();
    PointId nextId = view.size();
    point_count_t numRead = 0;

    if (m_compression)
    {
#ifdef PDAL_HAVE_LAZPERF
        LazPerfBuf buf(block->chunk);
        LazPerfDecompressor<LazPerfBuf> decompressor(buf, dbDimTypes());

        std::vector<char> ptBuf(decompressor.pointSize());
        while (numRead < numPts && numRemaining > 0)
        {
            point_count_t numWritten =
                decompressor.decompress(ptBuf.data(), ptBuf.size());
            writePoint(view, nextId, ptBuf.data());
            if (m_cb)
                m_cb(view, nextId);
            numRemaining--;
            nextId++;
            numRead++;
        }
#else
        throw pdal_error("Can't decompress without LAZperf.");
#endif
    }
    else
    {
        char *pos = seekPointMajor(block);
        while (numRead < numPts && numRemaining > 0)
        {
            writePoint(view, nextId, pos);

            if (m_cb)
                m_cb(view, nextId);

            pos += packedPointSize();
            numRemaining--;
            nextId++;
            numRead++;
        }
    }
    block->setNumRemaining(numRemaining);
    return numRead;
}
Esempio n. 2
0
point_count_t OciReader::readPointMajor(PointView& view,
    BlockPtr block, point_count_t numPts)
{
    PointId nextId = view.size();
    point_count_t numRead = 0;

    if (m_compression)
    {
#ifdef PDAL_HAVE_LAZPERF
        auto cb = [this, &view, &nextId, &numRead](char *buf, size_t bufsize)
        {
            writePoint(view, nextId, buf);
            if (m_cb)
                m_cb(view, nextId);
            nextId++;
            numRead++;
        };
        const char *src = reinterpret_cast<const char *>(block->chunk.data());
        size_t srcsize = block->chunk.size();
        LazPerfDecompressor(cb, dbDimTypes(), block->numRemaining()).
            decompress(src, srcsize);
#else
        throwError("Can't decompress without LAZperf.");
#endif
    }
    else
    {
        char *pos = seekPointMajor(block);

        size_t cnt = block->numRemaining();
        while (numRead < numPts && cnt--)
        {
            writePoint(view, nextId, pos);

            if (m_cb)
                m_cb(view, nextId);

            pos += packedPointSize();
            nextId++;
            numRead++;
        }
    }
    block->setNumRemaining(block->numRemaining() - numRead);
    return numRead;
}
Esempio n. 3
0
point_count_t OciReader::readDimMajor(PointView& view, BlockPtr block,
    point_count_t numPts)
{
    using namespace Dimension;

    point_count_t numRemaining = block->numRemaining();
    PointId startId = view.size();
    point_count_t blockRemaining = numRemaining;
    point_count_t numRead = 0;

    DimTypeList dims = dbDimTypes();
    for (auto di = dims.begin(); di != dims.end(); ++di)
    {
        PointId nextId = startId;
        char *pos = seekDimMajor(*di, block);
        blockRemaining = numRemaining;
        numRead = 0;
        while (numRead < numPts && blockRemaining > 0)
        {
            writeField(view, pos, *di, nextId);
            pos += Dimension::size(di->m_type);

            if (di->m_id == Id::PointSourceId && m_updatePointSourceId)
                view.setField(Id::PointSourceId, nextId, block->obj_id);

            if (m_cb && di == dims.rbegin().base() - 1)
                m_cb(view, nextId);

            nextId++;
            numRead++;
            blockRemaining--;
        }
    }
    block->setNumRemaining(blockRemaining);
    return numRead;
}