summaryrefslogtreecommitdiff
path: root/src/mbgl/map/map.cpp
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <thiago@mapbox.com>2016-09-13 18:32:45 -0700
committerThiago Marcos P. Santos <thiago@mapbox.com>2016-09-22 17:43:28 +0300
commit486bdddb23c93572c29068a229041b2575f383e8 (patch)
tree0e50aa7464032fb8628366af544d3c8e5e1a92f8 /src/mbgl/map/map.cpp
parente8d47269f808845acdc5b3d76033428ac1fb630e (diff)
downloadqtlocation-mapboxgl-486bdddb23c93572c29068a229041b2575f383e8.tar.gz
[core] Add interface to add sprites to the style
Unlike annotations, they will go away when we change the style.
Diffstat (limited to 'src/mbgl/map/map.cpp')
-rw-r--r--src/mbgl/map/map.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp
index 1c376e40aa..3ff02aae71 100644
--- a/src/mbgl/map/map.cpp
+++ b/src/mbgl/map/map.cpp
@@ -823,6 +823,30 @@ void Map::removeLayer(const std::string& id) {
impl->view.deactivate();
}
+void Map::addImage(const std::string& name, std::unique_ptr<const SpriteImage> image) {
+ if (!impl->style) {
+ return;
+ }
+
+ impl->styleMutated = true;
+ impl->style->spriteAtlas->setSprite(name, std::move(image));
+ impl->style->spriteAtlas->updateDirty();
+
+ update(Update::Repaint);
+}
+
+void Map::removeImage(const std::string& name) {
+ if (!impl->style) {
+ return;
+ }
+
+ impl->styleMutated = true;
+ impl->style->spriteAtlas->removeSprite(name);
+ impl->style->spriteAtlas->updateDirty();
+
+ update(Update::Repaint);
+}
+
#pragma mark - Defaults
std::string Map::getStyleName() const {