From 96a7a4402ef5eac2fa17ec7b52ef24e3b10bbf29 Mon Sep 17 00:00:00 2001 From: Jesse Bounds Date: Fri, 11 Nov 2016 14:40:04 -0800 Subject: [core] Return source and layer ownership (#7014) When a source or layer is removed transfer ownership back to the caller so it can (optionally) take it. Preserve the behavior that removing a CustomLayer triggers deinitialization. Deinitialize all custom layers when a style is destroyed in case those layers are not explicitly removed. --- include/mbgl/map/map.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/mbgl/map') diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index b1c840e68d..0c14600c75 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -159,12 +159,12 @@ public: // Sources style::Source* getSource(const std::string& sourceID); void addSource(std::unique_ptr); - void removeSource(const std::string& sourceID); + std::unique_ptr removeSource(const std::string& sourceID); // Layers style::Layer* getLayer(const std::string& layerID); void addLayer(std::unique_ptr, const optional& beforeLayerID = {}); - void removeLayer(const std::string& layerID); + std::unique_ptr removeLayer(const std::string& layerID); // Add image, bound to the style void addImage(const std::string&, std::unique_ptr); -- cgit v1.2.1 From 850b70ff91e582916829c5248afcafa195070a43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Thu, 18 Aug 2016 18:00:58 -0700 Subject: [core, ios, macos] Added layers and sources properties to MGLStyle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added new layers and sources properties to MGLStyle that contain all the style’s layers and sources, respectively. These properties are KVC-compliant with all the mutable to-many methods. Layers are ordered from topmost to bottommost, for consistency with Cocoa APIs where front/first means top and back/last means bottom. Also added storage for mbgl::style::Source in MGLSource proper for wrapping AnnotationSource. Until the style finishes loading, its name property is set to nil. Fixes #6003. --- include/mbgl/map/map.hpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/mbgl/map') diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index 0c14600c75..10153c54e3 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -157,11 +157,13 @@ public: void removeAnnotation(AnnotationID); // Sources + std::vector getSources(); style::Source* getSource(const std::string& sourceID); void addSource(std::unique_ptr); std::unique_ptr removeSource(const std::string& sourceID); // Layers + std::vector getLayers(); style::Layer* getLayer(const std::string& layerID); void addLayer(std::unique_ptr, const optional& beforeLayerID = {}); std::unique_ptr removeLayer(const std::string& layerID); -- cgit v1.2.1