MCPcopy Create free account
hub / github.com/PDAL/PDAL / TEST

Function TEST

test/unit/filters/SplitterTest.cpp:45–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43using namespace pdal;
44
45TEST(SplitterTest, test_tile_filter)
46{
47 StageFactory f;
48
49 // create the reader
50 Options ops1;
51 ops1.add("filename", Support::datapath("las/1.2-with-color.las"));
52 LasReader r;
53 r.setOptions(ops1);
54
55 Options o;
56 Option length("length", 1000);
57 o.add(length);
58
59 // create the tile filter and prepare
60 SplitterFilter s;
61 s.setOptions(o);
62 s.setInput(r);
63
64 PointTable table;
65 s.prepare(table);
66 PointViewSet viewSet = s.execute(table);
67
68 std::vector<PointViewPtr> views;
69 std::map<PointViewPtr, BOX2D> bounds;
70
71 for (auto it = viewSet.begin(); it != viewSet.end(); ++it)
72 {
73 BOX2D b;
74 PointViewPtr v = *it;
75 v->calculateBounds(b);
76 EXPECT_TRUE(b.maxx - b.minx <= 1000);
77 EXPECT_TRUE(b.maxy - b.miny <= 1000);
78
79 for (auto& p : bounds)
80 EXPECT_FALSE(p.second.overlaps(b));
81
82 bounds[v] = b;
83 views.push_back(v);
84 }
85
86 auto sorter = [&bounds](PointViewPtr p1, PointViewPtr p2)
87 {
88 BOX2D b1 = bounds[p1];
89 BOX2D b2 = bounds[p2];
90
91 return b1.minx < b2.minx ? true :
92 b1.minx > b2.minx ? false :
93 b1.miny < b2.miny;
94 };
95 std::sort(views.begin(), views.end(), sorter);
96
97 EXPECT_EQ(views.size(), 24u);
98 size_t counts[] = {24, 25, 2, 26, 27, 10, 82, 68, 43, 57, 7, 71, 73,
99 61, 33, 84, 74, 4, 59, 70, 67, 34, 60, 4 };
100 for (size_t i = 0; i < views.size(); ++i)
101 {
102 PointViewPtr view = views[i];

Callers

nothing calls this directly

Calls 11

datapathFunction · 0.85
setOptionsMethod · 0.80
calculateBoundsMethod · 0.80
BOX3DClass · 0.50
addMethod · 0.45
prepareMethod · 0.45
executeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
overlapsMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected