本文整理汇总了C++中MetadataNode::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ MetadataNode::empty方法的具体用法?C++ MetadataNode::empty怎么用?C++ MetadataNode::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MetadataNode
的用法示例。
在下文中一共展示了MetadataNode::empty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: name
TEST(LasReaderTest, IgnoreVLRs)
{
PointTable table;
Options readOps;
readOps.add("filename", Support::datapath("las/lots_of_vlr.las"));
readOps.add("ignore_vlr", "Merrick");
LasReader reader;
reader.setOptions(readOps);
reader.prepare(table);
PointViewSet viewSet = reader.execute(table);
// First two VLRs are SRS info, the other 388 would be
// Merrick ones that we want to ignore/remove
MetadataNode root = reader.getMetadata();
for (size_t i = 2; i < 390; ++i)
{
std::string name("vlr_");
name += std::to_string(i);
MetadataNode m = root.findChild(name);
EXPECT_FALSE(!m.empty()) << "No node " << i;
m = m.findChild("data");
EXPECT_FALSE(!m.empty()) << "No value for node " << i;
}
}
示例2: findChild
MetadataNode findChild(std::string s) const
{
auto splitString = [](std::string& s) -> std::string
{
std::string val;
size_t pos = s.find(':');
if (pos == std::string::npos)
{
val = s;
s.clear();
}
else
{
val = s.substr(0, pos);
s = (pos == s.size() - 1) ? "" : s.substr(pos + 1);
}
return val;
};
if (s.empty())
return *this;
std::string lname = splitString(s);
auto nodes = children(lname);
for (auto ai = nodes.begin(); ai != nodes.end(); ++ai)
{
MetadataNode& n = *ai;
MetadataNode child = n.findChild(s);
if (!child.empty())
return child;
}
return MetadataNode();
}
示例3: find
MetadataNode find(PREDICATE p) const
{
if (p(*this))
return *this;
auto nodes = children();
for (auto ai = nodes.begin(); ai != nodes.end(); ++ai)
{
MetadataNode n = ai->find(p);
if (!n.empty())
return n;
}
return MetadataNode();
}
示例4: setSpatialReference
void Stage::setSpatialReference(MetadataNode& m,
const SpatialReference& spatialRef)
{
m_spatialReference = spatialRef;
auto pred = [](MetadataNode m){ return m.name() == "spatialreference"; };
MetadataNode spatialNode = m.findChild(pred);
if (spatialNode.empty())
{
m.add(Utils::toMetadata(spatialRef));
m.add("spatialreference",
spatialRef.getWKT(SpatialReference::eHorizontalOnly, false),
"SRS of this stage");
m.add("comp_spatialreference",
spatialRef.getWKT(SpatialReference::eCompoundOK, false),
"SRS of this stage");
}
}
示例5: 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);
}
}