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


C++ MetadataNode::findChildren方法代码示例

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


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

示例1: infile

// Make sure that we can forward the LAS_Spec/3 VLR
TEST(LasWriterTest, forward_spec_3)
{
    PointTable table;

    std::string infile(Support::datapath("las/spec_3.las"));
    std::string outfile(Support::temppath("out.las"));

    // remove file from earlier run, if needed
    FileUtils::deleteFile(outfile);

    Options readerOpts;
    readerOpts.add("filename", infile);

    Options writerOpts;
    writerOpts.add("forward", "all,vlr");
    writerOpts.add("filename", outfile);

    LasReader reader;
    reader.setOptions(readerOpts);

    LasWriter writer;
    writer.setOptions(writerOpts);
    writer.setInput(reader);

    writer.prepare(table);
    writer.execute(table);

    PointTable t2;
    Options readerOpts2;
    readerOpts2.add("filename", outfile);
    LasReader reader2;
    reader2.setOptions(readerOpts2);

    reader2.prepare(t2);
    reader2.execute(t2);

    auto pred = [](MetadataNode temp)
    {
        auto recPred = [](MetadataNode n)
        {
            return n.name() == "record_id" &&
                n.value() == "3";
        };

        auto userPred = [](MetadataNode n)
        {
            return n.name() == "user_id" &&
                n.value() == "LASF_Spec";
        };

        return Utils::startsWith(temp.name(), "vlr_") &&
            !temp.findChild(recPred).empty() &&
            !temp.findChild(userPred).empty();
    };
    MetadataNode root = reader2.getMetadata();
    MetadataNodeList nodes = root.findChildren(pred);
    EXPECT_EQ(nodes.size(), 1u);
}
开发者ID:PDAL,项目名称:PDAL,代码行数:59,代码来源:LasWriterTest.cpp

示例2:

TEST(LasWriterTest, forwardvlr)
{
    Options readerOps1;

    readerOps1.add("filename", Support::datapath("las/lots_of_vlr.las"));
    LasReader r1;
    r1.addOptions(readerOps1);

    std::string testfile = Support::temppath("tmp.las");
    FileUtils::deleteFile(testfile);

    Options writerOps;
    writerOps.add("forward", "vlr");
    writerOps.add("filename", testfile);

    LasWriter w;
    w.setInput(r1);
    w.addOptions(writerOps);

    PointTable t;

    w.prepare(t);
    w.execute(t);

    Options readerOps;
    readerOps.add("filename", testfile);

    LasReader r;

    r.setOptions(readerOps);

    PointTable t2;

    r.prepare(t2);
    r.execute(t2);

    MetadataNode forward = t2.privateMetadata("lasforward");

    auto pred = [](MetadataNode temp)
        { return Utils::startsWith(temp.name(), "vlr_"); };
    MetadataNodeList nodes = forward.findChildren(pred);
    EXPECT_EQ(nodes.size(), 388UL);
}
开发者ID:PDAL,项目名称:PDAL,代码行数:43,代码来源:LasWriterTest.cpp


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