本文整理汇总了C++中PointViewPtr::toMetadata方法的典型用法代码示例。如果您正苦于以下问题:C++ PointViewPtr::toMetadata方法的具体用法?C++ PointViewPtr::toMetadata怎么用?C++ PointViewPtr::toMetadata使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointViewPtr
的用法示例。
在下文中一共展示了PointViewPtr::toMetadata方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: 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;
}