Fix TileCover asserts. The create_bounds_towards_* methods were treating

all point arrays as rings. Simplify the logic to only compare against
the next pt in the bound.
This commit is contained in:
Asheem Mamoowala
2018-05-16 17:37:57 -07:00
parent 77894f0586
commit b2ff57c09c
2 changed files with 33 additions and 49 deletions

View File

@@ -137,6 +137,17 @@ TEST(TileCover, GeomLineZ10) {
}
TEST(TileCover, GeomLineRegression11870) {
auto lineCover = util::tileCover(LineString<double>{
{-121.5063900000001,40.470099999999945},
{-121.5065300000001,40.470369999999946},
{-121.5065900000001,40.470519999999944},
}, 14);
EXPECT_EQ((std::vector<UnwrappedTileID>{ { 14, 2662, 6174 } }),
lineCover);
}
TEST(TileCover, WrappedGeomLineZ10) {
auto lineCover = util::tileCover(LineString<double>{
{-179.93342914581299,38.892101707724315},
@@ -263,6 +274,9 @@ TEST(TileCover, GeomInvalid) {
auto point = Point<double>{ -122.5744, 97.6609 };
EXPECT_THROW(util::tileCover(point, 2), std::domain_error);
auto badLine = LineString<double>{ {1.0, 35.0} };
EXPECT_EQ((std::vector<UnwrappedTileID>{ }), util::tileCover(badLine, 16));
auto badPoly = Polygon<double> { { {1.0, 35.0} } };
EXPECT_EQ((std::vector<UnwrappedTileID>{ }), util::tileCover(badPoly, 16));