This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Commit 486bddd 1 parent e8d4726 commit 486bddd Copy full SHA for 486bddd
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 image, bound to the style
165
+ void addImage (const std::string&, std::unique_ptr<const SpriteImage>);
166
+ void removeImage (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 @@ -823,6 +823,30 @@ void Map::removeLayer(const std::string& id) {
823
823
impl->view .deactivate ();
824
824
}
825
825
826
+ void Map::addImage (const std::string& name, std::unique_ptr<const SpriteImage> image) {
827
+ if (!impl->style ) {
828
+ return ;
829
+ }
830
+
831
+ impl->styleMutated = true ;
832
+ impl->style ->spriteAtlas ->setSprite (name, std::move (image));
833
+ impl->style ->spriteAtlas ->updateDirty ();
834
+
835
+ update (Update::Repaint);
836
+ }
837
+
838
+ void Map::removeImage (const std::string& name) {
839
+ if (!impl->style ) {
840
+ return ;
841
+ }
842
+
843
+ impl->styleMutated = true ;
844
+ impl->style ->spriteAtlas ->removeSprite (name);
845
+ impl->style ->spriteAtlas ->updateDirty ();
846
+
847
+ update (Update::Repaint);
848
+ }
849
+
826
850
#pragma mark - Defaults
827
851
828
852
std::string Map::getStyleName () const {
You can’t perform that action at this time.
0 commit comments