From 42cd0a53176d8c588605a8d10dc888214968349f Mon Sep 17 00:00:00 2001 From: Andrew Bell Date: Wed, 3 Jun 2020 13:06:40 -0400 Subject: [PATCH] Add test. --- test/unit/filters/CropFilterTest.cpp | 55 ++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/test/unit/filters/CropFilterTest.cpp b/test/unit/filters/CropFilterTest.cpp index 6a5982b1d9..3b515b7162 100644 --- a/test/unit/filters/CropFilterTest.cpp +++ b/test/unit/filters/CropFilterTest.cpp @@ -46,6 +46,10 @@ #include #include "Support.hpp" +//ABELL +#include +#include + using namespace pdal; TEST(CropFilterTest, create) @@ -616,3 +620,54 @@ TEST(CropFilterTest, bounds_inside_outside) // Expect 1026 points when cropping to the outside of the bounds. EXPECT_EQ(nStreamPoints, 1026U); } + +// Make sure that transformed 2D and 3D bounds work. +TEST(CropFilterTest, issue_3114) +{ + using namespace Dimension; + + auto tst = [](const std::string& bounds, size_t count) + { + ColumnPointTable table; + + table.layout()->registerDims({Id::X, Id::Y, Id::Z}); + table.finalize(); + + PointViewPtr view(new PointView(table)); + + view->setField(Id::X, 0, 555000); + view->setField(Id::Y, 0, 4180000); + view->setField(Id::Z, 0, 100); + + view->setField(Id::X, 1, 555000); + view->setField(Id::Y, 1, 4180000); + view->setField(Id::Z, 1, 1000); + + view->setField(Id::X, 2, 565000); + view->setField(Id::Y, 2, 4180000); + view->setField(Id::Z, 2, 100); + + BufferReader r; + r.addView(view); + + Options ropts; + ropts.add("override_srs", "EPSG:26910"); + r.setOptions(ropts); + + CropFilter f; + + Options copts; + copts.add("bounds", bounds); + copts.add("a_srs", "EPSG:4326"); + f.setOptions(copts); + f.setInput(r); + + f.prepare(table); + PointViewSet s = f.execute(table); + PointViewPtr v = *s.begin(); + EXPECT_EQ(v->size(), count); + }; + + tst("([-122.530, -122.347], [37.695, 37.816])", 2); + tst("([-122.530, -122.347], [37.695, 37.816], [0,500])", 1); +}