当前位置: 首页>>代码示例>>C++>>正文


C++ PointViewPtr::setPackedPoint方法代码示例

本文整理汇总了C++中PointViewPtr::setPackedPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ PointViewPtr::setPackedPoint方法的具体用法?C++ PointViewPtr::setPackedPoint怎么用?C++ PointViewPtr::setPackedPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PointViewPtr的用法示例。


在下文中一共展示了PointViewPtr::setPackedPoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: read

point_count_t GreyhoundReader::read(PointViewPtr view, point_count_t count)
{
    const std::string url(m_params.root() + "read" + m_params.qs());
    log()->get(LogLevel::Debug) << "Reading: " << url << std::endl;

    auto response(m_arbiter->getBinary(url));
    const std::size_t pointSize(view->layout()->pointSize());

    uint32_t numPoints(0);
    std::copy(
            response.data() + response.size() - sizeof(uint32_t),
            response.data() + response.size(),
            reinterpret_cast<char*>(&numPoints));

    log()->get(LogLevel::Debug) <<
        "Fetched " << numPoints << " points" << std::endl;
    log()->get(LogLevel::Debug) <<
        "Fetched " << response.size() << " bytes" << std::endl;

    response.resize(response.size() - sizeof(uint32_t));

    const auto dimTypes(m_readLayout.dimTypes());
#ifdef PDAL_HAVE_LAZPERF
    auto cb = [this, &view, &dimTypes](char *buf, size_t bufsize)
    {
        view->setPackedPoint(dimTypes, view->size(), buf);
        if (m_cb)
            m_cb(*view, view->size() - 1);
    };
    LazPerfDecompressor(cb, dimTypes, numPoints).
        decompress(response.data(), response.size());
#else
    const char* end(response.data() + response.size());
    for (const char* pos(response.data()); pos < end; pos += pointSize)
    {
        view->setPackedPoint(dimTypes, view->size(), pos);
        if (m_cb)
            m_cb(*view, view->size() - 1);
    }
#endif
    if (!m_params.obounds().isNull())
    {
        greyhound::Bounds obounds(m_params.obounds());
        greyhound::Point p;

        for (std::size_t i(0); i < view->size(); ++i)
        {
            p.x = view->getFieldAs<double>(Dimension::Id::X, i);
            p.y = view->getFieldAs<double>(Dimension::Id::Y, i);
            p.z = view->getFieldAs<double>(Dimension::Id::Z, i);

            if (!obounds.contains(p))
                view->setField(Dimension::Id::Omit, i, 1);
        }
    }

    for (std::size_t i(0); i < view->size(); ++i)
    {
        view->setField(Dimension::Id::PointId, i, i);
    }

    return numPoints;
}
开发者ID:chambbj,项目名称:PDAL,代码行数:63,代码来源:GreyhoundReader.cpp


注:本文中的PointViewPtr::setPackedPoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。