Rewrite annotation invalidation strategy
First, move style mutation code out of StyleParser and into AnnotationManager, coalescing it with the mutation code for shape layers. Second, allow AnnotationManager to keep track of stale tiles entirely internally. There's no reason to pass sets of TileIDs around. Third, correct the logic for invalidating the shape source. Since AnnotationManager does not track shape invalidations on a tile-by-tile basis, don't try to invalidate the shape source tile-by-tile. Fixes #1675 Fixes #2322 Fixes #2095
This commit is contained in:
@@ -515,18 +515,20 @@ bool Source::update(MapData& data,
|
||||
|
||||
void Source::invalidateTiles(const std::unordered_set<TileID, TileID::Hash>& ids) {
|
||||
cache.clear();
|
||||
if (!ids.empty()) {
|
||||
for (auto& id : ids) {
|
||||
tiles.erase(id);
|
||||
tile_data.erase(id);
|
||||
}
|
||||
} else {
|
||||
tiles.clear();
|
||||
tile_data.clear();
|
||||
for (const auto& id : ids) {
|
||||
tiles.erase(id);
|
||||
tile_data.erase(id);
|
||||
}
|
||||
updateTilePtrs();
|
||||
}
|
||||
|
||||
void Source::invalidateTiles() {
|
||||
cache.clear();
|
||||
tiles.clear();
|
||||
tile_data.clear();
|
||||
updateTilePtrs();
|
||||
}
|
||||
|
||||
void Source::updateTilePtrs() {
|
||||
tilePtrs.clear();
|
||||
for (const auto& pair : tiles) {
|
||||
|
||||
Reference in New Issue
Block a user