本文整理汇总了C++中PointViewPtr类的典型用法代码示例。如果您正苦于以下问题:C++ PointViewPtr类的具体用法?C++ PointViewPtr怎么用?C++ PointViewPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PointViewPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readDimMajor
point_count_t BpfReader::readDimMajor(PointViewPtr data, point_count_t count)
{
PointId idx(0);
PointId startId = data->size();
point_count_t numRead = 0;
for (size_t d = 0; d < m_dims.size(); ++d)
{
idx = m_index;
PointId nextId = startId;
numRead = 0;
seekDimMajor(d, idx);
for (; numRead < count && idx < numPoints(); idx++, numRead++, nextId++)
{
float f;
m_stream >> f;
data->setField(m_dims[d].m_id, nextId, f + m_dims[d].m_offset);
}
}
m_index = idx;
// Transformation only applies to X, Y and Z
for (PointId idx = startId; idx < data->size(); idx++)
{
double x = data->getFieldAs<double>(Dimension::Id::X, idx);
double y = data->getFieldAs<double>(Dimension::Id::Y, idx);
double z = data->getFieldAs<double>(Dimension::Id::Z, idx);
m_header.m_xform.apply(x, y, z);
data->setField(Dimension::Id::X, idx, x);
data->setField(Dimension::Id::Y, idx, y);
data->setField(Dimension::Id::Z, idx, z);
if (m_cb)
m_cb(*data, idx);
}
return numRead;
}
示例2: TEST
TEST(CropFilterTest, test_crop_polygon)
{
#ifdef PDAL_HAVE_GEOS
Options ops1;
ops1.add("filename", Support::datapath("las/1.2-with-color.las"));
LasReader reader;
reader.setOptions(ops1);
Options options;
Option debug("debug", true, "");
Option verbose("verbose", 9, "");
std::istream* wkt_stream =
FileUtils::openFile(Support::datapath("autzen/autzen-selection.wkt"));
std::stringstream strbuf;
strbuf << wkt_stream->rdbuf();
std::string wkt(strbuf.str());
Option polygon("polygon", wkt, "");
options.add(polygon);
CropFilter crop;
crop.setInput(reader);
crop.setOptions(options);
PointTable table;
crop.prepare(table);
PointViewSet viewSet = crop.execute(table);
EXPECT_EQ(viewSet.size(), 1u);
PointViewPtr view = *viewSet.begin();
EXPECT_EQ(view->size(), 47u);
FileUtils::closeFile(wkt_stream);
#endif
}
示例3: TEST
TEST(RangeFilterTest, nan)
{
LasReader reader;
Options options;
options.add("filename", Support::datapath("las/gps-time-nan.las"));
reader.setOptions(options);
Options rangeOptions;
rangeOptions.add("limits", "GpsTime[-1:1]");
RangeFilter filter;
filter.setOptions(rangeOptions);
filter.setInput(reader);
PointTable table;
filter.prepare(table);
PointViewSet viewSet = filter.execute(table);
PointViewPtr view = *viewSet.begin();
EXPECT_EQ(1u, viewSet.size());
EXPECT_EQ(0u, view->size());
}
示例4: write
void PcdWriter::write(const PointViewPtr view)
{
pcl::PointCloud<XYZIRGBA>::Ptr cloud(new pcl::PointCloud<XYZIRGBA>);
BOX3D buffer_bounds;
view->calculateBounds(buffer_bounds);
pclsupport::PDALtoPCD(view, *cloud, buffer_bounds);
pcl::PCDWriter w;
if (m_compressed)
w.writeBinaryCompressed<XYZIRGBA>(m_filename, *cloud);
else
w.writeASCII<XYZIRGBA>(m_filename, *cloud);
}
示例5: TEST
TEST(MergeTest, test3)
{
using namespace pdal;
PipelineManager mgr;
PipelineReader specReader(mgr);
specReader.readPipeline(Support::configuredpath("filters/merge3.xml"));
std::ostringstream oss;
std::ostream& o = std::clog;
auto ctx = Utils::redirect(o, oss);
mgr.execute();
std::string s = oss.str();
EXPECT_TRUE(s.find("inconsistent spatial references") != s.npos);
Utils::restore(o, ctx);
PointViewSet viewSet = mgr.views();
EXPECT_EQ(viewSet.size(), 1u);
PointViewPtr view = *viewSet.begin();
EXPECT_EQ(view->size(), 2130u);
}
示例6: TEST
TEST(OldPCLBlockTests, StatisticalOutliers2)
{
StageFactory f;
Options ro;
ro.add("filename", Support::datapath("autzen/autzen-point-format-3.las"));
Stage* r(f.createStage("readers.las"));
EXPECT_TRUE(r);
r->setOptions(ro);
Options fo;
fo.add("method", "statistical");
fo.add("multiplier", 0.0);
fo.add("mean_k", 5);
Stage* outlier(f.createStage("filters.outlier"));
EXPECT_TRUE(outlier);
outlier->setOptions(fo);
outlier->setInput(*r);
Options rangeOpts;
rangeOpts.add("limits", "Classification![7:7]");
Stage* range(f.createStage("filters.range"));
EXPECT_TRUE(range);
range->setOptions(rangeOpts);
range->setInput(*outlier);
PointTable table;
range->prepare(table);
PointViewSet viewSet = range->execute(table);
EXPECT_EQ(1u, viewSet.size());
PointViewPtr view = *viewSet.begin();
EXPECT_EQ(63u, view->size());
}
示例7: TEST
TEST(SbetReaderTest, testRead)
{
Option filename("filename", Support::datapath("sbet/2-points.sbet"), "");
Options options(filename);
std::shared_ptr<SbetReader> reader(new SbetReader);
reader->setOptions(options);
PointTable table;
reader->prepare(table);
PointViewSet viewSet = reader->execute(table);
EXPECT_EQ(viewSet.size(), 1u);
PointViewPtr view = *viewSet.begin();
EXPECT_EQ(view->size(), 2u);
checkPoint(*view.get(), 0,
1.516310028360710e+05, 5.680211852972264e-01,
-2.041654392303940e+00, 1.077152953296560e+02,
-2.332420866600025e+00, -3.335067504871401e-01,
-3.093961631767838e-02, -2.813407149321339e-02,
-2.429905393889139e-02, 3.046773230278662e+00,
-2.198414736922658e-02, 7.859639737752390e-01,
7.849084719295495e-01, -2.978807916450262e-01,
6.226807982589819e-05, 9.312162756440178e-03,
7.217812320996525e-02);
checkPoint(*view.get(), 1,
1.516310078318641e+05, 5.680211834722869e-01,
-2.041654392034053e+00, 1.077151424357507e+02,
-2.336228229691271e+00, -3.324663118952635e-01,
-3.022948961008987e-02, -2.813856631423094e-02,
-2.425215669392169e-02, 3.047131105236811e+00,
-2.198416007932108e-02, 8.397590491636475e-01,
3.252165276637165e-01, -1.558883225990844e-01,
8.379685112283802e-04, 7.372886784718076e-03,
7.179027672314571e-02);
}
示例8: compareTextLas
void compareTextLas(const std::string& textFilename,
Options& textOptions, const std::string& lasFilename)
{
TextReader t;
textOptions.add("filename", textFilename);
t.setOptions(textOptions);
LasReader l;
Options lo;
lo.add("filename", lasFilename);
l.setOptions(lo);
PointTable tt;
t.prepare(tt);
PointViewSet ts = t.execute(tt);
EXPECT_EQ(ts.size(), 1U);
PointViewPtr tv = *ts.begin();
PointTable lt;
l.prepare(lt);
PointViewSet ls = l.execute(lt);
EXPECT_EQ(ls.size(), 1U);
PointViewPtr lv = *ls.begin();
EXPECT_EQ(tv->size(), lv->size());
// Validate some point data.
for (PointId i = 0; i < lv->size(); ++i)
{
EXPECT_DOUBLE_EQ(tv->getFieldAs<double>(Dimension::Id::X, i),
lv->getFieldAs<double>(Dimension::Id::X, i));
EXPECT_DOUBLE_EQ(tv->getFieldAs<double>(Dimension::Id::Y, i),
lv->getFieldAs<double>(Dimension::Id::Y, i));
EXPECT_DOUBLE_EQ(tv->getFieldAs<double>(Dimension::Id::Z, i),
lv->getFieldAs<double>(Dimension::Id::Z, i));
}
}
示例9: read
point_count_t NumpyReader::read(PointViewPtr view, point_count_t numToRead)
{
PointId idx = view->size();
point_count_t numRead(0);
while (numRead < numToRead)
{
PointRef point(*view, idx);
if (!processOne(point))
break;
numRead++;
idx++;
}
return numRead;
}
示例10: read
point_count_t TextReader::read(PointViewPtr view, point_count_t numPts)
{
PointId idx = view->size();
point_count_t cnt = 0;
PointRef point(*view, idx);
while (cnt < numPts)
{
point.setPointId(idx);
if (!processOne(point))
break;
cnt++;
idx++;
}
return cnt;
}
示例11: TEST
TEST(QFITReaderTest, test_14_word)
{
Options options;
options.add("filename", Support::datapath("qfit/14-word.qi"),
"Input filename for reader to use");
options.add("flip_coordinates", false,
"Flip coordinates from 0-360 to -180-180");
options.add("scale_z", 0.001f, "Z scale from mm to m");
options.add("count", 3);
PointTable table;
std::shared_ptr<QfitReader> reader(new QfitReader);
reader->setOptions(options);
reader->prepare(table);
PointViewSet viewSet = reader->execute(table);
EXPECT_EQ(viewSet.size(), 1u);
PointViewPtr view = *viewSet.begin();
EXPECT_EQ(view->size(), 3u);
Check_Point(*view, 0, 244.306337, 35.623317, 1056.830000000, 903);
Check_Point(*view, 1, 244.306260, 35.623280, 1056.409000000, 903);
Check_Point(*view, 2, 244.306204, 35.623257, 1056.483000000, 903);
}
示例12: log
void RialtoReader::doQuery(const TileMath& tmm,
const GpkgTile& tile,
PointViewPtr view,
double qMinX, double qMinY, double qMaxX, double qMaxY)
{
const uint32_t level = tile.getLevel();
const uint32_t column = tile.getColumn();
const uint32_t row = tile.getRow();
const uint32_t numPoints = tile.getNumPoints();
// if this tile is entirely inside the query box, then
// we won't need to check each point
double tileMinX, tileMinY, tileMaxX, tileMaxY;
tmm.getTileBounds(column, row, level,
tileMinX, tileMinY, tileMaxX, tileMaxY);
const bool tileEntirelyInsideQueryBox =
tmm.rectContainsRect(qMinX, qMinY, qMaxX, qMaxY,
tileMinX, tileMinY, tileMaxX, tileMaxY);
log()->get(LogLevel::Debug) << " intersecting tile "
<< "(" << level << "," << column << "," << row << ")"
<< " contains " << numPoints << " points" << std::endl;
PointViewPtr tempView = view->makeNew();
GpkgTile::exportToPV(numPoints, tempView, tile.getBlob());
for (uint32_t i=0; i<tempView->size(); i++) {
const double x = tempView->getFieldAs<double>(Dimension::Id::X, i);
const double y = tempView->getFieldAs<double>(Dimension::Id::Y, i);
if (tileEntirelyInsideQueryBox || (x >= qMinX && x <= qMaxX && y >= qMinY && y <= qMaxY))
{
view->appendPoint(*tempView, i);
}
}
}
示例13: run
PointViewSet SampleFilter::run(PointViewPtr inView)
{
point_count_t np = inView->size();
// Return empty PointViewSet if the input PointView has no points.
// Otherwise, make a new output PointView.
PointViewSet viewSet;
if (!np)
return viewSet;
PointViewPtr outView = inView->makeNew();
// Build the 3D KD-tree.
KD3Index index(*inView);
index.build();
// All points are marked as kept (1) by default. As they are masked by
// neighbors within the user-specified radius, their value is changed to 0.
std::vector<int> keep(np, 1);
// We are able to subsample in a single pass over the shuffled indices.
for (PointId i = 0; i < np; ++i)
{
// If a point is masked, it is forever masked, and cannot be part of the
// sampled cloud. Otherwise, the current index is appended to the output
// PointView.
if (keep[i] == 0)
continue;
outView->appendPoint(*inView, i);
// We now proceed to mask all neighbors within m_radius of the kept
// point.
auto ids = index.radius(i, m_radius);
for (auto const& id : ids)
keep[id] = 0;
}
// Simply calculate the percentage of retained points.
double frac = (double)outView->size() / (double)inView->size();
log()->get(LogLevel::Debug2)
<< "Retaining " << outView->size() << " of " << inView->size()
<< " points (" << 100 * frac << "%)\n";
viewSet.insert(outView);
return viewSet;
}
示例14: 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->build2dIndex();
// 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);
}
示例15: run
PointViewSet run(PointViewPtr view)
{
if (m_count > view->size())
log()->get(LogLevel::Warning)
<< "Requested number of points (count=" << m_count
<< ") exceeds number of available points.\n";
PointViewSet viewSet;
PointViewPtr outView = view->makeNew();
for (PointId i = view->size() - std::min(m_count, view->size());
i < view->size(); ++i)
outView->appendPoint(*view, i);
viewSet.insert(outView);
return viewSet;
}