Skip to content

Commit

Permalink
[core][tile mode] Make sure only a single tile is used
Browse files Browse the repository at this point in the history
In tile mode, we're supposed to have only one tile, which is achieved with provided camera options.

However, if camera options are not accurate enough more tile could be used, which could cause:

* various symbol placement problems like, symbol duplications or cut-offs
* memory/cpu overhead

Now, if `mbgl::tileCover()` returns several tiles, only the first one is used (given that tiles are sorted by the distance to the map center)
  • Loading branch information
pozdnyakov committed Apr 24, 2020
1 parent 9f8c9c6 commit 9ceb619
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/mbgl/renderer/tile_pyramid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@ void TilePyramid::update(const std::vector<Immutable<style::LayerProperties>>& l
}

idealTiles = util::tileCover(parameters.transformState, idealZoom, tileZoom);
if (parameters.mode == MapMode::Tile && type != SourceType::Raster && type != SourceType::RasterDEM &&
idealTiles.size() > 1) {
mbgl::Log::Warning(mbgl::Event::General,
"Provided camera options returned %zu tiles, only %s is taken in Tile mode.",
idealTiles.size(),
util::toString(idealTiles[0]).c_str());
idealTiles = {idealTiles[0]};
}
}

// Stores a list of all the tiles that we're definitely going to retain. There are two
Expand Down

0 comments on commit 9ceb619

Please sign in to comment.