This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Commit 0d224b5 1 parent 1014a50 commit 0d224b5 Copy full SHA for 0d224b5
File tree 2 files changed +28
-0
lines changed
2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -161,6 +161,10 @@ class Map : private util::noncopyable {
161
161
void addLayer (std::unique_ptr<style::Layer>, const optional<std::string>& beforeLayerID = {});
162
162
void removeLayer (const std::string& layerID);
163
163
164
+ // Add icon, bound to the style
165
+ void addIcon (const std::string&, std::shared_ptr<const SpriteImage>);
166
+ void removeIcon (const std::string&);
167
+
164
168
// Defaults
165
169
std::string getStyleName () const ;
166
170
LatLng getDefaultLatLng () const ;
Original file line number Diff line number Diff line change @@ -822,6 +822,30 @@ void Map::removeLayer(const std::string& id) {
822
822
impl->view .deactivate ();
823
823
}
824
824
825
+ void Map::addIcon (const std::string& name, std::shared_ptr<const SpriteImage> sprite) {
826
+ if (!impl->style ) {
827
+ return ;
828
+ }
829
+
830
+ impl->styleMutated = true ;
831
+ impl->style ->spriteStore ->setSprite (name, sprite);
832
+ impl->style ->spriteAtlas ->updateDirty ();
833
+
834
+ update (Update::Repaint);
835
+ }
836
+
837
+ void Map::removeIcon (const std::string& name) {
838
+ if (!impl->style ) {
839
+ return ;
840
+ }
841
+
842
+ impl->styleMutated = true ;
843
+ impl->style ->spriteStore ->removeSprite (name);
844
+ impl->style ->spriteAtlas ->updateDirty ();
845
+
846
+ update (Update::Repaint);
847
+ }
848
+
825
849
#pragma mark - Defaults
826
850
827
851
std::string Map::getStyleName () const {
You can’t perform that action at this time.
0 commit comments