本文整理汇总了C++中PointViewPtr::layout方法的典型用法代码示例。如果您正苦于以下问题:C++ PointViewPtr::layout方法的具体用法?C++ PointViewPtr::layout怎么用?C++ PointViewPtr::layout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointViewPtr
的用法示例。
在下文中一共展示了PointViewPtr::layout方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
TEST(PtsReader, ReadPtsExtraDims)
{
PtsReader reader;
Options options;
options.add("filename", Support::datapath("pts/test.pts"));
reader.setOptions(options);
PointTable table;
reader.prepare(table);
PointViewSet viewSet = reader.execute(table);
EXPECT_EQ(viewSet.size(), 1u);
PointViewPtr view = *viewSet.begin();
EXPECT_EQ(view->size(), 19u);
PointLayout *layout = view->layout();
EXPECT_FLOAT_EQ(view->getFieldAs<float>(Dimension::Id::X, 0), 3.9809721f);
EXPECT_FLOAT_EQ(view->getFieldAs<float>(Dimension::Id::Y, 0), -2.006119f);
EXPECT_FLOAT_EQ(view->getFieldAs<float>(Dimension::Id::Z, 0), -0.010086f);
EXPECT_EQ(view->getFieldAs<int>(Dimension::Id::Red, 0), 97);
EXPECT_EQ(view->getFieldAs<int>(Dimension::Id::Green, 0), 59);
EXPECT_EQ(view->getFieldAs<int>(Dimension::Id::Blue, 0), 38);
}
示例2: read
point_count_t GreyhoundReader::read(PointViewPtr view, point_count_t count)
{
const std::string url(m_params.root() + "read" + m_params.qs());
log()->get(LogLevel::Debug) << "Reading: " << url << std::endl;
auto response(m_arbiter->getBinary(url));
const std::size_t pointSize(view->layout()->pointSize());
uint32_t numPoints(0);
std::copy(
response.data() + response.size() - sizeof(uint32_t),
response.data() + response.size(),
reinterpret_cast<char*>(&numPoints));
log()->get(LogLevel::Debug) <<
"Fetched " << numPoints << " points" << std::endl;
log()->get(LogLevel::Debug) <<
"Fetched " << response.size() << " bytes" << std::endl;
response.resize(response.size() - sizeof(uint32_t));
const auto dimTypes(m_readLayout.dimTypes());
#ifdef PDAL_HAVE_LAZPERF
auto cb = [this, &view, &dimTypes](char *buf, size_t bufsize)
{
view->setPackedPoint(dimTypes, view->size(), buf);
if (m_cb)
m_cb(*view, view->size() - 1);
};
LazPerfDecompressor(cb, dimTypes, numPoints).
decompress(response.data(), response.size());
#else
const char* end(response.data() + response.size());
for (const char* pos(response.data()); pos < end; pos += pointSize)
{
view->setPackedPoint(dimTypes, view->size(), pos);
if (m_cb)
m_cb(*view, view->size() - 1);
}
#endif
if (!m_params.obounds().isNull())
{
greyhound::Bounds obounds(m_params.obounds());
greyhound::Point p;
for (std::size_t i(0); i < view->size(); ++i)
{
p.x = view->getFieldAs<double>(Dimension::Id::X, i);
p.y = view->getFieldAs<double>(Dimension::Id::Y, i);
p.z = view->getFieldAs<double>(Dimension::Id::Z, i);
if (!obounds.contains(p))
view->setField(Dimension::Id::Omit, i, 1);
}
}
for (std::size_t i(0); i < view->size(); ++i)
{
view->setField(Dimension::Id::PointId, i, i);
}
return numPoints;
}