当前位置: 首页>>代码示例>>C++>>正文


C++ PointViewSet::begin方法代码示例

本文整理汇总了C++中PointViewSet::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ PointViewSet::begin方法的具体用法?C++ PointViewSet::begin怎么用?C++ PointViewSet::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PointViewSet的用法示例。


在下文中一共展示了PointViewSet::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

TEST(LasReaderTest, EmptyGeotiffVlr)
{
    PointTable table;

    Options readOps;
    readOps.add("filename", Support::datapath("las/1.2-empty-geotiff-vlrs.las"));
    LasReader reader;
    reader.setOptions(readOps);

    reader.prepare(table);
    PointViewSet viewSet = reader.execute(table);
    PointViewPtr view = *viewSet.begin();

    EXPECT_EQ(43u, view->size());

}
开发者ID:pblottiere,项目名称:PDAL,代码行数:16,代码来源:LasReaderTest.cpp

示例2: view

TEST(LasWriterTest, auto_offset)
{
    using namespace Dimension;

    const std::string FILENAME(Support::temppath("offset_test.las"));
    PointTable table;

    table.layout()->registerDim(Id::X);

    PointViewPtr view(new PointView(table));
    view->setField(Id::X, 0, 125000.00);
    view->setField(Id::X, 1, 74529.00);
    view->setField(Id::X, 2, 523523.02);

    Options writerOps;
    writerOps.add("filename", FILENAME);
    writerOps.add("offset_x", "auto");
    writerOps.add("scale_x", "auto");

    LasWriter writer;
    writer.setOptions(writerOps);

    writer.prepare(table);

    WriterWrapper::ready(writer, table);
    WriterWrapper::write(writer, view);
    WriterWrapper::done(writer, table);

    Options readerOps;
    readerOps.add("filename", FILENAME);

    PointTable readTable;

    LasReader reader;
    reader.setOptions(readerOps);

    reader.prepare(readTable);
    EXPECT_DOUBLE_EQ(74529.00, reader.header().offsetX());
    PointViewSet viewSet = reader.execute(readTable);
    EXPECT_EQ(viewSet.size(), 1u);
    view = *viewSet.begin();
    EXPECT_EQ(view->size(), 3u);
    EXPECT_NEAR(125000.00, view->getFieldAs<double>(Id::X, 0), .0001);
    EXPECT_NEAR(74529.00, view->getFieldAs<double>(Id::X, 1), .0001);
    EXPECT_NEAR(523523.02, view->getFieldAs<double>(Id::X, 2), .0001);
    FileUtils::deleteFile(FILENAME);
}
开发者ID:neteler,项目名称:PDAL,代码行数:47,代码来源:LasWriterTest.cpp

示例3:

TEST_F(PythonFilterTest, pipelineJSON)
{
    PipelineManager manager;

    manager.readPipeline(
        Support::configuredpath("plang/programmable-update-y-dims.json"));
    manager.execute();
    PointViewSet viewSet = manager.views();
    EXPECT_EQ(viewSet.size(), 1u);
    PointViewPtr view = *viewSet.begin();

    for (PointId idx = 0; idx < 10; ++idx)
    {
        int32_t y = view->getFieldAs<int32_t>(Dimension::Id::Y, idx);
        EXPECT_EQ(y, 314);
    }
}
开发者ID:connormanning,项目名称:PDAL,代码行数:17,代码来源:PythonFilterTest.cpp

示例4:

TEST(TextReaderTest, strip_whitespace_from_dimension_names)
{
    TextReader reader;
    Options options;
    options.add("filename", Support::datapath("text/crlf_test.txt"));
    reader.setOptions(options);

    PointTable table;
    reader.prepare(table);
    PointViewSet pointViewSet = reader.execute(table);
    PointViewPtr pointViewPtr = *pointViewSet.begin();

    for (PointId i = 0; i < pointViewPtr->size(); ++i) {
        EXPECT_EQ(
            i, pointViewPtr->getFieldAs<uint16_t>(Dimension::Id::Intensity, i));
    }
}
开发者ID:PDAL,项目名称:PDAL,代码行数:17,代码来源:TextReaderTest.cpp

示例5: layout

TEST(ComputeRangeFilterTest, compute)
{
    using namespace Dimension;

    PointTable table;
    PointLayoutPtr layout(table.layout());

    layout->registerDim(Id::X);
    layout->registerDim(Id::Y);
    layout->registerDim(Id::Z);
    Id pn = layout->registerOrAssignDim("Pixel Number", Type::Double);
    Id fn = layout->registerOrAssignDim("Frame Number", Type::Double);

    PointViewPtr view(new PointView(table));

    BufferReader r;
    r.addView(view);

    ComputeRangeFilter crop;
    crop.setInput(r);
    crop.prepare(table);

    view->setField(Id::X, 0, 0.0);
    view->setField(Id::Y, 0, 0.0);
    view->setField(Id::Z, 0, 0.0);
    view->setField(pn, 0, 0.0);
    view->setField(fn, 0, 0.0);

    view->setField(Id::X, 1, 0.0);
    view->setField(Id::Y, 1, 3.0);
    view->setField(Id::Z, 1, 4.0);
    view->setField(pn, 1, -5.0);
    view->setField(fn, 1, 0.0);

    PointViewSet s = crop.execute(table);
    EXPECT_EQ(1u, s.size());

    Id range = layout->findDim("Range");
    EXPECT_NE(Id::Unknown, range);

    PointViewPtr out = *s.begin();
    EXPECT_EQ(2u, out->size());

    EXPECT_EQ(5.0, out->getFieldAs<double>(range, 0));
    EXPECT_EQ(0.0, out->getFieldAs<double>(range, 1));
}
开发者ID:mloskot,项目名称:PDAL,代码行数:46,代码来源:ComputeRangeFilterTest.cpp

示例6:

TEST_F(TransformationFilterTest, Rotation)
{
    Options filterOpts;
    filterOpts.add("matrix", "0 1 0 0\n-1 0 0 0\n0 0 1 0\n0 0 0 1");
    m_filter.setOptions(filterOpts);

    PointTable table;
    m_filter.prepare(table);
    PointViewSet viewSet = m_filter.execute(table);
    PointViewPtr view = *viewSet.begin();

    for (point_count_t i = 0; i < view->size(); ++i)
    {
        EXPECT_DOUBLE_EQ(2, view->getFieldAs<double>(Dimension::Id::X, i));
        EXPECT_DOUBLE_EQ(-1, view->getFieldAs<double>(Dimension::Id::Y, i));
        EXPECT_DOUBLE_EQ(3, view->getFieldAs<double>(Dimension::Id::Z, i));
    }
}
开发者ID:EricAlex,项目名称:PDAL,代码行数:18,代码来源:TransformationFilterTest.cpp

示例7: checkPoint

TEST(PlyReader, ReadBinary)
{
    PlyReader reader;
    Options options;
    options.add("filename", Support::datapath("ply/simple_binary.ply"));
    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, 0, -1, 0, 0);
    checkPoint(view, 1, 0, 1, 0);
    checkPoint(view, 2, 1, 0, 0);
}
开发者ID:adam-erickson,项目名称:PDAL,代码行数:18,代码来源:PlyReaderTest.cpp

示例8: getName

// Make sure that spatialreference works for random readers
TEST(json, issue_2159)
{
    class XReader : public Reader
    {
        std::string getName() const
            { return "readers.x"; }

        virtual void addDimensions(PointLayoutPtr layout)
        {
            using namespace Dimension;

            layout->registerDims( { Id::X, Id::Y, Id::Z } );
        }

        virtual point_count_t read(PointViewPtr v, point_count_t count)
        {
            using namespace Dimension;

            for (PointId idx = 0; idx < count; ++idx)
            {
                v->setField(Id::X, idx, idx);
                v->setField(Id::Y, idx, 10 * idx);
                v->setField(Id::Z, idx, 1.152);
            }
            return count;
        }
    };

    XReader xr;
    Options rOpts;
    rOpts.add("count", "1000");
    rOpts.add("spatialreference", "EPSG:4326");
    xr.setOptions(rOpts);

    StatsFilter f;
    f.setInput(xr);

    PointTable t;
    f.prepare(t);
    PointViewSet s = f.execute(t);
    PointViewPtr v = *(s.begin());
    SpatialReference srs = v->spatialReference();
    EXPECT_EQ(srs, SpatialReference("EPSG:4326"));
}
开发者ID:chambbj,项目名称:PDAL,代码行数:45,代码来源:pcpipelineTestJSON.cpp

示例9: bounds

TEST_F(PythonFilterTest, pdalargs)
{
    StageFactory f;

    BOX3D bounds(0.0, 0.0, 0.0, 1.0, 1.0, 1.0);

    Options ops;
    ops.add("bounds", bounds);
    ops.add("count", 10);
    ops.add("mode", "ramp");

    FauxReader reader;
    reader.setOptions(ops);

    Option source("source", "import numpy\n"
        "import sys\n"
        "import redirector\n"
        "def myfunc(ins,outs):\n"
        "  pdalargs['name']\n"
        "# print ('pdalargs', pdalargs, file=sys.stderr,)\n"
        "  return True\n"
    );
    Option module("module", "MyModule");
    Option function("function", "myfunc");
    Option args("pdalargs", "{\"name\":\"Howard\",\"something\":42, \"another\": \"True\"}");
    Options opts;
    opts.add(source);
    opts.add(module);
    opts.add(function);
    opts.add(args);

    Stage* filter(f.createStage("filters.python"));
    filter->setOptions(opts);
    filter->setInput(reader);

    PointTable table;
    filter->prepare(table);
    PointViewSet viewSet = filter->execute(table);
    EXPECT_EQ(viewSet.size(), 1u);
    PointViewPtr view = *viewSet.begin();

    // Not throwing anything is success for now
}
开发者ID:connormanning,项目名称:PDAL,代码行数:43,代码来源:PythonFilterTest.cpp

示例10: wkt

TEST(CropFilterTest, test_crop_polygon_reprojection)
{
    Options options;

    options.add("spatialreference", Support::datapath("autzen/autzen-srs.wkt"));
    options.add("out_srs", "EPSG:4326");
    options.add("x_dim", std::string("readers.las.X"));
    options.add("y_dim", std::string("readers.las.Y"));
    options.add("z_dim", std::string("readers.las.Z"));
    options.add("scale_x", 0.0000001f);
    options.add("scale_y", 0.0000001f);
    options.add("filename", Support::datapath("las/1.2-with-color.las"));

    std::istream* wkt_stream = FileUtils::openFile(
        Support::datapath("autzen/autzen-selection-dd.wkt"));
    std::stringstream strbuf;
    strbuf << wkt_stream->rdbuf();
    std::string wkt(strbuf.str());

    Option polygon("polygon", wkt);
    options.add(polygon);

    LasReader reader;
    reader.setOptions(options);

    ReprojectionFilter reprojection;
    reprojection.setOptions(options);
    reprojection.setInput(reader);

    CropFilter crop;
    crop.setOptions(options);
    crop.setInput(reprojection);

    PointTable table;
    PointViewPtr view(new PointView(table));
    crop.prepare(table);
    PointViewSet viewSet = crop.execute(table);
    EXPECT_EQ(viewSet.size(), 1u);
    view = *viewSet.begin();
    EXPECT_EQ(view->size(), 47u);

    FileUtils::closeFile(wkt_stream);
}
开发者ID:GEO-IASS,项目名称:PDAL,代码行数:43,代码来源:CropFilterTest.cpp

示例11:

TEST(LasWriterTest, fix1063_1064_1065)
{
    std::string outfile = Support::temppath("out.las");
    std::string infile = Support::datapath("las/test1_4.las");

    FileUtils::deleteFile(outfile);


    std::string cmd = "pdal translate --writers.las.forward=all "
        "--writers.las.a_srs=\"EPSG:4326\" " + infile + " " + outfile;
    std::string output;
    Utils::run_shell_command(Support::binpath(cmd), output);

    Options o;
    o.add("filename", outfile);

    LasReader r;
    r.setOptions(o);

    PointTable t;
    r.prepare(t);
    PointViewSet s = r.execute(t);
    EXPECT_EQ(s.size(), 1u);
    PointViewPtr v = *s.begin();
    EXPECT_EQ(v->size(), 1000u);

    // https://github.com/PDAL/PDAL/issues/1063
    for (PointId idx = 0; idx < v->size(); ++idx)
        EXPECT_EQ(8, v->getFieldAs<int>(Dimension::Id::ClassFlags, idx));

    // https://github.com/PDAL/PDAL/issues/1064
    MetadataNode m = r.getMetadata();
    m = m.findChild("global_encoding");
    EXPECT_EQ(17, m.value<int>());

    // https://github.com/PDAL/PDAL/issues/1065
    SpatialReference ref = v->spatialReference();
    std::string wkt = "GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]]";
    EXPECT_EQ(ref.getWKT(), wkt);
}
开发者ID:cugwhp,项目名称:PDAL,代码行数:40,代码来源:LasWriterTest.cpp

示例12:

TEST(MergeTest, test3)
{
    using namespace pdal;

    PipelineManager mgr;
    mgr.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(1u, viewSet.size());
    PointViewPtr view = *viewSet.begin();
    EXPECT_EQ(2130u, view->size());
}
开发者ID:EricAlex,项目名称:PDAL,代码行数:22,代码来源:MergeTest.cpp

示例13: verify

TEST(GDALReaderTest, simple)
{
    Options ro;
    ro.add("filename", Support::datapath("png/autzen-height.png"));

    GDALReader gr;
    gr.setOptions(ro);

    PointTable t;
    gr.prepare(t);
    PointViewSet s = gr.execute(t);
    PointViewPtr v = *s.begin();
    PointLayoutPtr l = t.layout();
    Dimension::Id::Enum id1 = l->findDim("band-1");
    Dimension::Id::Enum id2 = l->findDim("band-2");
    Dimension::Id::Enum id3 = l->findDim("band-3");
    EXPECT_EQ(v->size(), (size_t)(735 * 973));

    auto verify = [v, id1, id2, id3]
        (PointId idx, double xx, double xy, double xr, double xg, double xb)
    {
        double r, g, b, x, y;
        x = v->getFieldAs<double>(Dimension::Id::X, idx);
        y = v->getFieldAs<double>(Dimension::Id::Y, idx);
        r = v->getFieldAs<double>(id1, idx);
        g = v->getFieldAs<double>(id2, idx);
        b = v->getFieldAs<double>(id3, idx);
        EXPECT_DOUBLE_EQ(x, xx);
        EXPECT_DOUBLE_EQ(y, xy);
        EXPECT_DOUBLE_EQ(r, xr);
        EXPECT_DOUBLE_EQ(g, xg);
        EXPECT_DOUBLE_EQ(b, xb);
    };

    verify(0, .5, .5, 0, 0, 0);
    verify(120000, 195.5, 163.5, 255, 213, 0);
    verify(290000, 410.5, 394.5, 0, 255, 206);
    verify(715154, 734.5, 972.5, 0, 0, 0);
}
开发者ID:EricAlex,项目名称:PDAL,代码行数:39,代码来源:GDALReaderTest.cpp

示例14:

TEST(PtsReader, ReadPtsExtraDims)
{
    PtsReader reader;
    Options options;
    options.add("filename", Support::datapath("pts/test.pts"));
    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(), 19u);

    PointLayout *layout = view->layout();
    EXPECT_FLOAT_EQ(view->getFieldAs<float>(Dimension::Id::X, 0), 3.9809721f);
    EXPECT_FLOAT_EQ(view->getFieldAs<float>(Dimension::Id::Y, 0), -2.006119f);
    EXPECT_FLOAT_EQ(view->getFieldAs<float>(Dimension::Id::Z, 0), -0.010086f);
    EXPECT_EQ(view->getFieldAs<int>(Dimension::Id::Red, 0), 97);
    EXPECT_EQ(view->getFieldAs<int>(Dimension::Id::Green, 0), 59);
    EXPECT_EQ(view->getFieldAs<int>(Dimension::Id::Blue, 0), 38);
}
开发者ID:connormanning,项目名称:PDAL,代码行数:22,代码来源:PtsReaderTest.cpp

示例15: out_ref

// Test reprojecting UTM 15 to DD with a filter
TEST(ReprojectionFilterTest, ReprojectionFilterTest_test_1)
{
    const char* epsg4326_wkt = "GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433],AUTHORITY[\"EPSG\",\"4326\"]]";

    PointTable table;

    const double postX = -93.351563;
    const double postY = 41.577148;
    const double postZ = 16.000000;

    {
        const SpatialReference out_ref(epsg4326_wkt);

        Options ops1;
        ops1.add("filename", Support::datapath("las/utm15.las"));
        LasReader reader;
        reader.setOptions(ops1);

        Options options;
        options.add("out_srs", out_ref.getWKT());

        ReprojectionFilter reprojectionFilter;
        reprojectionFilter.setOptions(options);
        reprojectionFilter.setInput(reader);

        reprojectionFilter.prepare(table);
        PointViewSet viewSet = reprojectionFilter.execute(table);
        EXPECT_EQ(viewSet.size(), 1u);
        PointViewPtr view = *viewSet.begin();

        double x, y, z;
        getPoint(*view.get(), x, y, z);

        EXPECT_FLOAT_EQ(x, postX);
        EXPECT_FLOAT_EQ(y, postY);
        EXPECT_FLOAT_EQ(z, postZ);
    }
}
开发者ID:Rafaelaniemann,项目名称:PDAL,代码行数:39,代码来源:ReprojectionFilterTest.cpp


注:本文中的PointViewSet::begin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。