本文整理汇总了C++中PointView类的典型用法代码示例。如果您正苦于以下问题:C++ PointView类的具体用法?C++ PointView怎么用?C++ PointView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PointView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writePoint
/// Write a point's packed data into a buffer.
/// \param[in] view PointView to write to.
/// \param[in] idx Index of point to write.
/// \param[in] buf Pointer to packed DB point data.
void DbReader::writePoint(PointView& view, PointId idx, const char *buf)
{
using namespace Dimension;
for (auto di = m_dims.begin(); di != m_dims.end(); ++di)
{
DimType dimType = di->m_dimType;
// If we read X, Y or Z as a signed 32, apply the transform and write
// the transformed value (double).
if (dimType.m_type == Type::Signed32 &&
(dimType.m_id == Id::X || dimType.m_id == Id::Y ||
dimType.m_id == Id::Z))
{
int32_t i;
memcpy(&i, buf, sizeof(int32_t));
double d = (i * dimType.m_xform.m_scale) + dimType.m_xform.m_offset;
view.setField(dimType.m_id, idx, d);
}
else
{
view.setField(dimType.m_id, dimType.m_type, idx, buf);
}
buf += Dimension::size(dimType.m_type);
}
}
示例2: filter
void ColorizationFilter::filter(PointView& view)
{
int32_t pixel(0);
int32_t line(0);
std::array<double, 2> pix = { {0.0, 0.0} };
for (PointId idx = 0; idx < view.size(); ++idx)
{
double x = view.getFieldAs<double>(Dimension::Id::X, idx);
double y = view.getFieldAs<double>(Dimension::Id::Y, idx);
if (!getPixelAndLinePosition(x, y, m_inverse_transform, pixel,
line, m_ds))
continue;
for (auto bi = m_bands.begin(); bi != m_bands.end(); ++bi)
{
BandInfo& b = *bi;
GDALRasterBandH hBand = GDALGetRasterBand(m_ds, b.m_band);
if (hBand == NULL)
{
std::ostringstream oss;
oss << "Unable to get band " << b.m_band <<
" from data source!";
throw pdal_error(oss.str());
}
if (GDALRasterIO(hBand, GF_Read, pixel, line, 1, 1,
&pix[0], 1, 1, GDT_CFloat64, 0, 0) == CE_None)
view.setField(b.m_dim, idx, pix[0] * b.m_scale);
}
}
}
示例3: filter
void AttributeFilter::filter(PointView& view)
{
if (m_value == m_value)
for (PointId i = 0; i < view.size(); ++i)
view.setField(m_dim, i, m_value);
else
UpdateGEOSBuffer(view);
}
示例4: filter
void ColorizationFilter::filter(PointView& view)
{
PointRef point = view.point(0);
for (PointId idx = 0; idx < view.size(); ++idx)
{
point.setPointId(idx);
processOne(point);
}
}
示例5: filter
void HexBin::filter(PointView& view)
{
for (PointId idx = 0; idx < view.size(); ++idx)
{
double x = view.getFieldAs<double>(pdal::Dimension::Id::X, idx);
double y = view.getFieldAs<double>(pdal::Dimension::Id::Y, idx);
m_grid->addPoint(x, y);
}
m_count += view.size();
}
示例6: pointViewToEigen
PDAL_DLL Eigen::MatrixXd pointViewToEigen(const PointView& view)
{
Eigen::MatrixXd matrix(view.size(), 3);
for (PointId i = 0; i < view.size(); ++i)
{
matrix(i, 0) = view.getFieldAs<double>(Dimension::Id::X, i);
matrix(i, 1) = view.getFieldAs<double>(Dimension::Id::Y, i);
matrix(i, 2) = view.getFieldAs<double>(Dimension::Id::Z, i);
}
return matrix;
}
示例7: filter
void EstimateRankFilter::filter(PointView& view)
{
KD3Index& kdi = view.build3dIndex();
for (PointId i = 0; i < view.size(); ++i)
{
// find the k-nearest neighbors
auto ids = kdi.neighbors(i, m_knn);
view.setField(m_rank, i, eigen::computeRank(view, ids, m_thresh));
}
}
示例8: filter
void ReprojectionFilter::filter(PointView& view)
{
for (PointId id = 0; id < view.size(); ++id)
{
double x = view.getFieldAs<double>(Dimension::Id::X, id);
double y = view.getFieldAs<double>(Dimension::Id::Y, id);
double z = view.getFieldAs<double>(Dimension::Id::Z, id);
transform(x, y, z);
view.setField(Dimension::Id::X, id, x);
view.setField(Dimension::Id::Y, id, y);
view.setField(Dimension::Id::Z, id, z);
}
}
示例9: throwError
void HAGFilter::filter(PointView& view)
{
PointViewPtr gView = view.makeNew();
PointViewPtr ngView = view.makeNew();
std::vector<PointId> gIdx, ngIdx;
// First pass: Separate into ground and non-ground views.
for (PointId i = 0; i < view.size(); ++i)
{
double c = view.getFieldAs<double>(Dimension::Id::Classification, i);
if (c == 2)
{
gView->appendPoint(view, i);
gIdx.push_back(i);
}
else
{
ngView->appendPoint(view, i);
ngIdx.push_back(i);
}
}
// Bail if there weren't any points classified as ground.
if (gView->size() == 0)
throwError("Input PointView does not have any points classified "
"as ground");
// Build the 2D KD-tree.
KD2Index kdi(*gView);
kdi.build();
// Second pass: Find Z difference between non-ground points and the nearest
// neighbor (2D) in the ground view.
for (PointId i = 0; i < ngView->size(); ++i)
{
PointRef point = ngView->point(i);
double z0 = point.getFieldAs<double>(Dimension::Id::Z);
auto ids = kdi.neighbors(point, 1);
double z1 = gView->getFieldAs<double>(Dimension::Id::Z, ids[0]);
view.setField(Dimension::Id::HeightAboveGround, ngIdx[i], z0 - z1);
}
// Final pass: Ensure that all ground points have height value pegged at 0.
for (auto const& i : gIdx)
view.setField(Dimension::Id::HeightAboveGround, i, 0.0);
}
示例10: writeField
void DbReader::writeField(PointView& view, const char *pos, const DimType& dim,
PointId idx)
{
using namespace Dimension;
if (dim.m_id == Id::X || dim.m_id == Id::Y || dim.m_id == Id::Z)
{
Everything e;
memcpy(&e, pos, Dimension::size(dim.m_type));
double d = Utils::toDouble(e, dim.m_type);
d = (d * dim.m_xform.m_scale.m_val) + dim.m_xform.m_offset.m_val;
view.setField(dim.m_id, idx, d);
}
else
view.setField(dim.m_id, dim.m_type, idx, pos);
}
示例11: filter
void TransformationFilter::filter(PointView& view)
{
PointRef point(view, 0);
for (PointId idx = 0; idx < view.size(); ++idx)
{
point.setPointId(idx);
processOne(point);
}
}
示例12: filter
void FerryFilter::filter(PointView& view)
{
PointRef point(view, 0);
for (PointId id = 0; id < view.size(); ++id)
{
point.setPointId(id);
processOne(point);
}
}
示例13: filter
void ProgrammableFilter::filter(PointView& view)
{
log()->get(LogLevel::Debug5) << "Python script " << *m_script <<
" processing " << view.size() << " points." << std::endl;
m_pythonMethod->resetArguments();
m_pythonMethod->begin(view, m_totalMetadata);
m_pythonMethod->execute();
m_pythonMethod->end(view, getMetadata());
}
示例14: filter
void AttributeFilter::filter(PointView& view)
{
for (auto& dim_par : m_dimensions)
{
if (dim_par.second.isogr)
{
UpdateGEOSBuffer(view, dim_par.second);
} else
{
for (PointId i = 0; i < view.size(); ++i)
{
double v = boost::lexical_cast<double>(dim_par.second.value);
view.setField(dim_par.second.dim, i, v);
}
}
}
}
示例15: writeField
void DbReader::writeField(PointView& view, const char *pos, const DimType& dim,
PointId idx)
{
using namespace Dimension;
if (dim.m_type == Type::Signed32 &&
(dim.m_id == Id::X || dim.m_id == Id::Y || dim.m_id == Id::Z))
{
int32_t i;
memcpy(&i, pos, sizeof(int32_t));
double d = (i * dim.m_xform.m_scale) + dim.m_xform.m_offset;
view.setField(dim.m_id, idx, d);
}
else
{
view.setField(dim.m_id, dim.m_type, idx, pos);
}
}