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


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

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


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

示例1: run

PointViewSet LocateFilter::run(PointViewPtr inView)
{
    PointViewSet viewSet;
    if (!inView->size())
        return viewSet;

    PointId minidx, maxidx;
    double minval = (std::numeric_limits<double>::max)();
    double maxval = std::numeric_limits<double>::lowest();

    for (PointId idx = 0; idx < inView->size(); idx++)
    {
        double val = inView->getFieldAs<double>(m_dimId, idx);
        if (val > maxval)
        {
            maxval = val;
            maxidx = idx;
        }
        if (val < minval)
        {
            minval = val;
            minidx = idx;
        }
    }

    PointViewPtr outView = inView->makeNew();

    if (Utils::iequals("min", m_minmax))
        outView->appendPoint(*inView.get(), minidx);
    if (Utils::iequals("max", m_minmax))
        outView->appendPoint(*inView.get(), maxidx);

    viewSet.insert(outView);
    return viewSet;
}
开发者ID:PDAL,项目名称:PDAL,代码行数:35,代码来源:LocateFilter.cpp

示例2: ignoreDimRange

void ignoreDimRange(DimRange dr, PointViewPtr input, PointViewPtr keep,
                    PointViewPtr ignore)
{
    PointRef point(*input, 0);
    for (PointId i = 0; i < input->size(); ++i)
    {
        point.setPointId(i);
        if (dr.valuePasses(point.getFieldAs<double>(dr.m_id)))
            ignore->appendPoint(*input, i);
        else
            keep->appendPoint(*input, i);
    }
}
开发者ID:pblottiere,项目名称:PDAL,代码行数:13,代码来源:Segmentation.cpp

示例3: segmentLastReturns

void segmentLastReturns(PointViewPtr input, PointViewPtr last,
                        PointViewPtr other)
{
    PointRef point(*input, 0);
    for (PointId i = 0; i < input->size(); ++i)
    {
        point.setPointId(i);
        if (point.getFieldAs<uint8_t>(Dimension::Id::ReturnNumber) ==
            point.getFieldAs<uint8_t>(Dimension::Id::NumberOfReturns))
            last->appendPoint(*input, i);
        else
            other->appendPoint(*input, i);
    }
}
开发者ID:pblottiere,项目名称:PDAL,代码行数:14,代码来源:Segmentation.cpp

示例4: run

PointViewSet PredicateFilter::run(PointViewPtr view)
{
    MetadataNode n;

    m_pythonMethod->resetArguments();
    m_pythonMethod->begin(*view, n);
    m_pythonMethod->execute();

    if (!m_pythonMethod->hasOutputVariable("Mask"))
        throw pdal::pdal_error("Mask variable not set in predicate "
            "filter function.");

    PointViewPtr outview = view->makeNew();

    void *pydata =
        m_pythonMethod->extractResult("Mask", Dimension::Type::Unsigned8);
    char *ok = (char *)pydata;
    for (PointId idx = 0; idx < view->size(); ++idx)
        if (*ok++)
            outview->appendPoint(*view, idx);

    PointViewSet viewSet;
    viewSet.insert(outview);
    return viewSet;
}
开发者ID:boundlessgeo,项目名称:PDAL,代码行数:25,代码来源:PredicateFilter.cpp

示例5: filter

void HAGFilter::filter(PointView& view)
{
    PointViewPtr gView = view.makeNew();
    PointViewPtr ngView = view.makeNew();
    std::vector<PointId> gIdx, ngIdx;

    // First pass: Separate into ground and non-ground views.
    for (PointId i = 0; i < view.size(); ++i)
    {
        double c = view.getFieldAs<double>(Dimension::Id::Classification, i);
        if (c == 2)
        {
            gView->appendPoint(view, i);
            gIdx.push_back(i);
        }
        else
        {
            ngView->appendPoint(view, i);
            ngIdx.push_back(i);
        }
    }

    // Bail if there weren't any points classified as ground.
    if (gView->size() == 0)
        throwError("Input PointView does not have any points classified "
            "as ground");

    // Build the 2D KD-tree.
    KD2Index kdi(*gView);
    kdi.build();

    // Second pass: Find Z difference between non-ground points and the nearest
    // neighbor (2D) in the ground view.
    for (PointId i = 0; i < ngView->size(); ++i)
    {
        PointRef point = ngView->point(i);
        double z0 = point.getFieldAs<double>(Dimension::Id::Z);
        auto ids = kdi.neighbors(point, 1);
        double z1 = gView->getFieldAs<double>(Dimension::Id::Z, ids[0]);
        view.setField(Dimension::Id::HeightAboveGround, ngIdx[i], z0 - z1);
    }

    // Final pass: Ensure that all ground points have height value pegged at 0.
    for (auto const& i : gIdx)
        view.setField(Dimension::Id::HeightAboveGround, i, 0.0);
}
开发者ID:pblottiere,项目名称:PDAL,代码行数:46,代码来源:HAGFilter.cpp

示例6: dumpQuery

MetadataNode InfoKernel::dumpQuery(PointViewPtr inView) const
{
    int count;
    std::string location;

    // See if there's a provided point count.
    StringList parts = Utils::split2(m_queryPoint, '/');
    if (parts.size() == 2)
    {
        location = parts[0];
        count = atoi(parts[1].c_str());
    }
    else if (parts.size() == 1)
    {
        location = parts[0];
        count = inView->size();
    }
    else
        count = 0;
    if (count == 0)
        throw pdal_error("Invalid location specificiation. "
            "--query=\"X,Y[/count]\"");

    auto seps = [](char c){ return (c == ',' || c == '|' || c == ' '); };

    std::vector<std::string> tokens = Utils::split2(location, seps);
    std::vector<double> values;
    for (auto ti = tokens.begin(); ti != tokens.end(); ++ti)
    {
        double d;
        if (Utils::fromString(*ti, d))
            values.push_back(d);
    }

    if (values.size() != 2 && values.size() != 3)
        throw pdal_error("--points must be two or three values");

    PointViewPtr outView = inView->makeNew();

    std::vector<PointId> ids;
    if (values.size() >= 3)
    {
        KD3Index kdi(*inView);
        kdi.build();
        ids = kdi.neighbors(values[0], values[1], values[2], count);
    }
    else
    {
        KD2Index kdi(*inView);
        kdi.build();
        ids = kdi.neighbors(values[0], values[1], count);
    }

    for (auto i = ids.begin(); i != ids.end(); ++i)
        outView->appendPoint(*inView.get(), *i);

    return outView->toMetadata();
}
开发者ID:lucadelu,项目名称:PDAL,代码行数:58,代码来源:InfoKernel.cpp

示例7: run

PointViewSet PMFFilter::run(PointViewPtr input)
{
    bool logOutput = log()->getLevel() > LogLevel::Debug1;
    if (logOutput)
        log()->floatPrecision(8);
    log()->get(LogLevel::Debug2) << "Process PMFFilter...\n";

    auto idx = processGround(input);

    PointViewSet viewSet;
    if (!idx.empty() && (m_classify || m_extract))
    {

        if (m_classify)
        {
            log()->get(LogLevel::Debug2) << "Labeled " << idx.size() << " ground returns!\n";

            // set the classification label of ground returns as 2
            // (corresponding to ASPRS LAS specification)
            for (const auto& i : idx)
            {
                input->setField(Dimension::Id::Classification, i, 2);
            }

            viewSet.insert(input);
        }

        if (m_extract)
        {
            log()->get(LogLevel::Debug2) << "Extracted " << idx.size() << " ground returns!\n";

            // create new PointView containing only ground returns
            PointViewPtr output = input->makeNew();
            for (const auto& i : idx)
            {
                output->appendPoint(*input, i);
            }

            viewSet.erase(input);
            viewSet.insert(output);
        }
    }
    else
    {
        if (idx.empty())
            log()->get(LogLevel::Debug2) << "Filtered cloud has no ground returns!\n";

        if (!(m_classify || m_extract))
            log()->get(LogLevel::Debug2) << "Must choose --classify or --extract\n";

        // return the input buffer unchanged
        viewSet.insert(input);
    }

    return viewSet;
}
开发者ID:EricAlex,项目名称:PDAL,代码行数:56,代码来源:PMFFilter.cpp

示例8: writeSavedPoints

point_count_t RxpPointcloud::writeSavedPoints(PointViewPtr view, point_count_t count)
{
    point_count_t numRead = 0;
    while (m_idx < m_view->size() && numRead < count)
    {
        view->appendPoint(*m_view, m_idx);
        ++m_idx, ++numRead;
    }
    return numRead;
};
开发者ID:connormanning,项目名称:PDAL,代码行数:10,代码来源:RxpPointcloud.cpp

示例9: run

PointViewSet SMRFilter::run(PointViewPtr view)
{
    log()->get(LogLevel::Info) << "run: Process SMRFilter...\n";

    std::vector<PointId> idx = processGround(view);

    PointViewSet viewSet;

    if (!idx.empty() && (m_classify || m_extract))
    {

        if (m_classify)
        {
            log()->get(LogLevel::Info) << "run: Labeled " << idx.size() << " ground returns!\n";

            // set the classification label of ground returns as 2
            // (corresponding to ASPRS LAS specification)
            for (const auto& i : idx)
            {
                view->setField(Dimension::Id::Classification, i, 2);
            }

            viewSet.insert(view);
        }

        if (m_extract)
        {
            log()->get(LogLevel::Info) << "run: Extracted " << idx.size() << " ground returns!\n";

            // create new PointView containing only ground returns
            PointViewPtr output = view->makeNew();
            for (const auto& i : idx)
            {
                output->appendPoint(*view, i);
            }

            viewSet.erase(view);
            viewSet.insert(output);
        }
    }
    else
    {
        if (idx.empty())
            log()->get(LogLevel::Info) << "run: Filtered cloud has no ground returns!\n";

        if (!(m_classify || m_extract))
            log()->get(LogLevel::Info) << "run: Must choose --classify or --extract\n";

        // return the view buffer unchanged
        viewSet.insert(view);
    }

    return viewSet;
}
开发者ID:PDAL,项目名称:PDAL,代码行数:54,代码来源:SMRFilter.cpp

示例10: run

 PointViewSet run(PointViewPtr view)
 {
     if (m_count > view->size())
         log()->get(LogLevel::Warning)
             << "Requested number of points (count=" << m_count
             << ") exceeds number of available points.\n";
     PointViewSet viewSet;
     PointViewPtr outView = view->makeNew();
     for (PointId i = view->size() - std::min(m_count, view->size());
          i < view->size(); ++i)
         outView->appendPoint(*view, i);
     viewSet.insert(outView);
     return viewSet;
 }
开发者ID:pblottiere,项目名称:PDAL,代码行数:14,代码来源:TailFilter.hpp

示例11: run

 virtual PointViewSet run(PointViewPtr view)
 {
     PointViewSet out;
     PointViewPtr v = view->makeNew();
     for (PointId i = 0; i < view->size(); ++i)
     {
         if (i && (i % m_viewSize == 0))
         {
             out.insert(v);
             v = v->makeNew();
         }
         v->appendPoint(*view, i);
     }
     out.insert(v);
     return out;
 }
开发者ID:Rafaelaniemann,项目名称:PDAL,代码行数:16,代码来源:OCITest.cpp

示例12: run

PointViewSet SampleFilter::run(PointViewPtr inView)
{
    point_count_t np = inView->size();

    // Return empty PointViewSet if the input PointView has no points.
    // Otherwise, make a new output PointView.
    PointViewSet viewSet;
    if (!np)
        return viewSet;
    PointViewPtr outView = inView->makeNew();

    // Build the 3D KD-tree.
    KD3Index index(*inView);
    index.build();

    // All points are marked as kept (1) by default. As they are masked by
    // neighbors within the user-specified radius, their value is changed to 0.
    std::vector<int> keep(np, 1);

    // We are able to subsample in a single pass over the shuffled indices.
    for (PointId i = 0; i < np; ++i)
    {
        // If a point is masked, it is forever masked, and cannot be part of the
        // sampled cloud. Otherwise, the current index is appended to the output
        // PointView.
        if (keep[i] == 0)
            continue;
        outView->appendPoint(*inView, i);

        // We now proceed to mask all neighbors within m_radius of the kept
        // point.
        auto ids = index.radius(i, m_radius);
        for (auto const& id : ids)
            keep[id] = 0;
    }

    // Simply calculate the percentage of retained points.
    double frac = (double)outView->size() / (double)inView->size();
    log()->get(LogLevel::Debug2)
        << "Retaining " << outView->size() << " of " << inView->size()
        << " points (" << 100 * frac << "%)\n";

    viewSet.insert(outView);
    return viewSet;
}
开发者ID:pblottiere,项目名称:PDAL,代码行数:45,代码来源:SampleFilter.cpp

示例13: run

PointViewSet RangeFilter::run(PointViewPtr inView)
{
    PointViewSet viewSet;
    if (!inView->size())
        return viewSet;

    PointViewPtr outView = inView->makeNew();

    for (PointId i = 0; i < inView->size(); ++i)
    {
        PointRef point = inView->point(i);
        if (processOne(point))
            outView->appendPoint(*inView, i);
    }

    viewSet.insert(outView);
    return viewSet;
}
开发者ID:pblottiere,项目名称:PDAL,代码行数:18,代码来源:RangeFilter.cpp

示例14: dumpPoints

MetadataNode InfoKernel::dumpPoints(PointViewPtr inView) const
{
    MetadataNode root;
    PointViewPtr outView = inView->makeNew();

    // Stick points in a inViewfer.
    std::vector<PointId> points = getListOfPoints(m_pointIndexes);
    for (size_t i = 0; i < points.size(); ++i)
    {
        PointId id = (PointId)points[i];
        if (id < inView->size())
            outView->appendPoint(*inView.get(), id);
    }

    MetadataNode tree = outView->toMetadata();
    std::string prefix("point ");
    for (size_t i = 0; i < outView->size(); ++i)
    {
        MetadataNode n = tree.findChild(std::to_string(i));
        n.add("PointId", points[i]);
        root.add(n.clone("point"));
    }
    return root;
}
开发者ID:lucadelu,项目名称:PDAL,代码行数:24,代码来源:InfoKernel.cpp

示例15: doQuery

void RialtoReader::doQuery(const TileMath& tmm,
                           const GpkgTile& tile,
                           PointViewPtr view,
                           double qMinX, double qMinY, double qMaxX, double qMaxY)
{
    const uint32_t level = tile.getLevel();
    const uint32_t column = tile.getColumn();
    const uint32_t row = tile.getRow();
    const uint32_t numPoints = tile.getNumPoints();
    
    // if this tile is entirely inside the query box, then
    // we won't need to check each point
    double tileMinX, tileMinY, tileMaxX, tileMaxY;
    tmm.getTileBounds(column, row, level,
                      tileMinX, tileMinY, tileMaxX, tileMaxY);
    const bool tileEntirelyInsideQueryBox =
        tmm.rectContainsRect(qMinX, qMinY, qMaxX, qMaxY,
                             tileMinX, tileMinY, tileMaxX, tileMaxY);

    log()->get(LogLevel::Debug) << "  intersecting tile "
        << "(" << level << "," << column << "," << row << ")" 
        << " contains " << numPoints << " points" << std::endl;

    PointViewPtr tempView = view->makeNew();

    GpkgTile::exportToPV(numPoints, tempView, tile.getBlob());

    for (uint32_t i=0; i<tempView->size(); i++) {
        const double x = tempView->getFieldAs<double>(Dimension::Id::X, i);
        const double y = tempView->getFieldAs<double>(Dimension::Id::Y, i);
        if (tileEntirelyInsideQueryBox || (x >= qMinX && x <= qMaxX && y >= qMinY && y <= qMaxY))
        {
            view->appendPoint(*tempView, i);
        }
    }
}
开发者ID:mamayoleksandr,项目名称:rialto-geopackage,代码行数:36,代码来源:RialtoReader.cpp


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