本文整理汇总了C++中PointViewSet::size方法的典型用法代码示例。如果您正苦于以下问题:C++ PointViewSet::size方法的具体用法?C++ PointViewSet::size怎么用?C++ PointViewSet::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointViewSet
的用法示例。
在下文中一共展示了PointViewSet::size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dump
void InfoKernel::dump(MetadataNode& root)
{
if (m_showSchema)
root.add(m_manager->pointTable().toMetadata().clone("schema"));
if (m_PointCloudSchemaOutput.size() > 0)
{
#ifdef PDAL_HAVE_LIBXML2
XMLSchema schema(m_manager->pointTable().layout());
std::ostream *out = FileUtils::createFile(m_PointCloudSchemaOutput);
std::string xml(schema.xml());
out->write(xml.c_str(), xml.size());
FileUtils::closeFile(out);
#else
std::cerr << "libxml2 support not enabled, no schema is produced" <<
std::endl;
#endif
}
if (m_showStats)
root.add(m_statsStage->getMetadata().clone("stats"));
if (m_pipelineFile.size() > 0)
PipelineWriter::writePipeline(m_manager->getStage(), m_pipelineFile);
if (m_pointIndexes.size())
{
PointViewSet viewSet = m_manager->views();
assert(viewSet.size() == 1);
root.add(dumpPoints(*viewSet.begin()).clone("points"));
}
if (m_queryPoint.size())
{
PointViewSet viewSet = m_manager->views();
assert(viewSet.size() == 1);
root.add(dumpQuery(*viewSet.begin()));
}
if (m_showMetadata)
{
// If we have a reader cached, this means we
// weren't reading a pipeline file directly. In that
// case, use the metadata from the reader (old behavior).
// Otherwise, return the full metadata of the entire pipeline
if (m_reader)
root.add(m_reader->getMetadata().clone("metadata"));
else
root.add(m_manager->getMetadata().clone("metadata"));
}
if (m_boundary)
{
PointViewSet viewSet = m_manager->views();
assert(viewSet.size() == 1);
root.add(m_hexbinStage->getMetadata().clone("boundary"));
}
}
示例2: bounds
TEST_F(PredicateFilterTest, PredicateFilterTest_test_programmable_4)
{
StageFactory f;
// test the point counters in the Predicate's iterator
BOX3D bounds(0.0, 0.0, 0.0, 2.0, 2.0, 2.0);
Options readerOpts;
readerOpts.add("bounds", bounds);
readerOpts.add("count", 1000);
readerOpts.add("mode", "ramp");
FauxReader reader;
reader.setOptions(readerOpts);
const Option source("source",
// "Y > 0.5"
"import numpy as np\n"
"def yow2(ins,outs):\n"
" Y = ins['Y']\n"
" Mask = np.greater(Y, 0.5)\n"
" #print Mask\n"
" outs['Mask'] = Mask\n"
" return True\n"
);
const Option module("module", "MyModule1");
const Option function("function", "yow2");
Options opts;
opts.add(source);
opts.add(module);
opts.add(function);
Stage* filter(f.createStage("filters.python"));
filter->setOptions(opts);
filter->setInput(reader);
PointTable table;
PointViewPtr buf(new PointView(table));
filter->prepare(table);
StageWrapper::ready(reader, table);
PointViewSet viewSet = StageWrapper::run(reader, buf);
StageWrapper::done(reader, table);
EXPECT_EQ(viewSet.size(), 1u);
buf = *viewSet.begin();
EXPECT_EQ(buf->size(), 1000u);
StageWrapper::ready(*filter, table);
viewSet = StageWrapper::run(*filter, buf);
StageWrapper::done(*filter, table);
EXPECT_EQ(viewSet.size(), 1u);
buf = *viewSet.begin();
EXPECT_EQ(buf->size(), 750u);
}
示例3: 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
);
}
示例4: 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);
}
示例5: srcBounds
TEST(CropFilterTest, test_crop)
{
BOX3D srcBounds(0.0, 0.0, 0.0, 10.0, 100.0, 1000.0);
Options opts;
opts.add("bounds", srcBounds);
opts.add("num_points", 1000);
opts.add("mode", "ramp");
FauxReader reader;
reader.setOptions(opts);
// crop the window to 1/3rd the size in each dimension
BOX2D dstBounds(3.33333, 33.33333, 6.66666, 66.66666);
Options cropOpts;
cropOpts.add("bounds", dstBounds);
CropFilter filter;
filter.setOptions(cropOpts);
filter.setInput(reader);
Options statOpts;
StatsFilter stats;
stats.setOptions(statOpts);
stats.setInput(filter);
PointTable table;
stats.prepare(table);
PointViewSet viewSet = stats.execute(table);
EXPECT_EQ(viewSet.size(), 1u);
PointViewPtr buf = *viewSet.begin();
const stats::Summary& statsX = stats.getStats(Dimension::Id::X);
const stats::Summary& statsY = stats.getStats(Dimension::Id::Y);
const stats::Summary& statsZ = stats.getStats(Dimension::Id::Z);
EXPECT_EQ(buf->size(), 333u);
const double minX = statsX.minimum();
const double minY = statsY.minimum();
const double minZ = statsZ.minimum();
const double maxX = statsX.maximum();
const double maxY = statsY.maximum();
const double maxZ = statsZ.maximum();
const double avgX = statsX.average();
const double avgY = statsY.average();
const double avgZ = statsZ.average();
const double delX = 10.0 / 999.0 * 100.0;
const double delY = 100.0 / 999.0 * 100.0;
const double delZ = 1000.0 / 999.0 * 100.0;
EXPECT_NEAR(minX, 3.33333, delX);
EXPECT_NEAR(minY, 33.33333, delY);
EXPECT_NEAR(minZ, 333.33333, delZ);
EXPECT_NEAR(maxX, 6.66666, delX);
EXPECT_NEAR(maxY, 66.66666, delY);
EXPECT_NEAR(maxZ, 666.66666, delZ);
EXPECT_NEAR(avgX, 5.00000, delX);
EXPECT_NEAR(avgY, 50.00000, delY);
EXPECT_NEAR(avgZ, 500.00000, delZ);
}
示例6: 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);
}
示例7: 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"));
}
示例8:
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";
**/
}
示例9: test_a_format
static void test_a_format(const std::string& file, uint8_t majorVersion,
uint8_t minorVersion, int pointFormat,
double xref, double yref, double zref, double tref,
uint16_t rref, uint16_t gref, uint16_t bref)
{
PointTable table;
Options ops1;
ops1.add("filename", Support::datapath(file));
ops1.add("count", 1);
LasReader reader;
reader.setOptions(ops1);
reader.prepare(table);
EXPECT_EQ(reader.header().pointFormat(), pointFormat);
EXPECT_EQ(reader.header().versionMajor(), majorVersion);
EXPECT_EQ(reader.header().versionMinor(), minorVersion);
PointViewSet viewSet = reader.execute(table);
EXPECT_EQ(viewSet.size(), 1u);
PointViewPtr view = *viewSet.begin();
EXPECT_EQ(view->size(), 1u);
Support::check_pN(*view, 0, xref, yref, zref, tref, rref, gref, bref);
}
示例10: srcBounds
TEST(RangeFilterTest, negation)
{
BOX3D srcBounds(0.0, 0.0, 1.0, 0.0, 0.0, 10.0);
Options ops;
ops.add("bounds", srcBounds);
ops.add("mode", "ramp");
ops.add("count", 10);
StageFactory f;
FauxReader reader;
reader.setOptions(ops);
Options rangeOps;
rangeOps.add("limits", "Z![2:5]");
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(6u, view->size());
EXPECT_FLOAT_EQ(1.0, view->getFieldAs<double>(Dimension::Id::Z, 0));
EXPECT_FLOAT_EQ(6.0, view->getFieldAs<double>(Dimension::Id::Z, 1));
EXPECT_FLOAT_EQ(7.0, view->getFieldAs<double>(Dimension::Id::Z, 2));
EXPECT_FLOAT_EQ(8.0, view->getFieldAs<double>(Dimension::Id::Z, 3));
EXPECT_FLOAT_EQ(9.0, view->getFieldAs<double>(Dimension::Id::Z, 4));
EXPECT_FLOAT_EQ(10.0, view->getFieldAs<double>(Dimension::Id::Z, 5));
}
示例11: table
TEST(FerryFilterTest, test_ferry_copy_xml)
{
PipelineManager mgr;
mgr.readPipeline(Support::configuredpath("filters/ferry.xml"));
mgr.execute();
ConstPointTableRef table(mgr.pointTable());
PointViewSet viewSet = mgr.views();
EXPECT_EQ(viewSet.size(), 1u);
PointViewPtr view = *viewSet.begin();
EXPECT_EQ(view->size(), 1065u);
Dimension::Id::Enum state_plane_x = table.layout()->findDim("StatePlaneX");
Dimension::Id::Enum state_plane_y = table.layout()->findDim("StatePlaneY");
double lon = view->getFieldAs<double>(Dimension::Id::X, 0);
double lat = view->getFieldAs<double>(Dimension::Id::Y, 0);
double x = view->getFieldAs<double>(state_plane_x, 0);
double y = view->getFieldAs<double>(state_plane_y, 0);
EXPECT_DOUBLE_EQ(-117.2501328350574, lon);
EXPECT_DOUBLE_EQ(49.341077824192915, lat);
EXPECT_DOUBLE_EQ(637012.24, x);
EXPECT_DOUBLE_EQ(849028.31, y);
}
示例12:
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);
}
示例13: dump
void InfoKernel::dump(MetadataNode& root)
{
if (m_showSchema)
root.add(Utils::toMetadata(m_manager->pointTable()).clone("schema"));
if (m_PointCloudSchemaOutput.size() > 0)
{
#ifdef PDAL_HAVE_LIBXML2
XMLSchema schema(m_manager->pointTable().layout());
std::ostream *out = FileUtils::createFile(m_PointCloudSchemaOutput);
std::string xml(schema.xml());
out->write(xml.c_str(), xml.size());
FileUtils::closeFile(out);
#else
std::cerr << "libxml2 support not enabled, no schema is produced" <<
std::endl;
#endif
}
if (m_showStats)
root.add(m_statsStage->getMetadata().clone("stats"));
if (m_pipelineFile.size() > 0)
PipelineWriter::writePipeline(m_manager->getStage(), m_pipelineFile);
if (m_pointIndexes.size())
{
PointViewSet viewSet = m_manager->views();
assert(viewSet.size() == 1);
root.add(dumpPoints(*viewSet.begin()).clone("points"));
}
if (m_queryPoint.size())
{
PointViewSet viewSet = m_manager->views();
assert(viewSet.size() == 1);
root.add(dumpQuery(*viewSet.begin()));
}
if (m_showMetadata)
root.add(m_reader->getMetadata().clone("metadata"));
if (m_boundary)
{
PointViewSet viewSet = m_manager->views();
assert(viewSet.size() == 1);
root.add(m_hexbinStage->getMetadata().clone("boundary"));
}
}
示例14: testReadWrite
void testReadWrite(bool compression, bool scaling)
{
FileUtils::deleteFile(tempFilename);
Options writerOptions = getWriterOptions();
if (scaling)
{
writerOptions.add("scale_x", 0.01);
writerOptions.add("scale_y", 0.01);
}
writerOptions.add("compression", compression);
StageFactory f;
{
std::cerr << "*** Writing data!\n";
Options lasReadOpts;
lasReadOpts.add("filename", Support::datapath("las/1.2-with-color.las"));
lasReadOpts.add("count", 11);
LasReader reader;
reader.setOptions(lasReadOpts);
Stage* sqliteWriter(f.createStage("writers.sqlite"));
sqliteWriter->setOptions(writerOptions);
sqliteWriter->setInput(reader);
PointTable table;
sqliteWriter->prepare(table);
sqliteWriter->execute(table);
}
{
Stage* sqliteReader(f.createStage("readers.sqlite"));
sqliteReader->setOptions(getReaderOptions());
PointTable table2;
sqliteReader->prepare(table2);
PointViewSet viewSet = sqliteReader->execute(table2);
EXPECT_EQ(viewSet.size(), 1U);
PointViewPtr view = *viewSet.begin();
using namespace Dimension;
uint16_t reds[] = {68, 54, 112, 178, 134, 99, 90, 106, 106, 100, 64};
for (PointId idx = 0; idx < 11; idx++)
{
uint16_t r = view->getFieldAs<uint16_t>(Id::Red, idx);
EXPECT_EQ(r, reds[idx]);
}
int32_t x = view->getFieldAs<int32_t>(Id::X, 10);
EXPECT_EQ(x, 636038);
double xd = view->getFieldAs<double>(Id::X, 10);
EXPECT_FLOAT_EQ(xd, 636037.53);
}
// FileUtils::deleteFile(tempFilename);
}
示例15: loadSet
PointViewPtr DeltaKernel::loadSet(const std::string& filename,
PointTable& table)
{
Stage& reader = makeReader(filename, m_driverOverride);
reader.prepare(table);
PointViewSet viewSet = reader.execute(table);
assert(viewSet.size() == 1);
return *viewSet.begin();
}