summaryrefslogtreecommitdiff
path: root/src/mbgl/map/map.cpp
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-08-18 18:00:58 -0700
committerMinh Nguyễn <mxn@1ec5.org>2016-11-28 15:45:37 -0800
commit850b70ff91e582916829c5248afcafa195070a43 (patch)
tree3362e95001983e3029e006dbd99579a5bf68e97d /src/mbgl/map/map.cpp
parentf71dd14bb74be22fb27646b8732843d92cf72c62 (diff)
downloadqtlocation-mapboxgl-850b70ff91e582916829c5248afcafa195070a43.tar.gz
[core, ios, macos] Added layers and sources properties to MGLStyle
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.
Diffstat (limited to 'src/mbgl/map/map.cpp')
-rw-r--r--src/mbgl/map/map.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp
index bd1de6f180..68c20a3132 100644
--- a/src/mbgl/map/map.cpp
+++ b/src/mbgl/map/map.cpp
@@ -803,6 +803,10 @@ AnnotationIDs Map::queryPointAnnotations(const ScreenBox& box) {
#pragma mark - Style API
+std::vector<style::Source*> Map::getSources() {
+ return impl->style ? impl->style->getSources() : std::vector<style::Source*>();
+}
+
style::Source* Map::getSource(const std::string& sourceID) {
if (impl->style) {
impl->styleMutated = true;
@@ -825,8 +829,12 @@ std::unique_ptr<Source> Map::removeSource(const std::string& sourceID) {
}
return nullptr;
}
+
+std::vector<style::Layer*> Map::getLayers() {
+ return impl->style ? impl->style->getLayers() : std::vector<style::Layer*>();
+}
-style::Layer* Map::getLayer(const std::string& layerID) {
+Layer* Map::getLayer(const std::string& layerID) {
if (impl->style) {
impl->styleMutated = true;
return impl->style->getLayer(layerID);