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


C++ PointTable::layout方法代码示例

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


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

示例1: view

TEST(KDIndex, neighbordims)
{
    PointTable table;
    PointLayoutPtr layout = table.layout();
    PointView view(table);

    layout->registerDim(Dimension::Id::X);
    layout->registerDim(Dimension::Id::Z);

    view.setField(Dimension::Id::X, 0, 0);
    view.setField(Dimension::Id::Z, 0, 0);
    
    view.setField(Dimension::Id::X, 1, 1);
    view.setField(Dimension::Id::Z, 1, 1);
    
    EXPECT_THROW(KD2Index index(view), pdal_error);

    PointTable table2;
    PointLayoutPtr layout2 = table.layout();
    PointView view2(table2);

    layout->registerDim(Dimension::Id::X);
    layout->registerDim(Dimension::Id::Y);

    view.setField(Dimension::Id::X, 0, 0);
    view.setField(Dimension::Id::Y, 0, 0);
    
    view.setField(Dimension::Id::X, 1, 1);
    view.setField(Dimension::Id::Y, 1, 1);
    
    EXPECT_THROW(KD3Index index(view2), pdal_error);
}
开发者ID:EricAlex,项目名称:PDAL,代码行数:32,代码来源:KDIndexTest.cpp

示例2: execute

int DeltaKernel::execute()
{
    PointTable srcTable;
    PointTable candTable;
    DimIndexMap dims;

    PointViewPtr srcView = loadSet(m_sourceFile, srcTable);
    PointViewPtr candView = loadSet(m_candidateFile, candTable);

    PointLayoutPtr srcLayout = srcTable.layout();
    PointLayoutPtr candLayout = candTable.layout();

    Dimension::IdList ids = srcLayout->dims();
    for (Dimension::Id dim : ids)
    {
        std::string name = srcLayout->dimName(dim);
        if (!m_allDims)
            if (name != "X" && name != "Y" && name != "Z")
                continue;
        DimIndex d;
        d.m_name = name;
        d.m_srcId = dim;
        dims[name] = d;
    }
    ids = candLayout->dims();
    for (Dimension::Id dim : ids)
    {
        std::string name = candLayout->dimName(dim);
        auto di = dims.find(name);
        if (di == dims.end())
            continue;
        DimIndex& d = di->second;
        d.m_candId = dim;
    }

    // Remove dimensions that aren't in both the source and candidate lists.
    for (auto di = dims.begin(); di != dims.end();)
    {
        DimIndex& d = di->second;
        if (d.m_candId == Dimension::Id::Unknown)
            dims.erase(di++);
        else
            ++di;
    }

    // Index the candidate data.
    KD3Index index(*candView);
    index.build();

    MetadataNode root;

    if (m_detail)
        root = dumpDetail(srcView, candView, index, dims);
    else
        root = dump(srcView, candView, index, dims);
    Utils::toJSON(root, std::cout);

    return 0;
}
开发者ID:jasonoverland,项目名称:PDAL,代码行数:59,代码来源:DeltaKernel.cpp

示例3:

TEST(FerryFilterTest, test_ferry_invalid)
{
    Options ops1;
    ops1.add("filename", Support::datapath("las/1.2-with-color.las"));
    LasReader reader;
    reader.setOptions(ops1);

    Options op1;

    op1.add("dimensions", "X=X");

    FerryFilter f1;
    f1.setInput(reader);
    f1.setOptions(op1);

    PointTable table;

    // Make sure we can't ferry to ourselves.
    EXPECT_THROW(f1.prepare(table), pdal_error);

    Options op2;

    op2.add("dimension", "X=NewX");
    FerryFilter f2;
    f2.setInput(reader);
    f2.setOptions(op2);

    // Make sure we reject old option name.
    EXPECT_THROW(f2.prepare(table), pdal_error);

    Options op3;

    op3.add("dimensions", "NewX = X");
    FerryFilter f3;
    f3.setInput(reader);
    f3.setOptions(op3);

    // Make sure we reject bad source dimension.
    EXPECT_THROW(f3.prepare(table), pdal_error);

    Options op4;

    op4.add("dimensions", "X = Y, X = NewZ = NewQ");
    FerryFilter f4;
    f4.setInput(reader);
    f4.setOptions(op4);

    // Make sure we reject bad option format.
    EXPECT_THROW(f4.prepare(table), pdal_error);

    Options op5;
    op5.add("dimensions", "=Foobar");
    FerryFilter f5;
    f5.setInput(reader);
    f5.setOptions(op5);
    f5.prepare(table);
    EXPECT_TRUE(table.layout()->findDim("Foobar") != Dimension::Id::Unknown);
}
开发者ID:pblottiere,项目名称:PDAL,代码行数:58,代码来源:FerryFilterTest.cpp

示例4: 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

示例5: layout

TEST(SegmentationTest, BasicClustering)
{
    using namespace Segmentation;

    std::vector<std::vector<PointId>> clusters;

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

    layout->registerDim(Dimension::Id::X);
    layout->registerDim(Dimension::Id::Y);
    layout->registerDim(Dimension::Id::Z);

    PointViewPtr src(new PointView(table));

    // Single point, single cluster
    src->setField(Dimension::Id::X, 0, 0.0);
    src->setField(Dimension::Id::Y, 0, 0.0);
    src->setField(Dimension::Id::Z, 0, 0.0);
    clusters = extractClusters(*src, 1, 10, 1.0);
    EXPECT_EQ(1u, clusters.size());
    EXPECT_EQ(1u, clusters[0].size());

    // Two separate clusters, both with single point
    src->setField(Dimension::Id::X, 1, 10.0);
    src->setField(Dimension::Id::Y, 1, 10.0);
    src->setField(Dimension::Id::Z, 1, 10.0);
    clusters = extractClusters(*src, 1, 10, 1.0);
    EXPECT_EQ(2u, clusters.size());
    EXPECT_EQ(1u, clusters[0].size());
    EXPECT_EQ(1u, clusters[1].size());

    // Still two clusters, one with two points
    src->setField(Dimension::Id::X, 2, 0.5);
    src->setField(Dimension::Id::Y, 2, 0.5);
    src->setField(Dimension::Id::Z, 2, 0.5);
    clusters = extractClusters(*src, 1, 10, 1.0);
    EXPECT_EQ(2u, clusters.size());
    EXPECT_EQ(2u, clusters[0].size());
    EXPECT_EQ(1u, clusters[1].size());

    // Reject the cluster with only one point
    clusters = extractClusters(*src, 2, 10, 1.0);
    EXPECT_EQ(1u, clusters.size());
    EXPECT_EQ(2u, clusters[0].size());

    // Reject the cluster with two points
    clusters = extractClusters(*src, 1, 1, 1.0);
    EXPECT_EQ(1u, clusters.size());
    EXPECT_EQ(1u, clusters[0].size());
}
开发者ID:PDAL,项目名称:PDAL,代码行数:51,代码来源:SegmentationTest.cpp

示例6: ReadXML

TEST(XMLSchemaTest, copy)
{
    using namespace pdal;

    std::string xml = ReadXML(TestConfig::dataPath() +
        "../../schemas/16-dim-schema.xml");
    std::string xsd = ReadXML(TestConfig::dataPath() + "../../schemas/LAS.xsd");

    XMLSchema s1(xml, xsd);

    PointTable table;
    XMLDimList dims = s1.xmlDims();
    for (auto di = dims.begin(); di != dims.end(); ++di)
    {
        Dimension::Id id =
            table.layout()->registerOrAssignDim(
                    di->m_name,
                    di->m_dimType.m_type);
        s1.setId(di->m_name, id);
    }

    MetadataNode m;

    MetadataNode m1 = m.add("m1", 1u);
    MetadataNode m2 = m.add("m2", 1);
    MetadataNode m1prime = m.add("m1prime", "Some other metadata");
    m1.add("uuid", Uuid());

    XMLSchema s2(s1.xmlDims(), m);
    std::string xml_output = s2.xml();

    XMLSchema s3(xml_output, xsd);
    XMLDimList dims3 = s3.xmlDims();

    EXPECT_EQ(dims.size(), dims3.size());

    auto di1 = dims.begin();
    auto di3 = dims3.begin();
    while (di1 != dims.end() && di3 != dims3.end())
    {
        XMLDim& dim1 = *di1;
        XMLDim& dim3 = *di3;

        EXPECT_EQ(dim1.m_name, dim3.m_name);
        EXPECT_EQ(dim1.m_dimType.m_type, dim3.m_dimType.m_type);
        di1++;
        di3++;
    }
}
开发者ID:PDAL,项目名称:PDAL,代码行数:49,代码来源:XMLSchemaTest.cpp

示例7: view

TEST(LasWriterTest, auto_offset)
{
    using namespace Dimension;

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

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

    BufferReader bufferReader;

    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);
    bufferReader.addView(view);

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

    LasWriter writer;
    writer.setOptions(writerOps);
    writer.setInput(bufferReader);

    writer.prepare(table);
    writer.execute(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:cugwhp,项目名称:PDAL,代码行数:48,代码来源:LasWriterTest.cpp

示例8: layout

TEST(PointViewTest, calcBounds)
{
    auto set_points = [](PointViewPtr view, PointId i, double x, double y,
        double z)
    {
        view->setField(Dimension::Id::X, i, x);
        view->setField(Dimension::Id::Y, i, y);
        view->setField(Dimension::Id::Z, i, z);
    };

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

    layout->registerDim(Dimension::Id::X);
    layout->registerDim(Dimension::Id::Y);
    layout->registerDim(Dimension::Id::Z);

    const double lim_min = (std::numeric_limits<double>::lowest)();
    const double lim_max = (std::numeric_limits<double>::max)();
    PointViewPtr b0(new PointView(table));
    BOX3D box_b0;
    b0->calculateBounds(box_b0);
    check_bounds(box_b0, lim_max, lim_min, lim_max, lim_min, lim_max, lim_min);

    PointViewPtr b1(new PointView(table));
    set_points(b1, 0, 0.0, 0.0, 0.0);
    set_points(b1, 1, 2.0, 2.0, 2.0);

    PointViewPtr b2(new PointView(table));
    set_points(b2, 0, 3.0, 3.0, 3.0);
    set_points(b2, 1, 1.0, 1.0, 1.0);

    PointViewSet bs;
    bs.insert(b1);
    bs.insert(b2);

    BOX3D box_b1;
    b1->calculateBounds(box_b1);
    check_bounds(box_b1, 0.0, 2.0, 0.0, 2.0, 0.0, 2.0);

    BOX3D box_b2;
    b2->calculateBounds(box_b2);
    check_bounds(box_b2, 1.0, 3.0, 1.0, 3.0, 1.0, 3.0);

    BOX3D box_bs;
    PointView::calculateBounds(bs, box_bs);
    check_bounds(box_bs, 0.0, 3.0, 0.0, 3.0, 0.0, 3.0);
}
开发者ID:EricAlex,项目名称:PDAL,代码行数:48,代码来源:PointViewTest.cpp

示例9: 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

示例10:

TEST(TextReaderTest, insertHeader)
{
    TextReader reader;
    Options options;
    options.add("header", "A,B,C,G");
    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();

    EXPECT_EQ(pointViewPtr->size(), 11U);
    PointLayoutPtr layout = table.layout();
    EXPECT_TRUE(layout->findDim("A") != Dimension::Id::Unknown);
    EXPECT_TRUE(layout->findDim("B") != Dimension::Id::Unknown);
    EXPECT_TRUE(layout->findDim("C") != Dimension::Id::Unknown);
    EXPECT_TRUE(layout->findDim("G") != Dimension::Id::Unknown);
}
开发者ID:PDAL,项目名称:PDAL,代码行数:20,代码来源:TextReaderTest.cpp

示例11: 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

示例12: p

TEST(PolygonTest, covers)
{
    using namespace pdal::Dimension;

    pdal::Polygon p(getWKT());

    PointTable table;
    PointLayoutPtr layout(table.layout());
    layout->registerDim(Dimension::Id::X);
    layout->registerDim(Dimension::Id::Y);


    // Check if the very first point in the polygon is
    // covered by the polyg. Should be true
    //
    PointViewPtr view(new PointView(table));
    view->setField(Id::X, 0, 636889.412951239268295 );
    view->setField(Id::Y, 0, 851528.512293258565478);

    pdal::PointRef ref(*view, 0);
    bool covered = p.covers(ref);
    EXPECT_EQ(covered, true);
}
开发者ID:rotorliu,项目名称:PDAL,代码行数:23,代码来源:PolygonTest.cpp

示例13: layout

TEST(PointViewTest, issue1264)
{
    PointTable t;
    PointLayoutPtr layout(t.layout());
    Dimension::Id foo = layout->assignDim("foo", Dimension::Type::Unsigned8);
    Dimension::Id bar = layout->assignDim("bar", Dimension::Type::Signed8);
    layout->finalize();

    PointView v(t);
    double d(250.0);
    v.setField(foo, 0, d);
    d = v.getFieldAs<double>(foo, 0);
    EXPECT_DOUBLE_EQ(d, 250.0);
    d = 123.0;
    v.setField(bar, 0, d);
    d = v.getFieldAs<double>(bar, 0);
    EXPECT_DOUBLE_EQ(d, 123.0);
    d = -120.23456;
    v.setField(bar, 0, d);
    d = v.getFieldAs<double>(bar, 0);
    EXPECT_DOUBLE_EQ(d, -120.0);
    d = 260.0;
    EXPECT_THROW(v.setField(foo, 0, d), pdal_error);
}
开发者ID:Rafaelaniemann,项目名称:PDAL,代码行数:24,代码来源:PointViewTest.cpp

示例14: layout

TEST(Compression, simple)
{
    const std::string file(Support::datapath("las/1.2-with-color.las"));

    const pdal::Option opt_filename("filename", file);
    pdal::Options opts;
    opts.add(opt_filename);

    LasReader reader;
    reader.setOptions(opts);

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

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

    EXPECT_EQ(layout->pointSize(), 52U);

    std::vector<unsigned char> rawBuf;

    DimTypeList dimTypes = layout->dimTypes();
    auto cb = [&rawBuf](char *buf, size_t bufsize)
    {
        unsigned char *ubuf = reinterpret_cast<unsigned char *>(buf);
        rawBuf.insert(rawBuf.end(), ubuf, ubuf + bufsize);
    };

    LazPerfCompressor compressor(cb, dimTypes);

    std::vector<char> tmpbuf(layout->pointSize());
    for (PointId idx = 0; idx < view->size(); ++idx)
    {
        view->getPackedPoint(dimTypes, idx, tmpbuf.data());
        compressor.compress(tmpbuf.data(), layout->pointSize());
    }
    compressor.done();

    EXPECT_EQ(view->size() * layout->pointSize(), (size_t)55380);
    EXPECT_EQ(rawBuf.size(), (size_t)30945);

    PointViewPtr otherView(new PointView(table));
    PointId nextId(0);
    auto cb2 = [&otherView, &dimTypes, &nextId](char *buf, size_t bufsize)
    {

        otherView->setPackedPoint(dimTypes, nextId, buf);
        nextId++;
    };

    LazPerfDecompressor(cb2, dimTypes, view->size()).
        decompress(reinterpret_cast<const char *>(rawBuf.data()),
            rawBuf.size());

    EXPECT_EQ(otherView->size(), 1065U);
    EXPECT_EQ(getBytes(otherView).size(), (size_t)(52 * 1065));

    uint16_t r = otherView->getFieldAs<uint16_t>(Dimension::Id::Red, 10);
    EXPECT_EQ(r, 64U);
    int32_t x = otherView->getFieldAs<int32_t>(Dimension::Id::X, 10);
    EXPECT_EQ(x, 636038);
    double xd = otherView->getFieldAs<double>(Dimension::Id::X, 10);
    EXPECT_FLOAT_EQ(xd, 636037.53);
    int32_t y = otherView->getFieldAs<int32_t>(Dimension::Id::Y, 10);
    EXPECT_EQ(y, 849338);
}
开发者ID:PDAL,项目名称:PDAL,代码行数:67,代码来源:LazPerfTest.cpp

示例15: layout

TEST(PointTable, resolveType)
{
    using namespace Dimension;

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

    // Start with a default-defined dimension.
    layout->registerDim(Id::X);
    EXPECT_EQ(layout->dimSize(Id::X), 8u);
    EXPECT_EQ(layout->dimType(Id::X), Type::Double);

    layout->registerDim(Id::X, Type::Signed32);
    EXPECT_EQ(layout->dimSize(Id::X), 8u);
    EXPECT_EQ(layout->dimType(Id::X), Type::Double);

    layout->registerDim(Dimension::Id::X, Type::Unsigned8);
    EXPECT_EQ(layout->dimSize(Id::X), 8u);
    EXPECT_EQ(layout->dimType(Id::X), Type::Double);

    /// Build as we go.
    layout->registerDim(Id::Y, Type::Unsigned8);
    EXPECT_EQ(layout->dimSize(Id::Y), 1u);
    EXPECT_EQ(layout->dimType(Id::Y), Type::Unsigned8);

    layout->registerDim(Id::Y, Type::Unsigned8);
    EXPECT_EQ(layout->dimSize(Id::Y), 1u);
    EXPECT_EQ(layout->dimType(Id::Y), Type::Unsigned8);

    layout->registerDim(Id::Y, Type::Signed8);
    // Signed 8 and Unsigned 8 should yeild signed 16.
    EXPECT_EQ(layout->dimSize(Id::Y), 2u);
    EXPECT_EQ(layout->dimType(Id::Y), Type::Signed16);

    layout->registerDim(Id::Y, Type::Signed16);
    EXPECT_EQ(layout->dimSize(Id::Y), 2u);
    EXPECT_EQ(layout->dimType(Id::Y), Type::Signed16);

    layout->registerDim(Id::Y, Type::Float);
    EXPECT_EQ(layout->dimSize(Id::Y), 4u);
    EXPECT_EQ(layout->dimType(Id::Y), Type::Float);

    layout->registerDim(Id::Y, Type::Double);
    EXPECT_EQ(layout->dimSize(Id::Y), 8u);
    EXPECT_EQ(layout->dimType(Id::Y), Type::Double);

    ///
    layout->registerDim(Id::Z, Type::Unsigned16);
    EXPECT_EQ(layout->dimSize(Id::Z), 2u);
    EXPECT_EQ(layout->dimType(Id::Z), Type::Unsigned16);

    layout->registerDim(Id::Z, Type::Signed8);
    EXPECT_EQ(layout->dimSize(Id::Z), 4u);
    EXPECT_EQ(layout->dimType(Id::Z), Type::Signed32);

    layout->registerDim(Id::Z, Type::Signed16);
    EXPECT_EQ(layout->dimSize(Id::Z), 4u);
    EXPECT_EQ(layout->dimType(Id::Z), Type::Signed32);

    layout->registerDim(Id::Z, Type::Double);
    EXPECT_EQ(layout->dimSize(Id::Z), 8u);
    EXPECT_EQ(layout->dimType(Id::Z), Type::Double);
}
开发者ID:boundlessgeo,项目名称:PDAL,代码行数:63,代码来源:PointTableTest.cpp


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