[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.
This commit is contained in:
committed by
Minh Nguyễn
parent
f71dd14bb7
commit
850b70ff91
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user