本文整理汇总了C++中CropFilter类的典型用法代码示例。如果您正苦于以下问题:C++ CropFilter类的具体用法?C++ CropFilter怎么用?C++ CropFilter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CropFilter类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TEST
TEST(CropFilterTest, test_crop)
{
BOX3D srcBounds(0.0, 0.0, 0.0, 10.0, 100.0, 1000.0);
Options opts;
opts.add("bounds", srcBounds);
opts.add("num_points", 1000);
opts.add("mode", "ramp");
FauxReader reader;
reader.setOptions(opts);
// crop the window to 1/3rd the size in each dimension
BOX2D dstBounds(3.33333, 33.33333, 6.66666, 66.66666);
Options cropOpts;
cropOpts.add("bounds", dstBounds);
CropFilter filter;
filter.setOptions(cropOpts);
filter.setInput(reader);
Options statOpts;
StatsFilter stats;
stats.setOptions(statOpts);
stats.setInput(filter);
PointTable table;
stats.prepare(table);
PointViewSet viewSet = stats.execute(table);
EXPECT_EQ(viewSet.size(), 1u);
PointViewPtr buf = *viewSet.begin();
const stats::Summary& statsX = stats.getStats(Dimension::Id::X);
const stats::Summary& statsY = stats.getStats(Dimension::Id::Y);
const stats::Summary& statsZ = stats.getStats(Dimension::Id::Z);
EXPECT_EQ(buf->size(), 333u);
const double minX = statsX.minimum();
const double minY = statsY.minimum();
const double minZ = statsZ.minimum();
const double maxX = statsX.maximum();
const double maxY = statsY.maximum();
const double maxZ = statsZ.maximum();
const double avgX = statsX.average();
const double avgY = statsY.average();
const double avgZ = statsZ.average();
const double delX = 10.0 / 999.0 * 100.0;
const double delY = 100.0 / 999.0 * 100.0;
const double delZ = 1000.0 / 999.0 * 100.0;
EXPECT_NEAR(minX, 3.33333, delX);
EXPECT_NEAR(minY, 33.33333, delY);
EXPECT_NEAR(minZ, 333.33333, delZ);
EXPECT_NEAR(maxX, 6.66666, delX);
EXPECT_NEAR(maxY, 66.66666, delY);
EXPECT_NEAR(maxZ, 666.66666, delZ);
EXPECT_NEAR(avgX, 5.00000, delX);
EXPECT_NEAR(avgY, 50.00000, delY);
EXPECT_NEAR(avgZ, 500.00000, delZ);
}
示例2: TEST
TEST(OptionsTest, conditional)
{
CropFilter s;
Options ops;
ops.add("foo", "foo");
ops.add("bar", "bar");
ops.add("baz", "baz");
s.setOptions(ops);
Options condOps;
condOps.add("foo", "lose");
condOps.add("bar", "lose");
condOps.add("baz", "lose");
condOps.add("foot", "win");
condOps.add("barf", "win");
condOps.add("bazel", "win");
s.addConditionalOptions(condOps);
ops = s.getOptions();
EXPECT_EQ(ops.size(), 6u);
EXPECT_EQ(ops.getValueOrDefault("foo", std::string()), "foo");
EXPECT_EQ(ops.getValueOrDefault("bar", std::string()), "bar");
EXPECT_EQ(ops.getValueOrDefault("baz", std::string()), "baz");
EXPECT_EQ(ops.getValueOrDefault("foot", std::string()), "win");
EXPECT_EQ(ops.getValueOrDefault("barf", std::string()), "win");
EXPECT_EQ(ops.getValueOrDefault("bazel", std::string()), "win");
}
示例3: TEST
TEST(OptionsTest, conditional)
{
CropFilter s;
Options ops;
ops.add("foo", "foo");
ops.add("bar", "bar");
ops.add("baz", "baz");
s.setOptions(ops);
Options condOps;
condOps.add("foo", "lose");
condOps.add("bar", "lose");
condOps.add("baz", "lose");
condOps.add("foot", "win");
condOps.add("barf", "win");
condOps.add("bazel", "win");
s.addConditionalOptions(condOps);
EXPECT_EQ(s.getOptions().getOptions().size(), 6U);
}
示例4: TEST
TEST(CropFilterTest, test_crop_polygon)
{
#ifdef PDAL_HAVE_GEOS
Options ops1;
ops1.add("filename", Support::datapath("las/1.2-with-color.las"));
LasReader reader;
reader.setOptions(ops1);
Options options;
Option debug("debug", true, "");
Option verbose("verbose", 9, "");
std::istream* wkt_stream =
FileUtils::openFile(Support::datapath("autzen/autzen-selection.wkt"));
std::stringstream strbuf;
strbuf << wkt_stream->rdbuf();
std::string wkt(strbuf.str());
Option polygon("polygon", wkt, "");
options.add(polygon);
CropFilter crop;
crop.setInput(reader);
crop.setOptions(options);
PointTable table;
crop.prepare(table);
PointViewSet viewSet = crop.execute(table);
EXPECT_EQ(viewSet.size(), 1u);
PointViewPtr view = *viewSet.begin();
EXPECT_EQ(view->size(), 47u);
FileUtils::closeFile(wkt_stream);
#endif
}
示例5: TEST
TEST(RialtoWriterTest, testRandom)
{
static const int K = 1000;
static const int M = 1000 * K;
static const int NUM_POINTS = 100 * K;
static const int NUM_QUERIES = 100;
const std::string filename(Support::temppath("rialto3.gpkg"));
FileUtils::deleteFile(filename);
RialtoTest::Data* actualData;
const uint32_t maxLevel = 5;
// make a test database
{
PointTable table;
PointViewPtr inputView(new PointView(table));
actualData = RialtoTest::randomDataInit(table, inputView, NUM_POINTS);
RialtoTest::createDatabase(table, inputView, filename, maxLevel);
}
// now read from it
{
LogPtr log(new Log("rialtowritertest", "stdout"));
PointViewSet views;
PointViewPtr view;
RialtoReader reader;
Options options;
options.add("filename", filename);
//options.add("verbose", LogLevel::Debug);
reader.setOptions(options);
for (int i=0; i<NUM_QUERIES; i++)
{
double minx = Utils::random(-179.9, 179.9);
double maxx = Utils::random(-179.9, 179.9);
if (minx > maxx) std::swap(minx, maxx);
double miny = Utils::random(-89.9, 89.9);
double maxy = Utils::random(-89.9, 89.9);
if (miny > maxy) std::swap(miny, maxy);
const double minz = -999999.0;
const double maxz = 999999.0;
BOX3D bounds(minx, miny, minz, maxx, maxy, maxz);
options.remove("bounds");
options.add("bounds", bounds);
reader.setOptions(options);
CropFilter crop;
Options co;
co.add("bounds", bounds);
crop.setInput(reader);
crop.setOptions(co);
PointTable table;
crop.prepare(table);
views = crop.execute(table);
EXPECT_EQ(views.size(), 1u);
view = *(views.begin());
uint32_t c = view->size();
//RialtoTest::verifyPointsInBounds(view, minx, miny, maxx, maxy);
uint32_t expected = RialtoTest::countPointsInBounds(actualData, NUM_POINTS, minx, miny, maxx, maxy);
EXPECT_EQ(expected, view->size());
}
}
delete[] actualData;
FileUtils::deleteFile(filename);
}