本文整理汇总了C++中PointTableRef::layout方法的典型用法代码示例。如果您正苦于以下问题:C++ PointTableRef::layout方法的具体用法?C++ PointTableRef::layout怎么用?C++ PointTableRef::layout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointTableRef
的用法示例。
在下文中一共展示了PointTableRef::layout方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ready
void AttributeFilter::ready(PointTableRef table)
{
m_gdal_debug = std::shared_ptr<pdal::gdal::Debug>(
new pdal::gdal::Debug(isDebug(), log()));
for (auto& dim_par : m_dimensions)
{
Dimension::Id::Enum t = table.layout()->findDim(dim_par.first);
dim_par.second.dim = t;
if (dim_par.second.isogr)
{
OGRDSPtr ds = OGRDSPtr(OGROpen(dim_par.second.datasource.c_str(), 0, 0), OGRDataSourceDeleter());
if (!ds)
{
std::ostringstream oss;
oss << "Unable to open data source '" << dim_par.second.datasource <<"'";
throw pdal_error(oss.str());
}
dim_par.second.ds = ds;
}
}
}
示例2: prepared
void LocateFilter::prepared(PointTableRef table)
{
PointLayoutPtr layout(table.layout());
m_dimId = layout->findDim(m_dimName);
if (m_dimId == Dimension::Id::Unknown)
throwError("Invalid dimension '" + m_dimName + "'.");
}
示例3: ready
void ColorizationFilter::ready(PointTableRef table)
{
m_forward_transform.assign(0.0);
m_inverse_transform.assign(0.0);
log()->get(LogLevel::Debug) << "Using " << m_rasterFilename <<
" for raster" << std::endl;
m_ds = GDALOpen(m_rasterFilename.c_str(), GA_ReadOnly);
if (m_ds == NULL)
throw pdal_error("Unable to open GDAL datasource!");
if (GDALGetGeoTransform(m_ds, &(m_forward_transform.front())) != CE_None)
throw pdal_error("unable to fetch forward geotransform for raster!");
if (!GDALInvGeoTransform(&(m_forward_transform.front()),
&(m_inverse_transform.front())))
throw pdal_error("unable to fetch inverse geotransform for raster!");
for (auto bi = m_bands.begin(); bi != m_bands.end(); ++bi)
{
if (bi->m_dim == Dimension::Id::Unknown)
bi->m_dim = table.layout()->findDim(bi->m_name);
if (bi->m_dim == Dimension::Id::Unknown)
throw pdal_error((std::string)"Can't colorize - no dimension " +
bi->m_name);
}
}
示例4: prepared
// Build the list of dimensions for the output schema.
// Placing this here allows validation of dimensions before execution begins.
void DbWriter::prepared(PointTableRef table)
{
using namespace Dimension;
PointLayoutPtr layout = table.layout();
if (m_outputDims.empty())
{
for (auto& dimType : layout->dimTypes())
m_dbDims.push_back(XMLDim(dimType, layout->dimName(dimType.m_id)));
return;
}
DimTypeList dims;
for (std::string& s : m_outputDims)
{
DimType dt = layout->findDimType(s);
if (dt.m_id == Id::Unknown)
{
std::ostringstream oss;
oss << "Invalid dimension '" << s << "' specified for "
"'output_dims' option.";
throw pdal_error(oss.str());
}
m_dbDims.push_back(XMLDim(dt, layout->dimName(dt.m_id)));
}
}
示例5: done
// Deferring write until this time allows both points and faces from multiple
// point views to be written.
void PlyWriter::done(PointTableRef table)
{
for (auto& v : m_views)
{
PointRef point(*v, 0);
for (PointId idx = 0; idx < v->size(); ++idx)
{
point.setPointId(idx);
writePoint(point, table.layout());
}
}
if (m_faces)
{
PointId offset = 0;
for (auto& v : m_views)
{
TriangularMesh *mesh = v->mesh();
if (mesh)
{
for (size_t id = 0; id < mesh->size(); ++id)
{
const Triangle& t = (*mesh)[id];
writeTriangle(t, offset);
}
}
offset += v->size();
}
}
Utils::closeFile(m_stream);
m_stream = nullptr;
getMetadata().addList("filename", m_filename);
}
示例6: prepared
void GroupByFilter::prepared(PointTableRef table)
{
PointLayoutPtr layout(table.layout());
m_dimId = layout->findDim(m_dimName);
if (m_dimId == Dimension::Id::Unknown)
throwError("Invalid dimension name '" + m_dimName + "'.");
// also need to check that we have a dimension with discrete values
}
示例7: ready
void GeoWaveWriter::ready(PointTableRef table)
{
// get a list of all the dimensions & their types
Dimension::IdList all = table.layout()->dims();
for (auto di = all.begin(); di != all.end(); ++di)
if (!Utils::contains(m_dims, *di))
m_dims.push_back(*di);
}
示例8: ready
void FerryFilter::ready(PointTableRef table)
{
const PointLayoutPtr layout(table.layout());
for (const auto& dim_par : m_name_map)
{
Dimension::Id f = layout->findDim(dim_par.first);
Dimension::Id t = layout->findDim(dim_par.second);
m_dimensions_map.insert(std::make_pair(f,t));
}
}
示例9: ready
void PlyWriter::ready(PointTableRef table)
{
if (pointCount() > std::numeric_limits<uint32_t>::max())
throwError("Can't write PLY file. Only " +
std::to_string(std::numeric_limits<uint32_t>::max()) +
" points supported.");
m_stream = Utils::createFile(m_filename, true);
writeHeader(table.layout());
}
示例10: prepared
void FerryFilter::prepared(PointTableRef table)
{
for (auto& info : m_dims)
{
info.m_fromId = table.layout()->findDim(info.m_fromName);
if (info.m_fromId == Dimension::Id::Unknown && info.m_fromName.size())
throwError("Can't ferry dimension '" + info.m_fromName + "'. "
"Dimension doesn't exist.");
}
}
示例11: prepared
void AttributeFilter::prepared(PointTableRef table)
{
m_dim = table.layout()->findDim(m_dimName);
if (m_dim == Dimension::Id::Unknown)
{
std::ostringstream oss;
oss << getName() << ": Dimension '" << m_dimName << "' not found.";
throw pdal_error(oss.str());
}
}
示例12: execute
PointViewSet Stage::execute(PointTableRef table)
{
//printf("called %s\n", this->classname());
log()->setLevel(LogLevel::Enum::Debug);
std::string cn(this->classname());
log()->setLeader(cn + " Stage::execute");
log()->get(LogLevel::Debug) << "Called by class " << std::endl;
table.layout()->finalize();
PointViewSet views;
if (m_inputs.empty())
{
log()->get(LogLevel::Debug) << "if block, class" << std::endl;
views.insert(PointViewPtr(new PointView(table)));
}
else
{
for (size_t i = 0; i < m_inputs.size(); ++i)
{
log()->get(LogLevel::Debug) << "block, class"
<< "input number "<< i << std::endl;
log()->get(LogLevel::Debug) << "if block, class" << std::endl;
Stage *prev = m_inputs[i];
PointViewSet temp = prev->execute(table);
views.insert(temp.begin(), temp.end());
}
}
PointViewSet outViews;
std::vector<StageRunnerPtr> runners;
ready(table);
for (auto const& it : views)
{
log()->get(LogLevel::Debug) << "run, class" << std::endl;
StageRunnerPtr runner(new StageRunner(this, it));
runners.push_back(runner);
runner->run();
}
for (auto const& it : runners)
{
log()->get(LogLevel::Debug) << "wait, class" << std::endl;
StageRunnerPtr runner(it);
PointViewSet temp = runner->wait();
outViews.insert(temp.begin(), temp.end());
}
l_done(table);
done(table);
return outViews;
}
示例13: prepared
void FerryFilter::prepared(PointTableRef table)
{
for (const auto& dims : m_name_map)
if (table.layout()->findDim(dims.first) == Dimension::Id::Unknown)
{
std::ostringstream oss;
oss << "Can't ferry dimension '" << dims.first << "'. "
"Dimension doesn't exist.";
throw pdal_error(oss.str());
}
}
示例14: prepared
void PlyWriter::prepared(PointTableRef table)
{
if (m_dimNames.size())
{
for (auto& name : m_dimNames)
{
auto id = table.layout()->findDim(name);
if (id == Dimension::Id::Unknown)
throwError("Unknown dimension '" + name + "' in provided "
"dimension list.");
m_dims.push_back(id);
}
}
else
{
m_dims = table.layout()->dims();
for (auto dim : m_dims)
m_dimNames.push_back(Utils::tolower(table.layout()->dimName(dim)));
}
}
示例15: done
void PlyWriter::done(PointTableRef table)
{
if (!ply_add_element(m_ply, "vertex", m_pointCollector->size()))
{
std::stringstream ss;
ss << "Could not add vertex element";
throw pdal_error(ss.str());
}
auto dimensions = table.layout()->dims();
for (auto dim : dimensions) {
std::string name = Dimension::name(dim);
e_ply_type plyType = getPlyType(Dimension::defaultType(dim));
if (!ply_add_scalar_property(m_ply, name.c_str(), plyType))
{
std::stringstream ss;
ss << "Could not add scalar property '" << name << "'";
throw pdal_error(ss.str());
}
}
if (!ply_add_comment(m_ply, "Generated by PDAL"))
{
std::stringstream ss;
ss << "Could not add comment";
throw pdal_error(ss.str());
}
if (!ply_write_header(m_ply))
{
std::stringstream ss;
ss << "Could not write ply header";
throw pdal_error(ss.str());
}
for (PointId index = 0; index < m_pointCollector->size(); ++index)
{
for (auto dim : dimensions)
{
double value = m_pointCollector->getFieldAs<double>(dim, index);
if (!ply_write(m_ply, value))
{
std::stringstream ss;
ss << "Error writing dimension '" << Dimension::name(dim) <<
"' of point number " << index;
throw pdal_error(ss.str());
}
}
}
if (!ply_close(m_ply))
{
throw pdal_error("Error closing ply file");
}
}