本文整理汇总了C++中PointViewPtr::getPackedPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ PointViewPtr::getPackedPoint方法的具体用法?C++ PointViewPtr::getPackedPoint怎么用?C++ PointViewPtr::getPackedPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointViewPtr
的用法示例。
在下文中一共展示了PointViewPtr::getPackedPoint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getBytes
std::vector<char> getBytes(PointViewPtr view)
{
std::vector<char> bytes(view->pointSize() * view->size());
DimTypeList dimTypes = view->dimTypes();
char *p = bytes.data();
for (PointId idx = 0; idx < view->size(); ++idx)
{
view->getPackedPoint(dimTypes, idx, p);
p += view->pointSize();
}
return bytes;
}
示例2: layout
TEST(Compression, simple)
{
const std::string file(Support::datapath("las/1.2-with-color.las"));
const pdal::Option opt_filename("filename", file);
pdal::Options opts;
opts.add(opt_filename);
LasReader reader;
reader.setOptions(opts);
PointTable table;
PointLayoutPtr layout(table.layout());
reader.prepare(table);
PointViewSet viewSet = reader.execute(table);
PointViewPtr view = *viewSet.begin();
EXPECT_EQ(layout->pointSize(), 52U);
std::vector<unsigned char> rawBuf;
DimTypeList dimTypes = layout->dimTypes();
auto cb = [&rawBuf](char *buf, size_t bufsize)
{
unsigned char *ubuf = reinterpret_cast<unsigned char *>(buf);
rawBuf.insert(rawBuf.end(), ubuf, ubuf + bufsize);
};
LazPerfCompressor compressor(cb, dimTypes);
std::vector<char> tmpbuf(layout->pointSize());
for (PointId idx = 0; idx < view->size(); ++idx)
{
view->getPackedPoint(dimTypes, idx, tmpbuf.data());
compressor.compress(tmpbuf.data(), layout->pointSize());
}
compressor.done();
EXPECT_EQ(view->size() * layout->pointSize(), (size_t)55380);
EXPECT_EQ(rawBuf.size(), (size_t)30945);
PointViewPtr otherView(new PointView(table));
PointId nextId(0);
auto cb2 = [&otherView, &dimTypes, &nextId](char *buf, size_t bufsize)
{
otherView->setPackedPoint(dimTypes, nextId, buf);
nextId++;
};
LazPerfDecompressor(cb2, dimTypes, view->size()).
decompress(reinterpret_cast<const char *>(rawBuf.data()),
rawBuf.size());
EXPECT_EQ(otherView->size(), 1065U);
EXPECT_EQ(getBytes(otherView).size(), (size_t)(52 * 1065));
uint16_t r = otherView->getFieldAs<uint16_t>(Dimension::Id::Red, 10);
EXPECT_EQ(r, 64U);
int32_t x = otherView->getFieldAs<int32_t>(Dimension::Id::X, 10);
EXPECT_EQ(x, 636038);
double xd = otherView->getFieldAs<double>(Dimension::Id::X, 10);
EXPECT_FLOAT_EQ(xd, 636037.53);
int32_t y = otherView->getFieldAs<int32_t>(Dimension::Id::Y, 10);
EXPECT_EQ(y, 849338);
}