diff options
author | Asheem Mamoowala <asheem.mamoowala@mapbox.com> | 2018-03-30 18:03:17 -0700 |
---|---|---|
committer | Asheem Mamoowala <asheem.mamoowala@mapbox.com> | 2018-03-30 18:03:17 -0700 |
commit | d2933ae7771b165c045e6673b59e813eceb5d090 (patch) | |
tree | a1675dc5937dd8cbe38a56140d68a723aa5bf171 | |
parent | 7cabdc39209263e2a714126029fd35371fe6a58d (diff) | |
download | qtlocation-mapboxgl-d2933ae7771b165c045e6673b59e813eceb5d090.tar.gz |
Fixup comments
-rw-r--r-- | src/mbgl/util/tile_cover.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/util/tile_cover.hpp | 4 | ||||
-rw-r--r-- | src/mbgl/util/tile_cover_impl.cpp | 5 | ||||
-rw-r--r-- | test/util/tile_cover.test.cpp | 2 |
4 files changed, 6 insertions, 7 deletions
diff --git a/src/mbgl/util/tile_cover.cpp b/src/mbgl/util/tile_cover.cpp index 9e07626c82..4c35afbb5f 100644 --- a/src/mbgl/util/tile_cover.cpp +++ b/src/mbgl/util/tile_cover.cpp @@ -186,12 +186,10 @@ std::vector<UnwrappedTileID> tileCover(const Geometry<double>& geometry, int32_t tc.getTiles(scanCover); }; - // Sort by y/x. t.sort([](const ID& a, const ID& b) { return std::tie(a.y, a.x) < std::tie(b.y, b.x); }); - // Erase duplicate tile IDs. t.erase(std::unique(t.begin(), t.end(), [](const ID& a, const ID& b) { return a.x == b.x && a.y == b.y; }), t.end()); diff --git a/src/mbgl/util/tile_cover.hpp b/src/mbgl/util/tile_cover.hpp index df7005f427..baeecd0c2c 100644 --- a/src/mbgl/util/tile_cover.hpp +++ b/src/mbgl/util/tile_cover.hpp @@ -4,6 +4,7 @@ #include <mbgl/style/types.hpp> #include <mbgl/util/tile_coordinate.hpp> #include <mbgl/util/geometry.hpp> + #include <vector> namespace mbgl { @@ -20,13 +21,14 @@ using ScanLine = const std::function<void(int32_t x0, int32_t x1, int32_t y)>; class TileCover { public: TileCover(const LatLngBounds&, int32_t z); - // When project == true, use projection the geometry points to tile coordinates + // When project == true, projects the geometry points to tile coordinates TileCover(const Geometry<double>&, int32_t z, bool project = true); ~TileCover(); //Returns false when there are no more rows to cover bool next(); //Invokes the ScanLine callback to indicate tiles coverd for the row from [x0,x1) + // ScanLine may be invoked with duplcaite or overlapping ranges. bool getTiles(ScanLine&); private: diff --git a/src/mbgl/util/tile_cover_impl.cpp b/src/mbgl/util/tile_cover_impl.cpp index e7f5e548a2..8927d8af18 100644 --- a/src/mbgl/util/tile_cover_impl.cpp +++ b/src/mbgl/util/tile_cover_impl.cpp @@ -147,7 +147,7 @@ std::vector<x_range> scan_row(uint32_t y, bound_list& aet) { } tile_range.push_back(xp); } - // Erase bounds in the aet whose current edge ends inside this row, or there are no more edges + // Erase bounds in aet whose current edge ends inside this row, or there are no more edges auto bound = aet.begin(); while (bound != aet.end()) { if ( bound->currentPointIndex == bound->points.size() - 1 && @@ -157,7 +157,7 @@ std::vector<x_range> scan_row(uint32_t y, bound_list& aet) { bound++; } } - // Sort the X-extents of each lml by x_min, x_max + // Sort the X-extents of each crossing bound by x_min, x_max std::sort(tile_range.begin(), tile_range.end(), [] (x_range& a, x_range& b) { return std::tie(a.first, a.second) < std::tie(b.first, b.second); }); @@ -264,7 +264,6 @@ bool TileCoverImpl::scanRow(ScanLine& scanCover) { auto x_max = p++->second; scanCover(x_min, x_max, currentY); } - // Move to the next row currentY++; // Update AET for next row diff --git a/test/util/tile_cover.test.cpp b/test/util/tile_cover.test.cpp index b707b8be6f..45a79d9942 100644 --- a/test/util/tile_cover.test.cpp +++ b/test/util/tile_cover.test.cpp @@ -90,7 +90,7 @@ TEST(TileCoverStream, WorldZ1) { } static const LatLngBounds sanFrancisco = -LatLngBounds::hull({ 37.6609, -122.5744 }, { 37.8271, -122.3204 }); + LatLngBounds::hull({ 37.6609, -122.5744 }, { 37.8271, -122.3204 }); TEST(TileCover, SanFranciscoZ0) { EXPECT_EQ((std::vector<UnwrappedTileID>{ |