本文整理汇总了C++中PointView::size方法的典型用法代码示例。如果您正苦于以下问题:C++ PointView::size方法的具体用法?C++ PointView::size怎么用?C++ PointView::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointView
的用法示例。
在下文中一共展示了PointView::size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: matrix
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;
}
示例3: 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);
}
}
}
示例4: 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);
}
示例5: 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());
}
示例6: filter
void ColorizationFilter::filter(PointView& view)
{
PointRef point = view.point(0);
for (PointId idx = 0; idx < view.size(); ++idx)
{
point.setPointId(idx);
processOne(point);
}
}
示例7: filter
void TransformationFilter::filter(PointView& view)
{
PointRef point(view, 0);
for (PointId idx = 0; idx < view.size(); ++idx)
{
point.setPointId(idx);
processOne(point);
}
}
示例8: filter
void FerryFilter::filter(PointView& view)
{
PointRef point(view, 0);
for (PointId id = 0; id < view.size(); ++id)
{
point.setPointId(id);
processOne(point);
}
}
示例9: 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));
}
}
示例10: extendedLocalMinimum
Eigen::MatrixXd extendedLocalMinimum(PointView& view, int rows, int cols,
double cell_size, BOX2D bounds)
{
using namespace Dimension;
using namespace Eigen;
// Index elevation values by row and column.
std::map<uint32_t, std::vector<double>> hash;
for (PointId i = 0; i < view.size(); ++i)
{
double x = view.getFieldAs<double>(Id::X, i);
double y = view.getFieldAs<double>(Id::Y, i);
double z = view.getFieldAs<double>(Id::Z, i);
int c = Utils::clamp(static_cast<int>(floor(x-bounds.minx)/cell_size), 0, cols-1);
int r = Utils::clamp(static_cast<int>(floor(y-bounds.miny)/cell_size), 0, rows-1);
hash[r*cols+c].push_back(z);
}
// For each grid cell, sort elevations and detect local minimum, rejecting low
// outliers.
MatrixXd ZImin(rows, cols);
ZImin.setConstant(std::numeric_limits<double>::quiet_NaN());
for (int c = 0; c < cols; ++c)
{
for (int r = 0; r < rows; ++r)
{
std::vector<double> cp(hash[r*cols+c]);
if (cp.empty())
continue;
std::sort(cp.begin(), cp.end());
if (cp.size() == 1)
{
ZImin(r, c) = cp[0];
continue;
}
for (size_t i = 0; i < cp.size()-1; ++i)
{
if (std::fabs(cp[i] - cp[i+1]) < 1.0)
{
ZImin(r, c) = cp[i];
break;
}
}
}
}
return ZImin;
}
示例11: begin
void BufferedInvocation::begin(PointView& view, MetadataNode m)
{
PointLayoutPtr layout(view.m_pointTable.layout());
Dimension::IdList const& dims = layout->dims();
for (auto di = dims.begin(); di != dims.end(); ++di)
{
Dimension::Id::Enum d = *di;
const Dimension::Detail *dd = layout->dimDetail(d);
void *data = malloc(dd->size() * view.size());
m_buffers.push_back(data); // Hold pointer for deallocation
char *p = (char *)data;
for (PointId idx = 0; idx < view.size(); ++idx)
{
view.getFieldInternal(d, idx, (void *)p);
p += dd->size();
}
std::string name = layout->dimName(*di);
insertArgument(name, (uint8_t *)data, dd->type(), view.size());
}
Py_XDECREF(m_metaIn);
m_metaIn = plang::fromMetadata(m);
}
示例12: 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);
}
}
示例13: readPointMajor
point_count_t OciReader::readPointMajor(PointView& view,
BlockPtr block, point_count_t numPts)
{
size_t numRemaining = block->numRemaining();
PointId nextId = view.size();
point_count_t numRead = 0;
if (m_compression)
{
#ifdef PDAL_HAVE_LAZPERF
LazPerfBuf buf(block->chunk);
LazPerfDecompressor<LazPerfBuf> decompressor(buf, dbDimTypes());
std::vector<char> ptBuf(decompressor.pointSize());
while (numRead < numPts && numRemaining > 0)
{
point_count_t numWritten =
decompressor.decompress(ptBuf.data(), ptBuf.size());
writePoint(view, nextId, ptBuf.data());
if (m_cb)
m_cb(view, nextId);
numRemaining--;
nextId++;
numRead++;
}
#else
throw pdal_error("Can't decompress without LAZperf.");
#endif
}
else
{
char *pos = seekPointMajor(block);
while (numRead < numPts && numRemaining > 0)
{
writePoint(view, nextId, pos);
if (m_cb)
m_cb(view, nextId);
pos += packedPointSize();
numRemaining--;
nextId++;
numRead++;
}
}
block->setNumRemaining(numRemaining);
return numRead;
}
示例14: fillWriteBuf
point_count_t LasWriter::fillWriteBuf(const PointView& view,
PointId startId, std::vector<char>& buf)
{
point_count_t blocksize = buf.size() / m_lasHeader.pointLen();
blocksize = (std::min)(blocksize, view.size() - startId);
PointId lastId = startId + blocksize;
LeInserter ostream(buf.data(), buf.size());
PointRef point = (const_cast<PointView&>(view)).point(0);
for (PointId idx = startId; idx < lastId; idx++)
{
point.setPointId(idx);
fillPointBuf(point, ostream);
}
return blocksize;
}
示例15: filter
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);
}