From 16fb0672e64a72b7400c321d55858b73cd5d8c3f Mon Sep 17 00:00:00 2001 From: Jesse Crocker Date: Thu, 26 Jan 2017 11:06:34 -0700 Subject: Clear cache when reloading source --- src/mbgl/style/sources/custom_vector_source_impl.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mbgl/style/sources/custom_vector_source_impl.cpp b/src/mbgl/style/sources/custom_vector_source_impl.cpp index 8b9f0d1c5e..8abff02964 100644 --- a/src/mbgl/style/sources/custom_vector_source_impl.cpp +++ b/src/mbgl/style/sources/custom_vector_source_impl.cpp @@ -74,6 +74,9 @@ void CustomVectorSource::Impl::setTileData(uint8_t z, uint32_t x, uint32_t y, co } void CustomVectorSource::Impl::updateTile(uint8_t z, uint32_t x, uint32_t y) { + if(cache.has(OverscaledTileID(z, x, y))) { + cache.clear(); + } for (auto const &item : tiles) { GeoJSONTile* tile = static_cast(item.second.get()); if(tile->id.canonical.z == z && tile->id.canonical.x == x && tile->id.canonical.y == y) { @@ -81,7 +84,7 @@ void CustomVectorSource::Impl::updateTile(uint8_t z, uint32_t x, uint32_t y) { } } } - + void CustomVectorSource::Impl::reloadRegion(mbgl::LatLngBounds bounds, uint8_t z) { for (const auto& tile : mbgl::util::tileCover(bounds, z)) { updateTile(tile.canonical.z, tile.canonical.x, tile.canonical.z); @@ -89,6 +92,7 @@ void CustomVectorSource::Impl::reloadRegion(mbgl::LatLngBounds bounds, uint8_t z } void CustomVectorSource::Impl::reload() { + cache.clear(); for (auto const &item : tiles) { GeoJSONTile* tile = static_cast(item.second.get()); fetchTile(tile->id.canonical.z, tile->id.canonical.x, tile->id.canonical.y); -- cgit v1.2.1