本文整理汇总了C++中Chunk::acquire方法的典型用法代码示例。如果您正苦于以下问题:C++ Chunk::acquire方法的具体用法?C++ Chunk::acquire怎么用?C++ Chunk::acquire使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chunk
的用法示例。
在下文中一共展示了Chunk::acquire方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cellStack
std::vector<char> buildData(Chunk& chunk) const
{
Cell::PooledStack cellStack(chunk.acquire());
Data::PooledStack dataStack(chunk.pool().dataPool());
for (Cell& cell : cellStack) dataStack.push(cell.acquire());
cellStack.release();
const std::size_t pointSize(chunk.schema().pointSize());
std::vector<char> data;
data.reserve(
dataStack.size() * pointSize +
buildTail(chunk, dataStack.size()).size());
for (const char* d : dataStack)
{
data.insert(data.end(), d, d + pointSize);
}
return data;
}
示例2: write
void LasZipStorage::write(Chunk& chunk) const
{
Cell::PooledStack cellStack(chunk.acquire());
const Schema& schema(chunk.schema());
if (!m_metadata.delta())
{
throw std::runtime_error("Laszip storage requires scaling.");
}
const Delta& delta(*m_metadata.delta());
CellTable cellTable(
chunk.pool(),
std::move(cellStack),
makeUnique<Schema>(Schema::normalize(schema)));
StreamReader reader(cellTable);
const auto& outEndpoint(chunk.builder().outEndpoint());
const auto& tmpEndpoint(chunk.builder().tmpEndpoint());
const std::string localDir = outEndpoint.isLocal() ?
outEndpoint.prefixedRoot() : tmpEndpoint.prefixedRoot();
const std::string filename(m_metadata.basename(chunk.id()) + ".laz");
const auto offset = Point::unscale(
chunk.bounds().mid(),
delta.scale(),
delta.offset())
.apply([](double d) { return std::floor(d); });
// See https://www.pdal.io/stages/writers.las.html
uint64_t timeMask(schema.hasTime() ? 1 : 0);
uint64_t colorMask(schema.hasColor() ? 2 : 0);
pdal::Options options;
options.add("filename", localDir + filename);
options.add("minor_version", 4);
options.add("extra_dims", "all");
options.add("software_id", "Entwine " + currentVersion().toString());
options.add("compression", "laszip");
options.add("dataformat_id", timeMask | colorMask);
options.add("scale_x", delta.scale().x);
options.add("scale_y", delta.scale().y);
options.add("scale_z", delta.scale().z);
options.add("offset_x", offset.x);
options.add("offset_y", offset.y);
options.add("offset_z", offset.z);
if (auto r = m_metadata.reprojection()) options.add("a_srs", r->out());
else if (m_metadata.srs().size()) options.add("a_srs", m_metadata.srs());
auto lock(Executor::getLock());
pdal::LasWriter writer;
writer.setOptions(options);
writer.setInput(reader);
writer.prepare(cellTable);
lock.unlock();
writer.execute(cellTable);
if (!outEndpoint.isLocal())
{
io::ensurePut(outEndpoint, filename, tmpEndpoint.getBinary(filename));
arbiter::fs::remove(tmpEndpoint.prefixedRoot() + filename);
}
}