本文整理汇总了C++中PointLayoutPtr::dims方法的典型用法代码示例。如果您正苦于以下问题:C++ PointLayoutPtr::dims方法的具体用法?C++ PointLayoutPtr::dims怎么用?C++ PointLayoutPtr::dims使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointLayoutPtr
的用法示例。
在下文中一共展示了PointLayoutPtr::dims方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
int DeltaKernel::execute()
{
PointTable srcTable;
PointTable candTable;
DimIndexMap dims;
PointViewPtr srcView = loadSet(m_sourceFile, srcTable);
PointViewPtr candView = loadSet(m_candidateFile, candTable);
PointLayoutPtr srcLayout = srcTable.layout();
PointLayoutPtr candLayout = candTable.layout();
Dimension::IdList ids = srcLayout->dims();
for (Dimension::Id dim : ids)
{
std::string name = srcLayout->dimName(dim);
if (!m_allDims)
if (name != "X" && name != "Y" && name != "Z")
continue;
DimIndex d;
d.m_name = name;
d.m_srcId = dim;
dims[name] = d;
}
ids = candLayout->dims();
for (Dimension::Id dim : ids)
{
std::string name = candLayout->dimName(dim);
auto di = dims.find(name);
if (di == dims.end())
continue;
DimIndex& d = di->second;
d.m_candId = dim;
}
// Remove dimensions that aren't in both the source and candidate lists.
for (auto di = dims.begin(); di != dims.end();)
{
DimIndex& d = di->second;
if (d.m_candId == Dimension::Id::Unknown)
dims.erase(di++);
else
++di;
}
// Index the candidate data.
KD3Index index(*candView);
index.build();
MetadataNode root;
if (m_detail)
root = dumpDetail(srcView, candView, index, dims);
else
root = dump(srcView, candView, index, dims);
Utils::toJSON(root, std::cout);
return 0;
}
示例2: toMetadata
inline MetadataNode toMetadata(PointTableRef table)
{
const PointLayoutPtr layout(table.layout());
MetadataNode root;
for (const auto& id : layout->dims())
{
MetadataNode dim("dimensions");
dim.add("name", layout->dimName(id));
Dimension::Type::Enum t = layout->dimType(id);
dim.add("type", Dimension::toName(Dimension::base(t)));
dim.add("size", layout->dimSize(id));
root.addList(dim);
}
return root;
}
示例3: loadBpfDimensions
void BpfWriter::loadBpfDimensions(PointLayoutPtr layout)
{
// Verify that we have X, Y and Z and that they're the first three
// dimensions.
Dimension::IdList dims = layout->dims();
std::sort(dims.begin(), dims.end());
if (dims.size() < 3 || dims[0] != Dimension::Id::X ||
dims[1] != Dimension::Id::Y || dims[2] != Dimension::Id::Z)
{
throw pdal_error("Missing one of dimensions X, Y or Z. "
"Can't write BPF.");
}
for (auto id : dims)
{
BpfDimension dim;
dim.m_id = id;
dim.m_label = layout->dimName(id);
m_dims.push_back(dim);
}
}
示例4: loadBpfDimensions
void BpfWriter::loadBpfDimensions(PointLayoutPtr layout)
{
Dimension::IdList dims;
if (m_outputDims.size())
{
for (std::string& s : m_outputDims)
{
Dimension::Id::Enum id = layout->findDim(s);
if (id == Dimension::Id::Unknown)
{
std::ostringstream oss;
oss << "Invalid dimension '" << s << "' specified for "
"'output_dims' option.";
throw pdal_error(oss.str());
}
dims.push_back(id);
}
}
else
dims = layout->dims();
// Verify that we have X, Y and Z and that they're the first three
// dimensions.
std::sort(dims.begin(), dims.end());
if (dims.size() < 3 || dims[0] != Dimension::Id::X ||
dims[1] != Dimension::Id::Y || dims[2] != Dimension::Id::Z)
{
throw pdal_error("Missing one of dimensions X, Y or Z. "
"Can't write BPF.");
}
for (auto id : dims)
{
BpfDimension dim;
dim.m_id = id;
dim.m_label = layout->dimName(id);
m_dims.push_back(dim);
}
}
示例5: dump
void PointView::dump(std::ostream& ostr) const
{
using std::endl;
PointLayoutPtr layout = m_pointTable.layout();
const Dimension::IdList& dims = layout->dims();
point_count_t numPoints = size();
ostr << "Contains " << numPoints << " points" << endl;
for (PointId idx = 0; idx < numPoints; idx++)
{
ostr << "Point: " << idx << endl;
for (auto di = dims.begin(); di != dims.end(); ++di)
{
Dimension::Id d = *di;
const Dimension::Detail *dd = layout->dimDetail(d);
ostr << Dimension::name(d) << " (" <<
Dimension::interpretationName(dd->type()) << ") : ";
switch (dd->type())
{
case Dimension::Type::Signed8:
{
ostr << (int)(getFieldInternal<int8_t>(d, idx));
break;
}
case Dimension::Type::Signed16:
{
ostr << getFieldInternal<int16_t>(d, idx);
break;
}
case Dimension::Type::Signed32:
{
ostr << getFieldInternal<int32_t>(d, idx);
break;
}
case Dimension::Type::Signed64:
{
ostr << getFieldInternal<int64_t>(d, idx);
break;
}
case Dimension::Type::Unsigned8:
{
ostr << (unsigned)(getFieldInternal<uint8_t>(d, idx));
break;
}
case Dimension::Type::Unsigned16:
{
ostr << getFieldInternal<uint16_t>(d, idx);
break;
}
case Dimension::Type::Unsigned32:
{
ostr << getFieldInternal<uint32_t>(d, idx);
break;
}
case Dimension::Type::Unsigned64:
{
ostr << getFieldInternal<uint64_t>(d, idx);
break;
}
case Dimension::Type::Float:
{
ostr << getFieldInternal<float>(d, idx);
break;
}
case Dimension::Type::Double:
{
ostr << getFieldInternal<double>(d, idx);
break;
}
default:
throw;
}
ostr << endl;
}
}
}