summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Crocker <jesse@gaiagps.com>2017-01-26 11:06:34 -0700
committerJesse Crocker <jesse@gaiagps.com>2017-01-26 11:06:34 -0700
commit16fb0672e64a72b7400c321d55858b73cd5d8c3f (patch)
tree6c9166b0edb73b5c4e101430237e4418cf4e03df
parentbee3b2887197838ade39696b6d7c66e52742a863 (diff)
downloadqtlocation-mapboxgl-16fb0672e64a72b7400c321d55858b73cd5d8c3f.tar.gz
Clear cache when reloading source
-rw-r--r--src/mbgl/style/sources/custom_vector_source_impl.cpp6
1 files changed, 5 insertions, 1 deletions
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<GeoJSONTile*>(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<GeoJSONTile*>(item.second.get());
fetchTile(tile->id.canonical.z, tile->id.canonical.x, tile->id.canonical.y);