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


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

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


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

示例1: toPTree

inline ptree toPTree(MetadataNode const& node)
{
    typedef ptree::path_type path;

    ptree tree;
    tree.put("name", node.name());
    tree.put("description", node.description());
    tree.put("type", node.type());
    tree.put("value", node.value());

    MetadataNodeList children = node.children();
    for (auto n = children.begin(); n != children.end(); ++n)
    {
        ptree pnode = toPTree(*n);
        if (node.kind() == MetadataType::Array)
        {
            boost::optional<ptree&> opt =
                tree.get_child_optional(path(node.name(), '/'));
            if (opt)
                opt->push_back(std::make_pair("", pnode));
            else
            {
                tree.push_back(ptree::value_type(node.name(), ptree()));
                auto& p = tree.get_child(path(node.name(), '/'));
                p.push_back(std::make_pair("", pnode));

            }
        }
        else if (node.name().size())
            tree.push_back(std::make_pair(node.name(), pnode));
    }
    return tree;
}
开发者ID:adam-erickson,项目名称:PDAL,代码行数:33,代码来源:PDALUtils.hpp

示例2: bounds

TEST(Stats, metadata)
{
    BOX3D bounds(1.0, 2.0, 3.0, 101.0, 102.0, 103.0);
    Options ops;
    ops.add("bounds", bounds);
    ops.add("count", 1000);
    ops.add("mode", "constant");

    StageFactory f;
    std::unique_ptr<Stage> reader(f.createStage("readers.faux"));
    EXPECT_TRUE(reader.get());
    reader->setOptions(ops);

    Options filterOps;
    filterOps.add("dimensions", " , X, Z ");
    StatsFilter filter;
    filter.setInput(*reader);
    filter.setOptions(filterOps);

    PointTable table;
    filter.prepare(table);
    filter.execute(table);
    MetadataNode m = filter.getMetadata();
    std::vector<MetadataNode> children = m.children("statistic");

    auto findNode = [](MetadataNode m,
        const std::string name, const std::string val)
    {
        auto findNameVal = [name, val](MetadataNode m)
            { return (m.name() == name && m.value() == val); };

        return m.find(findNameVal);
    };

    for (auto mi = children.begin(); mi != children.end(); ++mi)
    {
        if (findNode(*mi, "name", "X").valid())
        {
            EXPECT_DOUBLE_EQ(mi->findChild("average").value<double>(), 1.0);
            EXPECT_DOUBLE_EQ(mi->findChild("minimum").value<double>(), 1.0);
            EXPECT_DOUBLE_EQ(mi->findChild("maximum").value<double>(), 1.0);
            EXPECT_DOUBLE_EQ(mi->findChild("count").value<double>(), 1000.0);
        }
        if (findNode(*mi, "name", "Z").valid())
        {
            EXPECT_DOUBLE_EQ(mi->findChild("average").value<double>(), 3.0);
            EXPECT_DOUBLE_EQ(mi->findChild("minimum").value<double>(), 3.0);
            EXPECT_DOUBLE_EQ(mi->findChild("maximum").value<double>(), 3.0);
            EXPECT_DOUBLE_EQ(mi->findChild("count").value<double>(), 1000.0);
        }
    }
}
开发者ID:mpgerlek,项目名称:PDAL-old,代码行数:52,代码来源:StatsFilterTest.cpp

示例3: getFileInfo

TIndexKernel::FileInfo TIndexKernel::getFileInfo(KernelFactory& factory,
    const std::string& filename)
{
    FileInfo fileInfo;

    PipelineManager manager;
    manager.commonOptions() = m_manager.commonOptions();
    manager.stageOptions() = m_manager.stageOptions();

    // Need to make sure options get set.
    Stage& reader = manager.makeReader(filename, "");

    if (m_fastBoundary)
    {
        QuickInfo qi = reader.preview();

        std::stringstream polygon;
        polygon << "POLYGON ((";

        polygon <<         qi.m_bounds.minx << " " << qi.m_bounds.miny;
        polygon << ", " << qi.m_bounds.maxx << " " << qi.m_bounds.miny;
        polygon << ", " << qi.m_bounds.maxx << " " << qi.m_bounds.maxy;
        polygon << ", " << qi.m_bounds.minx << " " << qi.m_bounds.maxy;
        polygon << ", " << qi.m_bounds.minx << " " << qi.m_bounds.miny;
        polygon << "))";
        fileInfo.m_boundary = polygon.str();
        if (!qi.m_srs.empty())
            fileInfo.m_srs = qi.m_srs.getWKT();
    }
    else
    {
        Stage& hexer = manager.makeFilter("filters.hexbin", reader);

        PointTable table;
        hexer.prepare(table);
        PointViewSet set = hexer.execute(table);

        MetadataNode m = table.metadata();
        m = m.findChild("filters.hexbin:boundary");
        fileInfo.m_boundary = m.value();

        PointViewPtr v = *set.begin();
        if (!v->spatialReference().empty())
            fileInfo.m_srs = v->spatialReference().getWKT();
    }

    FileUtils::fileTimes(filename, &fileInfo.m_ctime, &fileInfo.m_mtime);
    fileInfo.m_filename = filename;

    return fileInfo;
}
开发者ID:jasonoverland,项目名称:PDAL,代码行数:51,代码来源:TIndexKernel.cpp

示例4: setVlrsFromMetadata

/// Set VLRs from metadata for forwarded info, or from option-provided data
/// otherwise.
void LasWriter::setVlrsFromMetadata()
{
    std::vector<uint8_t> data;

    for (auto oi = m_optionInfos.begin(); oi != m_optionInfos.end(); ++oi)
    {
        VlrOptionInfo& vlrInfo = *oi;

        if (vlrInfo.m_name == "FORWARD")
        {
            MetadataNode m = findVlrMetadata(m_metadata, vlrInfo.m_recordId,
                vlrInfo.m_userId);
            if (m.empty())
                continue;
            data = Utils::base64_decode(m.value());
        }
        else
            data = Utils::base64_decode(vlrInfo.m_value);
        addVlr(vlrInfo.m_userId, vlrInfo.m_recordId, vlrInfo.m_description,
            data);
    }
}
开发者ID:klassenjs,项目名称:PDAL,代码行数:24,代码来源:LasWriter.cpp

示例5: nitf_reader

TEST(NitfReaderTest, test_one)
{
    StageFactory f;

    Options nitf_opts;
    nitf_opts.add("filename", Support::datapath("nitf/autzen-utm10.ntf"));
    nitf_opts.add("count", 750);

    PointTable table;

    Stage* nitf_reader(f.createStage("readers.nitf"));
    EXPECT_TRUE(nitf_reader);
    nitf_reader->setOptions(nitf_opts);
    nitf_reader->prepare(table);
    PointViewSet pbSet = nitf_reader->execute(table);
    EXPECT_EQ(pbSet.size(), 1u);
    PointViewPtr view = *pbSet.begin();

    // check metadata
    MetadataNode m = nitf_reader->getMetadata();
    MetadataNode n = m.findChild(
    [](MetadataNode& m) {
        return m.name() == "IM:0.IGEOLO";
    }
                     );
    EXPECT_EQ(n.value(),
              "440344N1230429W440344N1230346W440300N1230346W440300N1230429W");
    n = m.findChild("FH.FDT");
    EXPECT_EQ(n.value(), "20120323002946");

    //
    // read LAS
    //
    Options las_opts;
    las_opts.add("count", 750);
    las_opts.add("filename", Support::datapath("nitf/autzen-utm10.las"));

    PointTable table2;

    Stage* las_reader(f.createStage("readers.las"));
    EXPECT_TRUE(las_reader);
    las_reader->setOptions(las_opts);
    las_reader->prepare(table2);
    PointViewSet pbSet2 = las_reader->execute(table2);
    EXPECT_EQ(pbSet2.size(), 1u);
    PointViewPtr view2 = *pbSet.begin();
    //
    //
    // compare the two views
    //
    EXPECT_EQ(view->size(), view2->size());

    for (PointId i = 0; i < view2->size(); i++)
    {
        int32_t nitf_x = view->getFieldAs<int32_t>(Dimension::Id::X, i);
        int32_t nitf_y = view->getFieldAs<int32_t>(Dimension::Id::Y, i);
        int32_t nitf_z = view->getFieldAs<int32_t>(Dimension::Id::Z, i);

        int32_t las_x = view2->getFieldAs<int32_t>(Dimension::Id::X, i);
        int32_t las_y = view2->getFieldAs<int32_t>(Dimension::Id::Y, i);
        int32_t las_z = view2->getFieldAs<int32_t>(Dimension::Id::Z, i);

        EXPECT_EQ(nitf_x, las_x);
        EXPECT_EQ(nitf_y, las_y);
        EXPECT_EQ(nitf_z, las_z);
    }
}
开发者ID:gadomski,项目名称:PDAL,代码行数:67,代码来源:NitfReaderTest.cpp

示例6: getFileInfo

TIndexKernel::FileInfo TIndexKernel::getFileInfo(KernelFactory& factory,
    const std::string& filename)
{
    FileInfo fileInfo;

    StageFactory f;

    std::string driverName = f.inferReaderDriver(filename);
    Stage *s = f.createStage(driverName);
    Options ops;
    ops.add("filename", filename);
    setCommonOptions(ops);
    s->setOptions(ops);
    applyExtraStageOptionsRecursive(s);
    if (m_fastBoundary)
    {
        QuickInfo qi = s->preview();

        std::stringstream polygon;
        polygon << "POLYGON ((";

        polygon <<         qi.m_bounds.minx << " " << qi.m_bounds.miny;
        polygon << ", " << qi.m_bounds.maxx << " " << qi.m_bounds.miny;
        polygon << ", " << qi.m_bounds.maxx << " " << qi.m_bounds.maxy;
        polygon << ", " << qi.m_bounds.minx << " " << qi.m_bounds.maxy;
        polygon << ", " << qi.m_bounds.minx << " " << qi.m_bounds.miny;
        polygon << "))";
        fileInfo.m_boundary = polygon.str();
        if (!qi.m_srs.empty())
            fileInfo.m_srs = qi.m_srs.getWKT();
    }
    else
    {
        PointTable table;

        Stage *hexer = f.createStage("filters.hexbin");
        if (! hexer)
        {

            std::ostringstream oss;

            oss << "Unable to create hexer stage to create boundaries. "
                << "Is PDAL_DRIVER_PATH environment variable set?";
            throw pdal_error(oss.str());
        }
        hexer->setInput(*s);

        hexer->prepare(table);
        PointViewSet set = hexer->execute(table);

        MetadataNode m = table.metadata();
        m = m.findChild("filters.hexbin:boundary");
        fileInfo.m_boundary = m.value();

        PointViewPtr v = *set.begin();
        if (!v->spatialReference().empty())
            fileInfo.m_srs = v->spatialReference().getWKT();
    }

    FileUtils::fileTimes(filename, &fileInfo.m_ctime, &fileInfo.m_mtime);
    fileInfo.m_filename = filename;

    return fileInfo;
}
开发者ID:marops,项目名称:PDAL,代码行数:64,代码来源:TIndexKernel.cpp


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