本文整理汇总了C++中PointViewPtr::size方法的典型用法代码示例。如果您正苦于以下问题:C++ PointViewPtr::size方法的具体用法?C++ PointViewPtr::size怎么用?C++ PointViewPtr::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointViewPtr
的用法示例。
在下文中一共展示了PointViewPtr::size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read
point_count_t RialtoReader::read(PointViewPtr view, point_count_t /*not used*/)
{
// TODO: okay to ignore point count parameter?
log()->get(LogLevel::Debug) << "RialtoReader::read()" << std::endl;
const TileMath tmm(m_matrixSet->getTmsetMinX(), m_matrixSet->getTmsetMinY(),
m_matrixSet->getTmsetMaxX(), m_matrixSet->getTmsetMaxY(),
m_matrixSet->getNumColsAtL0(), m_matrixSet->getNumRowsAtL0());
setQueryParams();
const double qMinX = m_queryBox.minx;
const double qMinY = m_queryBox.miny;
const double qMaxX = m_queryBox.maxx;
const double qMaxY = m_queryBox.maxy;
const uint32_t level = m_queryLevel;
m_gpkg->queryForTiles_begin(m_dataset, qMinX, qMinY, qMaxX, qMaxY, level);
GpkgTile info;
do {
bool ok = m_gpkg->queryForTiles_step(info);
if (!ok) break;
doQuery(tmm, info, view, qMinX, qMinY, qMaxX, qMaxY);
log()->get(LogLevel::Debug) << " resulting view now has "
<< view->size() << " points" << std::endl;
} while (m_gpkg->queryForTiles_next());
return view->size();
}
示例2: icp
PointViewPtr IcpFilter::icp(PointViewPtr fixed, PointViewPtr moving) const
{
typedef pcl::PointXYZ Point;
typedef pcl::PointCloud<Point> Cloud;
Cloud::Ptr fixedCloud(new Cloud());
pclsupport::PDALtoPCD(fixed, *fixedCloud);
Cloud::Ptr movingCloud(new Cloud());
pclsupport::PDALtoPCD(moving, *movingCloud);
pcl::IterativeClosestPoint<Point, Point> icp;
icp.setInputSource(movingCloud);
icp.setInputTarget(fixedCloud);
Cloud result;
icp.align(result);
MetadataNode root = getMetadata();
// I couldn't figure out the template-fu to get
// `MetadataNodeImpl::setValue` to work for all Eigen matrices with one
// function, so I'm just brute-forcing the cast for now.
root.add("transform",
Eigen::MatrixXd(icp.getFinalTransformation().cast<double>()));
root.add("converged", icp.hasConverged());
root.add("fitness", icp.getFitnessScore());
assert(moving->size() == result.points.size());
for (PointId i = 0; i < moving->size(); ++i)
{
moving->setField(Dimension::Id::X, i, result.points[i].x);
moving->setField(Dimension::Id::Y, i, result.points[i].y);
moving->setField(Dimension::Id::Z, i, result.points[i].z);
}
return moving;
}
示例3: run
PointViewSet LocateFilter::run(PointViewPtr inView)
{
PointViewSet viewSet;
if (!inView->size())
return viewSet;
PointId minidx, maxidx;
double minval = (std::numeric_limits<double>::max)();
double maxval = std::numeric_limits<double>::lowest();
for (PointId idx = 0; idx < inView->size(); idx++)
{
double val = inView->getFieldAs<double>(m_dimId, idx);
if (val > maxval)
{
maxval = val;
maxidx = idx;
}
if (val < minval)
{
minval = val;
minidx = idx;
}
}
PointViewPtr outView = inView->makeNew();
if (Utils::iequals("min", m_minmax))
outView->appendPoint(*inView.get(), minidx);
if (Utils::iequals("max", m_minmax))
outView->appendPoint(*inView.get(), maxidx);
viewSet.insert(outView);
return viewSet;
}
示例4: reader
// Test that data from three input views gets written to a single output file.
TEST(NitfWriterTest, flex2)
{
StageFactory f;
Options readerOps;
readerOps.add("filename", Support::datapath("nitf/autzen-utm10.ntf"));
PointTable table;
Stage* reader(f.createStage("readers.nitf"));
reader->setOptions(readerOps);
reader->prepare(table);
PointViewSet views = reader->execute(table);
PointViewPtr v = *(views.begin());
PointViewPtr v1(new PointView(table));
PointViewPtr v2(new PointView(table));
PointViewPtr v3(new PointView(table));
std::vector<PointViewPtr> vs;
vs.push_back(v1);
vs.push_back(v2);
vs.push_back(v3);
for (PointId i = 0; i < v->size(); ++i)
vs[i % 3]->appendPoint(*v, i);
std::string outfile(Support::temppath("test_flex.ntf"));
FileUtils::deleteFile(outfile);
BufferReader reader2;
reader2.addView(v1);
reader2.addView(v2);
reader2.addView(v3);
Options writerOps;
writerOps.add("filename", outfile);
Stage* writer(f.createStage("writers.nitf"));
writer->setOptions(writerOps);
writer->setInput(reader2);
writer->prepare(table);
writer->execute(table);
EXPECT_TRUE(FileUtils::fileExists(outfile));
Options ops;
ops.add("filename", outfile);
Stage* r(f.createStage("readers.nitf"));
r->setOptions(ops);
EXPECT_EQ(r->preview().m_pointCount, v->size());
}
示例5: getBytes
std::vector<char> getBytes(PointViewPtr view)
{
std::vector<char> bytes(view->pointSize() * view->size());
DimTypeList dimTypes = view->dimTypes();
char *p = bytes.data();
for (PointId idx = 0; idx < view->size(); ++idx)
{
view->getPackedPoint(dimTypes, idx, p);
p += view->pointSize();
}
return bytes;
}
示例6: 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;
}
示例7: compare
// Compare the source LAS file with the extracted OCI data.
// Candidate is the OCI reader's view.
void compare(const PointViewPtr candidate, std::string filename)
{
Options options;
Option fn("filename", filename);
options.add(fn);
PointTable table;
LasReader reader;
reader.setOptions(options);
reader.prepare(table);
PointViewSet viewSet = reader.execute(table);
EXPECT_EQ(viewSet.size(), 1u);
PointViewPtr source = *viewSet.begin();
EXPECT_EQ(source->size(), candidate->size());
PointId limit = std::min(source->size(), candidate->size());
for (PointId i = 0; i < limit; ++i)
{
using namespace Dimension;
int32_t sx = source->getFieldAs<int32_t>(Id::X, i);
int32_t sy = source->getFieldAs<int32_t>(Id::Y, i);
int32_t sz = source->getFieldAs<int32_t>(Id::Z, i);
uint16_t sintensity = source->getFieldAs<uint16_t>(Id::Intensity, i);
uint16_t sred = source->getFieldAs<uint16_t>(Id::Red, i);
uint16_t sgreen = source->getFieldAs<uint16_t>(Id::Green, i);
uint16_t sblue = source->getFieldAs<uint16_t>(Id::Blue, i);
int32_t cx = candidate->getFieldAs<int32_t>(Id::X, i);
int32_t cy = candidate->getFieldAs<int32_t>(Id::Y, i);
int32_t cz = candidate->getFieldAs<int32_t>(Id::Z, i);
uint16_t cintensity = candidate->getFieldAs<uint16_t>(Id::Intensity, i);
uint16_t cred = candidate->getFieldAs<uint16_t>(Id::Red, i);
uint16_t cgreen = candidate->getFieldAs<uint16_t>(Id::Green, i);
uint16_t cblue = candidate->getFieldAs<uint16_t>(Id::Blue, i);
EXPECT_EQ(sx, cx);
EXPECT_EQ(sy, cy);
EXPECT_EQ(sz, cz);
EXPECT_EQ(sintensity, cintensity);
EXPECT_EQ(sred, cred);
EXPECT_EQ(sgreen, cgreen);
EXPECT_EQ(sblue, cblue);
}
}
示例8: write
void LasWriter::write(const PointViewPtr view)
{
setAutoOffset(view);
size_t pointLen = m_lasHeader.pointLen();
// Make a buffer of at most a meg.
std::vector<char> buf(std::min((size_t)1000000, pointLen * view->size()));
const PointView& viewRef(*view.get());
//ABELL - Removed callback handling for now.
point_count_t remaining = view->size();
PointId idx = 0;
while (remaining)
{
point_count_t filled = fillWriteBuf(viewRef, idx, buf);
idx += filled;
remaining -= filled;
#ifdef PDAL_HAVE_LASZIP
if (m_lasHeader.compressed())
{
char *pos = buf.data();
for (point_count_t i = 0; i < filled; i++)
{
memcpy(m_zipPoint->m_lz_point_data.data(), pos, pointLen);
if (!m_zipper->write(m_zipPoint->m_lz_point))
{
std::ostringstream oss;
const char* err = m_zipper->get_error();
if (err == NULL)
err = "(unknown error)";
oss << "Error writing point: " << std::string(err);
throw pdal_error(oss.str());
}
pos += pointLen;
}
}
else
m_ostream->write(buf.data(), filled * pointLen);
#else
m_ostream->write(buf.data(), filled * pointLen);
#endif
}
m_numPointsWritten = view->size() - remaining;
}
示例9: srcBounds
TEST(RangeFilterTest, multipleDimensions)
{
BOX3D srcBounds(0.0, 1.0, 1.0, 0.0, 10.0, 10.0);
Options ops;
ops.add("bounds", srcBounds);
ops.add("mode", "ramp");
ops.add("count", 10);
FauxReader reader;
reader.setOptions(ops);
Options rangeOps;
rangeOps.add("limits", "Y[4.00e0:+6]");
rangeOps.add("limits", "Z[4:6]");
RangeFilter filter;
filter.setOptions(rangeOps);
filter.setInput(reader);
PointTable table;
filter.prepare(table);
PointViewSet viewSet = filter.execute(table);
PointViewPtr view = *viewSet.begin();
EXPECT_EQ(1u, viewSet.size());
EXPECT_EQ(3u, view->size());
EXPECT_FLOAT_EQ(4.0, view->getFieldAs<double>(Dimension::Id::Y, 0));
EXPECT_FLOAT_EQ(5.0, view->getFieldAs<double>(Dimension::Id::Y, 1));
EXPECT_FLOAT_EQ(6.0, view->getFieldAs<double>(Dimension::Id::Y, 2));
EXPECT_FLOAT_EQ(4.0, view->getFieldAs<double>(Dimension::Id::Z, 0));
EXPECT_FLOAT_EQ(5.0, view->getFieldAs<double>(Dimension::Id::Z, 1));
EXPECT_FLOAT_EQ(6.0, view->getFieldAs<double>(Dimension::Id::Z, 2));
}
示例10:
TEST(RangeFilterTest, simple_logic)
{
Options ops;
ops.add("bounds", BOX3D(1, 101, 201, 10, 110, 210));
ops.add("mode", "ramp");
ops.add("count", 10);
FauxReader reader;
reader.setOptions(ops);
Options rangeOps;
rangeOps.add("limits", "Y[108:109], X[2:5], Z[1:1000], X[7:9], Y[103:105]");
RangeFilter filter;
filter.setOptions(rangeOps);
filter.setInput(reader);
PointTable table;
filter.prepare(table);
PointViewSet viewSet = filter.execute(table);
PointViewPtr view = *viewSet.begin();
EXPECT_EQ(1u, viewSet.size());
EXPECT_EQ(5u, view->size());
EXPECT_EQ(view->getFieldAs<int>(Dimension::Id::X, 0), 3);
EXPECT_EQ(view->getFieldAs<int>(Dimension::Id::X, 1), 4);
EXPECT_EQ(view->getFieldAs<int>(Dimension::Id::X, 2), 5);
EXPECT_EQ(view->getFieldAs<int>(Dimension::Id::X, 3), 8);
EXPECT_EQ(view->getFieldAs<int>(Dimension::Id::X, 4), 9);
}
示例11: reader
TEST(QFITReaderTest, test_10_word)
{
Options options;
options.add("filename", Support::datapath("qfit/10-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);
std::shared_ptr<QfitReader> reader(new QfitReader);
reader->setOptions(options);
EXPECT_EQ(reader->getName(), "readers.qfit");
PointTable table;
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, 221.826822, 59.205160, 32.0900, 0);
Check_Point(*view, 1, 221.826740, 59.205161, 32.0190, 0);
Check_Point(*view, 2, 221.826658, 59.205164, 32.0000, 0);
}
示例12: filename
TEST(Ilvis2ReaderTest, testReadHigh)
{
Option filename("filename",
Support::datapath("ilvis2/ILVIS2_TEST_FILE.TXT"));
Options options(filename);
options.add("mapping","high");
std::shared_ptr<Ilvis2Reader> reader(new Ilvis2Reader);
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(), 3u);
checkPoint(*view.get(), 0, 42504.48313,
78.307672,-58.785213,1956.777
);
checkPoint(*view.get(), 1, 42504.48512,
78.307592, 101.215097, 1956.588
);
checkPoint(*view.get(), 2, 42504.48712,
78.307512, -58.78459, 2956.667
);
}
示例13:
TEST(RandomizeFilterTest, simple)
{
// This isn't a real test. It's just here to allow easy debugging.
point_count_t count = 1000;
Options readerOps;
readerOps.add("bounds", BOX3D(1, 1, 1,
(double)count, (double)count, (double)count));
readerOps.add("mode", "ramp");
readerOps.add("count", count);
FauxReader r;
r.setOptions(readerOps);
RandomizeFilter f;
f.setInput(r);
PointTable t;
f.prepare(t);
PointViewSet s = f.execute(t);
EXPECT_EQ(s.size(), 1u);
PointViewPtr v = *s.begin();
EXPECT_EQ(v->size(), (size_t)count);
/**
for (PointId i = 0; i < count; i++)
std::cerr << "X[" << i << "] = " <<
v->getFieldAs<double>(Dimension::Id::X, i) << "!\n";
**/
}
示例14: srcBounds
TEST(DecimationFilterTest, DecimationFilterTest_test1)
{
BOX3D srcBounds(0.0, 0.0, 0.0, 100.0, 100.0, 100.0);
Options ops;
ops.add("bounds", srcBounds);
ops.add("mode", "random");
ops.add("num_points", 30);
FauxReader reader;
reader.setOptions(ops);
Options decimationOps;
decimationOps.add("step", 10);
DecimationFilter filter;
filter.setOptions(decimationOps);
filter.setInput(reader);
PointTable table;
filter.prepare(table);
PointViewSet viewSet = filter.execute(table);
EXPECT_EQ(viewSet.size(), 1u);
PointViewPtr view = *viewSet.begin();
EXPECT_EQ(view->size(), 3u);
uint64_t t0 = view->getFieldAs<uint64_t>(Dimension::Id::OffsetTime, 0);
uint64_t t1 = view->getFieldAs<uint64_t>(Dimension::Id::OffsetTime, 1);
uint64_t t2 = view->getFieldAs<uint64_t>(Dimension::Id::OffsetTime, 2);
EXPECT_EQ(t0, 0u);
EXPECT_EQ(t1, 10u);
EXPECT_EQ(t2, 20u);
}
示例15: readData
void readData()
{
std::ostringstream oss;
oss << "SELECT l.\"OBJ_ID\", l.\"BLK_ID\", l.\"BLK_EXTENT\", " <<
"l.\"BLK_DOMAIN\", l.\"PCBLK_MIN_RES\", l.\"PCBLK_MAX_RES\", " <<
"l.\"NUM_POINTS\", l.\"NUM_UNSORTED_POINTS\", l.\"PT_SORT_DIM\", " <<
"l.\"POINTS\", b.cloud "
"FROM PDAL_TEST_BLOCKS l, PDAL_TEST_BASE b "
"WHERE b.id = l.obj_id ORDER BY l.blk_id ";
Options options = readerOptions();
options.add("query", oss.str());
StageFactory f;
Stage* reader(f.createStage("readers.oci"));
EXPECT_TRUE(reader);
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(), 1065u);
compare(view, Support::datapath("autzen/autzen-utm.las"));
}