summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin R. Miller <incanus@codesorcery.net>2015-09-08 18:03:10 -0700
committerJustin R. Miller <incanus@codesorcery.net>2015-09-08 18:03:10 -0700
commit0d899df9ddc9a7a9a8bfbac2c4b077ce26da64e9 (patch)
tree0f9927f1f98d3fc90b517a7ea758cce0baf26467 /src
parenta6ef907d5e647dec9ecee44f14ee5fdf2d44af06 (diff)
downloadqtlocation-mapboxgl-0d899df9ddc9a7a9a8bfbac2c4b077ce26da64e9.tar.gz
fixes #1675: abstract annotation tile refresh check/render; trigger post-sprite/sprite store load
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/map/annotation.hpp1
-rw-r--r--src/mbgl/map/map_context.cpp10
-rw-r--r--src/mbgl/map/map_context.hpp2
-rw-r--r--src/mbgl/style/style.cpp4
-rw-r--r--src/mbgl/style/style.hpp1
5 files changed, 16 insertions, 2 deletions
diff --git a/src/mbgl/map/annotation.hpp b/src/mbgl/map/annotation.hpp
index 745fc779cd..5adec162f7 100644
--- a/src/mbgl/map/annotation.hpp
+++ b/src/mbgl/map/annotation.hpp
@@ -52,6 +52,7 @@ public:
~AnnotationManager();
void markStaleTiles(std::unordered_set<TileID, TileID::Hash>);
+ size_t getStaleTileCount() const { return staleTiles.size(); }
std::unordered_set<TileID, TileID::Hash> resetStaleTiles();
void setDefaultPointAnnotationSymbol(const std::string& symbol);
diff --git a/src/mbgl/map/map_context.cpp b/src/mbgl/map/map_context.cpp
index 94aedb46da..0ebcd73f8b 100644
--- a/src/mbgl/map/map_context.cpp
+++ b/src/mbgl/map/map_context.cpp
@@ -142,9 +142,11 @@ void MapContext::loadStyleJSON(const std::string& json, const std::string& base)
updateFlags |= Update::DefaultTransition | Update::Classes | Update::Zoom;
asyncUpdate->send();
+}
- auto staleTiles = data.getAnnotationManager()->resetStaleTiles();
- if (!staleTiles.empty()) {
+void MapContext::updateAnnotationTilesIfNeeded() {
+ if (data.getAnnotationManager()->getStaleTileCount()) {
+ auto staleTiles = data.getAnnotationManager()->resetStaleTiles();
updateAnnotationTiles(staleTiles);
}
}
@@ -417,4 +419,8 @@ void MapContext::onResourceLoadingFailed(std::exception_ptr error) {
}
}
+void MapContext::onSpriteStoreLoaded() {
+ updateAnnotationTilesIfNeeded();
+}
+
}
diff --git a/src/mbgl/map/map_context.hpp b/src/mbgl/map/map_context.hpp
index f1bfb01e44..449a0f1d1c 100644
--- a/src/mbgl/map/map_context.hpp
+++ b/src/mbgl/map/map_context.hpp
@@ -54,6 +54,7 @@ public:
bool isLoaded() const;
double getTopOffsetPixelsForAnnotationSymbol(const std::string& symbol);
+ void updateAnnotationTilesIfNeeded();
void updateAnnotationTiles(const std::unordered_set<TileID, TileID::Hash>&);
void setSourceTileCacheSize(size_t size);
@@ -66,6 +67,7 @@ public:
// Style::Observer implementation.
void onTileDataChanged() override;
void onResourceLoadingFailed(std::exception_ptr error) override;
+ void onSpriteStoreLoaded() override;
private:
// Update the state indicated by the accumulated Update flags, then render.
diff --git a/src/mbgl/style/style.cpp b/src/mbgl/style/style.cpp
index 7686215301..d4c9bd4e56 100644
--- a/src/mbgl/style/style.cpp
+++ b/src/mbgl/style/style.cpp
@@ -190,6 +190,10 @@ void Style::onSpriteLoaded(const Sprites& sprites) {
// Add all sprite images to the SpriteStore object
spriteStore->setSprites(sprites);
+ if (observer) {
+ observer->onSpriteStoreLoaded();
+ }
+
shouldReparsePartialTiles = true;
emitTileDataChanged();
}
diff --git a/src/mbgl/style/style.hpp b/src/mbgl/style/style.hpp
index cbc0ee2db2..3f9696ffbf 100644
--- a/src/mbgl/style/style.hpp
+++ b/src/mbgl/style/style.hpp
@@ -39,6 +39,7 @@ public:
virtual ~Observer() = default;
virtual void onTileDataChanged() = 0;
+ virtual void onSpriteStoreLoaded() = 0;
virtual void onResourceLoadingFailed(std::exception_ptr error) = 0;
};