Example #1
0
// Test auto scale/offset for streaming mode.
TEST(LasWriterTest, issue1940)
{
    StageFactory f;

    Stage& r = *(f.createStage("readers.faux"));
    Options ro;
    ro.add("mode", "constant");
    ro.add("bounds", "([55,55],[55,55],[55,55])");
    ro.add("count", 20);
    r.addOptions(ro);

    LasWriter w;
    Options wo;
    //LogPtr log(new Log("TEST", &std::clog));
    //log->setLevel((LogLevel)5);
    //w.setLog(log);
    wo.add("filename", Support::temppath("out.las"));
    wo.add("scale_x", "auto");
    wo.add("offset_y", "auto");
    w.addOptions(wo);
    w.setInput(r);

    FixedPointTable t(100);
    w.prepare(t);
    w.execute(t);

    LasTester tester;
    LasHeader *h = tester.header(w);
    EXPECT_DOUBLE_EQ(h->offsetX(), 0);
    EXPECT_DOUBLE_EQ(h->offsetY(), 55);
    EXPECT_DOUBLE_EQ(h->scaleX(), 1.0);
    EXPECT_DOUBLE_EQ(h->scaleY(), .01);
}
Example #2
0
TEST(LasReaderTest, header)
{
    PointTable table;
    Options ops;
    ops.add("filename", Support::datapath("las/simple.las"));

    LasReader reader;
    reader.setOptions(ops);

    reader.prepare(table);
    // This tests the copy ctor, too.
    LasHeader h = reader.header();

    EXPECT_EQ(h.fileSignature(), "LASF");
    EXPECT_EQ(h.fileSourceId(), 0);
    EXPECT_TRUE(h.projectId().isNull());
    EXPECT_EQ(h.versionMajor(), 1);
    EXPECT_EQ(h.versionMinor(), 2);
    EXPECT_EQ(h.creationDOY(), 0);
    EXPECT_EQ(h.creationYear(), 0);
    EXPECT_EQ(h.vlrOffset(), 227);
    EXPECT_EQ(h.pointFormat(), 3);
    EXPECT_EQ(h.pointCount(), 1065u);
    EXPECT_DOUBLE_EQ(h.scaleX(), .01);
    EXPECT_DOUBLE_EQ(h.scaleY(), .01);
    EXPECT_DOUBLE_EQ(h.scaleZ(), .01);
    EXPECT_DOUBLE_EQ(h.offsetX(), 0);
    EXPECT_DOUBLE_EQ(h.offsetY(), 0);
    EXPECT_DOUBLE_EQ(h.offsetZ(), 0);
    EXPECT_DOUBLE_EQ(h.maxX(), 638982.55);
    EXPECT_DOUBLE_EQ(h.maxY(), 853535.43);
    EXPECT_DOUBLE_EQ(h.maxZ(), 586.38);
    EXPECT_DOUBLE_EQ(h.minX(), 635619.85);
    EXPECT_DOUBLE_EQ(h.minY(), 848899.70);
    EXPECT_DOUBLE_EQ(h.minZ(), 406.59);
    EXPECT_EQ(h.compressed(), false);
    EXPECT_EQ(h.compressionInfo(), "");
    EXPECT_EQ(h.pointCountByReturn(0), 925u);
    EXPECT_EQ(h.pointCountByReturn(1), 114u);
    EXPECT_EQ(h.pointCountByReturn(2), 21u);
    EXPECT_EQ(h.pointCountByReturn(3), 5u);
    EXPECT_EQ(h.pointCountByReturn(4), 0u);
}