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


C++ StageFactory::createStage方法代码示例

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


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

示例1: bounds

TEST_F(PythonFilterTest, add_dimension)
{
    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"
        "def myfunc(ins,outs):\n"
        "  outs['AddedIntensity'] = np.zeros(ins['X'].size, dtype=numpy.double) + 1\n"
        "  outs['AddedPointSourceId'] = np.zeros(ins['X'].size, dtype=numpy.double) + 2\n"
        "  return True\n"
    );
    Option module("module", "MyModule");
    Option function("function", "myfunc");
    Option intensity("add_dimension", "AddedIntensity");
    Option scanDirection("add_dimension", "AddedPointSourceId");
    Options opts;
    opts.add(source);
    opts.add(module);
    opts.add(function);
    opts.add(intensity);
    opts.add(scanDirection);

    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();

    PointLayoutPtr layout(table.layout());

    Dimension::Id int_id = layout->findDim("AddedIntensity");
    Dimension::Id psid_id = layout->findDim("AddedPointSourceId");

    for (unsigned int i = 0; i < view->size(); ++i)
    {
        EXPECT_EQ(view->getFieldAs<uint16_t>(int_id, i), 1);
        EXPECT_EQ(view->getFieldAs<uint16_t>(psid_id, i), 2);
    }
}
开发者ID:connormanning,项目名称:PDAL,代码行数:52,代码来源:PythonFilterTest.cpp

示例2: bounds

TEST(Stats, metadata)
{
    BOX3D bounds(1.0, 2.0, 3.0, 101.0, 102.0, 103.0);
    Options ops;
    ops.add("bounds", bounds);
    ops.add("count", 1000);
    ops.add("mode", "constant");

    StageFactory f;
    std::unique_ptr<Stage> reader(f.createStage("readers.faux"));
    EXPECT_TRUE(reader.get());
    reader->setOptions(ops);

    Options filterOps;
    filterOps.add("dimensions", " , X, Z ");
    StatsFilter filter;
    filter.setInput(*reader);
    filter.setOptions(filterOps);

    PointTable table;
    filter.prepare(table);
    filter.execute(table);
    MetadataNode m = filter.getMetadata();
    std::vector<MetadataNode> children = m.children("statistic");

    auto findNode = [](MetadataNode m,
        const std::string name, const std::string val)
    {
        auto findNameVal = [name, val](MetadataNode m)
            { return (m.name() == name && m.value() == val); };

        return m.find(findNameVal);
    };

    for (auto mi = children.begin(); mi != children.end(); ++mi)
    {
        if (findNode(*mi, "name", "X").valid())
        {
            EXPECT_DOUBLE_EQ(mi->findChild("average").value<double>(), 1.0);
            EXPECT_DOUBLE_EQ(mi->findChild("minimum").value<double>(), 1.0);
            EXPECT_DOUBLE_EQ(mi->findChild("maximum").value<double>(), 1.0);
            EXPECT_DOUBLE_EQ(mi->findChild("count").value<double>(), 1000.0);
        }
        if (findNode(*mi, "name", "Z").valid())
        {
            EXPECT_DOUBLE_EQ(mi->findChild("average").value<double>(), 3.0);
            EXPECT_DOUBLE_EQ(mi->findChild("minimum").value<double>(), 3.0);
            EXPECT_DOUBLE_EQ(mi->findChild("maximum").value<double>(), 3.0);
            EXPECT_DOUBLE_EQ(mi->findChild("count").value<double>(), 1000.0);
        }
    }
}
开发者ID:mpgerlek,项目名称:PDAL-old,代码行数:52,代码来源:StatsFilterTest.cpp

示例3:

TEST(NitfWriterTest, longFtitle)
{
    StageFactory f;

    Stage *r = f.createStage("readers.las");

    Options ro;
    ro.add("filename", Support::datapath("nitf/autzen-utm10.las"));

    r->setOptions(ro);

    Stage *w = f.createStage("writers.nitf");

    Options wo;
    wo.add("filename", "aaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccddddddddddddddeeeeeeeeeeee");

    w->setOptions(wo);
    w->setInput(*r);

    PointTable t;
    w->prepare(t);
    EXPECT_THROW(w->execute(t), pdal_error);
}
开发者ID:PDAL,项目名称:PDAL,代码行数:23,代码来源:NitfWriterTest.cpp

示例4: r

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());
}
开发者ID:PDAL,项目名称:PDAL,代码行数:37,代码来源:OldPCLBlockTest.cpp

示例5: reader

TEST(IcebridgeReaderTest, testRead)
{
    StageFactory f;
    Stage* reader(f.createStage("readers.icebridge"));
    EXPECT_TRUE(reader);

    Option filename("filename", getFilePath(), "");
    Options options(filename);
    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,
            0,
            141437548,     // time
            82.605319,      // latitude
            -58.593811,     // longitude
            18.678,         // elevation
            2408,           // xmtSig
            181,            // rcvSig
            49.91,          // azimuth
            -4.376,         // pitch
            0.608,          // roll
            2.9,            // gpsPdop
            20.0,           // pulseWidth
            0.0);           // relTime

    checkPoint(
            *view,
            1,
            141437548,     // time
            82.605287,      // latitude
            -58.593811,     // longitude
            18.688,         // elevation
            2642,           // xmtSig
            173,            // rcvSig
            52.006,         // azimuth
            -4.376,         // pitch
            0.609,          // roll
            2.9,            // gpsPdop
            17.0,           // pulseWidth
            0.0);           // relTime
}
开发者ID:OldMogy,项目名称:PDAL,代码行数:49,代码来源:IcebridgeReaderTest.cpp

示例6: writeData

void writeData(Orientation orient, bool scaling, bool compression = false)
{
    Options options;

    options.add("capacity", 10000);
    options.add("connection", std::string(connectString));
    options.add("debug", "true");
    options.add("block_table_name", blockTableName);
    options.add("base_table_name", baseTableName);
    options.add("cloud_column_name", "CLOUD");
    options.add("srid", 26910);
    options.add("disable_cloud_trigger", true);
    options.add("store_dimensional_orientation",
        orient == Orientation::DimensionMajor);
    if (scaling)
    {
        options.add("offset_x", "auto");
        options.add("offset_y", "auto");
        options.add("offset_z", "auto");
        options.add("scale_x", 1e-6);
        options.add("scale_y", 1e-6);
        options.add("scale_z", 1e-6);
    }
    if (compression)
        options.add("compression", true);

    PointTable table;

    Options readerOps;
    readerOps.add("filename", Support::datapath("autzen/autzen-utm.las"));

    StageFactory f;
    LasReader reader;
    reader.setOptions(readerOps);

    SplitFilter split;
    split.setInput(reader);

    Stage* writer(f.createStage("writers.oci"));
    EXPECT_TRUE(writer);
    writer->setOptions(options);
    writer->setInput(split);

    writer->prepare(table);
    writer->execute(table);
}
开发者ID:Rafaelaniemann,项目名称:PDAL,代码行数:46,代码来源:OCITest.cpp

示例7: bounds

TEST(PredicateFilterTest, PredicateFilterTest_test5)
{
    StageFactory f;
    // test error handling if missing Mask

    BOX3D bounds(0.0, 0.0, 0.0, 2.0, 2.0, 2.0);
    Options readerOpts;
    readerOpts.add("bounds", bounds);
    readerOpts.add("num_points", 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['xxxMaskxxx'] = Mask # delierbately rong\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);

    std::unique_ptr<Stage> filter(f.createStage("filters.predicate"));
    filter->setOptions(opts);
    filter->setInput(reader);

    PointTable table;
    filter->prepare(table);

    ASSERT_THROW(filter->execute(table), plang::error);
}
开发者ID:jwend,项目名称:PDAL,代码行数:40,代码来源:PredicateFilterTest.cpp

示例8: stage

TEST_F(MatlabWriterTest, findStage)
{
    StageFactory factory;
    Stage* stage(factory.createStage("writers.matlab"));
    EXPECT_TRUE(stage);
}
开发者ID:EricAlex,项目名称:PDAL,代码行数:6,代码来源:MatlabWriterTest.cpp

示例9: if

TEST(NNDistanceTest, kdist)
{
    StageFactory f;
    Stage *reader(f.createStage("readers.faux"));
    Stage *filter(f.createStage("filters.nndistance"));

    // Make a 10x10x10 grid of points.
    Options rOpts;
    rOpts.add("mode", "grid");
    rOpts.add("bounds", "([0, 10],[0,10],[0,10])");
    rOpts.add("count", 1000);
    reader->setOptions(rOpts);

    // Kth distance with k == 3
    Options fOpts;
    fOpts.add("mode", "kth");
    fOpts.add("k", 3);
    filter->setOptions(fOpts);
    filter->setInput(*reader);
    
    PointTable t;
    filter->prepare(t);
    PointViewSet s = filter->execute(t);
    PointViewPtr v = *(s.begin());

    for (PointId i = 0; i < v->size(); ++i)
        EXPECT_EQ(v->getFieldAs<double>(Dimension::Id::NNDistance, i), 1);

    // Kth distance with k == 4
    Options opts2;
    opts2.add("k", 4);
    filter->setOptions(opts2);

    PointTable t2;
    filter->prepare(t2);
    s = filter->execute(t2);
    v = *(s.begin());

    for (PointId i = 0; i < v->size(); ++i)
    {
        double d = v->getFieldAs<double>(Dimension::Id::NNDistance, i);
        double x = v->getFieldAs<double>(Dimension::Id::X, i);
        double y = v->getFieldAs<double>(Dimension::Id::Y, i);
        double z = v->getFieldAs<double>(Dimension::Id::Z, i);
        if ((x == 9 || x == 0) && (y == 9 || y == 0) && (z == 9 || z == 0))
            EXPECT_EQ(d, sqrt(2));
    }

    // Test for avg distance.
    Options opts3;
    opts3.add("mode", "avg");
    opts3.add("k", 6);
    filter->setOptions(opts3);

    PointTable t3;
    filter->prepare(t3);
    s = filter->execute(t3);
    v = *(s.begin());

    for (PointId i = 0; i < v->size(); ++i)
    {
        double d = v->getFieldAs<double>(Dimension::Id::NNDistance, i);
        double x = v->getFieldAs<double>(Dimension::Id::X, i);
        double y = v->getFieldAs<double>(Dimension::Id::Y, i);
        double z = v->getFieldAs<double>(Dimension::Id::Z, i);
        int xe = (x == 9 || x == 0) ? 1 : 0;
        int ye = (y == 9 || y == 0) ? 1 : 0;
        int ze = (z == 9 || z == 0) ? 1 : 0;
        bool corner = (xe + ye + ze == 3);
        bool edge = (xe + ye + ze == 2);
        bool face = (xe + ye + ze == 1);
        if (corner)
            EXPECT_EQ(d, (1 + std::sqrt(2)) / 2.0);
        else if (edge)
            EXPECT_EQ(d, (2 + std::sqrt(2)) / 3.0);
        else if (face)
            EXPECT_EQ(d, (5 + std::sqrt(2)) / 6.0);
        else
            EXPECT_EQ(d, 1);
    }
}
开发者ID:PDAL,项目名称:PDAL,代码行数:81,代码来源:NNDistanceTest.cpp

示例10: filter

TEST(FerryFilterTest, create)
{
    StageFactory f;
    Stage* filter(f.createStage("filters.ferry"));
    EXPECT_TRUE(filter);
}
开发者ID:EricAlex,项目名称:PDAL,代码行数:6,代码来源:FerryFilterTest.cpp

示例11: filter

TEST(DecimationFilterTest, create)
{
    StageFactory f;
    Stage* filter(f.createStage("filters.decimation"));
    EXPECT_TRUE(filter);
}
开发者ID:EricAlex,项目名称:PDAL,代码行数:6,代码来源:DecimationFilterTest.cpp

示例12: filter

TEST(TransformationMatrix, create)
{
    StageFactory f;
    Stage* filter(f.createStage("filters.transformation"));
    EXPECT_TRUE(filter);
}
开发者ID:EricAlex,项目名称:PDAL,代码行数:6,代码来源:TransformationFilterTest.cpp

示例13: debug

TEST(NitfWriterTest, test1)
{
    StageFactory f;

    const std::string las_input(Support::datapath("las/1.2-with-color.las"));
    const std::string nitf_output(Support::temppath("temp_nitf.ntf"));
    const std::string reference_output(
        Support::datapath("nitf/write_test1.ntf"));

    FileUtils::deleteFile(nitf_output);

    //
    // write the NITF
    //
    {
        Options reader_opts;
        Option reader_opt1("filename", las_input);
        reader_opts.add(reader_opt1);

        Options writer_opts;
        Option writer_opt1("filename", nitf_output);
        Option debug("debug", true);
        Option verbose("verbose", 8);

        Option datetime("idatim", "20110516183337");
        writer_opts.add(datetime);

        Option cls("fsclas", "S");
        writer_opts.add(cls);

        Option phone("ophone", "5159664628");
        writer_opts.add(phone);

        Option name("oname", "Howard Butler");
        writer_opts.add(name);

        Option ftitle("ftitle", "LiDAR from somewhere");
        writer_opts.add(ftitle);

        // writer_opts.add(debug);
        // writer_opts.add(verbose);
        writer_opts.add(writer_opt1);

        Stage* reader(f.createStage("readers.las"));
        EXPECT_TRUE(reader);
        reader->setOptions(reader_opts);

        Stage* writer(f.createStage("writers.nitf"));
        EXPECT_TRUE(writer);
        writer->setOptions(writer_opts);
        writer->setInput(*reader);
        {
            // writer.setCompressed(false);
            // // writer.setDate(0, 0);
            // // writer.setPointFormat(::drivers::las::PointFormat3);
            // // writer.setSystemIdentifier("");
            // writer.setGeneratingSoftware("PDAL-NITF");
            // writer.setChunkSize(100);
        }
        PointTable table;
        writer->prepare(table);
        writer->execute(table);
    }

    //
    // check the generated NITF
    //
    //ABELL - This doesn't work and is probably broken because the reference
    //  file is out of date, but some method of comparing the NITF wrapper
    //  instead of a byte-by-byte file diff is probably in order.
/**
    bool filesSame = Support::compare_files(nitf_output, reference_output);
    EXPECT_TRUE(filesSame);
**/

    //
    // check the LAS contents against the source image
    //
    //ABELL - This tells us that the packaged file (LAS) is fine, but it
    //  doesn't tell us much about the NITF wrapper.
    compare_contents(las_input, nitf_output);

//    if (filesSame)
        FileUtils::deleteFile(Support::temppath(nitf_output));
}
开发者ID:FeodorFitsner,项目名称:PDAL,代码行数:85,代码来源:NitfWriterTest.cpp

示例14: filter

TEST(ComputeRangeFilterTest, create)
{
    StageFactory f;
    Stage* filter(f.createStage("filters.computerange"));
    EXPECT_TRUE(filter);
}
开发者ID:mloskot,项目名称:PDAL,代码行数:6,代码来源:ComputeRangeFilterTest.cpp

示例15: execute

int SortKernel::execute()
{
    PointTable table;

    Options readerOptions;
    readerOptions.add("filename", m_inputFile);
    readerOptions.add("debug", isDebug());
    readerOptions.add("verbose", getVerboseLevel());

    Stage& readerStage = makeReader(readerOptions);

    // go ahead and prepare/execute on reader stage only to grab input
    // PointViewSet, this makes the input PointView available to both the
    // processing pipeline and the visualizer
    readerStage.prepare(table);
    PointViewSet viewSetIn = readerStage.execute(table);

    // the input PointViewSet will be used to populate a BufferReader that is
    // consumed by the processing pipeline
    PointViewPtr inView = *viewSetIn.begin();

    BufferReader bufferReader;
    bufferReader.setOptions(readerOptions);
    bufferReader.addView(inView);

    Options sortOptions;
    sortOptions.add<bool>("debug", isDebug());
    sortOptions.add<uint32_t>("verbose", getVerboseLevel());

    StageFactory f;
    Stage& sortStage = ownStage(f.createStage("filters.mortonorder"));
    sortStage.setInput(bufferReader);
    sortStage.setOptions(sortOptions);

    Options writerOptions;
    writerOptions.add("filename", m_outputFile);
    setCommonOptions(writerOptions);

    if (m_bCompress)
        writerOptions.add("compression", true);
    if (m_bForwardMetadata)
        writerOptions.add("forward_metadata", true);

    std::vector<std::string> cmd = getProgressShellCommand();
    UserCallback *callback =
        cmd.size() ? (UserCallback *)new ShellScriptCallback(cmd) :
        (UserCallback *)new HeartbeatCallback();

    Stage& writer = makeWriter(m_outputFile, sortStage);

    // Some options are inferred by makeWriter based on filename
    // (compression, driver type, etc).
    writer.setOptions(writerOptions + writer.getOptions());
    writer.setUserCallback(callback);

    for (const auto& pi : getExtraStageOptions())
    {
        std::string name = pi.first;
        Options options = pi.second;
        //ABELL - Huh?
        std::vector<Stage *> stages = writer.findStage(name);
        for (const auto& s : stages)
        {
            Options opts = s->getOptions();
            for (const auto& o : options.getOptions())
                opts.add(o);
            s->setOptions(opts);
        }
    }
    writer.prepare(table);

    // process the data, grabbing the PointViewSet for visualization of the
    PointViewSet viewSetOut = writer.execute(table);

    if (isVisualize())
        visualize(*viewSetOut.begin());

    return 0;
}
开发者ID:devrimgunduz,项目名称:PDAL,代码行数:79,代码来源:SortKernel.cpp


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