diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2016-08-18 18:00:58 -0700 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2016-11-28 15:45:37 -0800 |
commit | 850b70ff91e582916829c5248afcafa195070a43 (patch) | |
tree | 3362e95001983e3029e006dbd99579a5bf68e97d /platform/darwin/src/MGLStyle.h | |
parent | f71dd14bb74be22fb27646b8732843d92cf72c62 (diff) | |
download | qtlocation-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 'platform/darwin/src/MGLStyle.h')
-rw-r--r-- | platform/darwin/src/MGLStyle.h | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/platform/darwin/src/MGLStyle.h b/platform/darwin/src/MGLStyle.h index 96dc8fba49..b3e1b28eee 100644 --- a/platform/darwin/src/MGLStyle.h +++ b/platform/darwin/src/MGLStyle.h @@ -177,6 +177,11 @@ static const NSInteger MGLStyleDefaultVersion = 9; #pragma mark Managing Sources /** + A set containing the style’s sources. + */ +@property (nonatomic, strong) NS_MUTABLE_SET_OF(MGLSource *) *sources; + +/** Returns a source with the given identifier in the current style. @return An instance of a concrete subclass of `MGLSource` associated with the @@ -201,6 +206,12 @@ static const NSInteger MGLStyleDefaultVersion = 9; #pragma mark Managing Style Layers /** + The layers included in the style, arranged according to their front-to-back + ordering on the screen. + */ +@property (nonatomic, strong) NS_MUTABLE_ARRAY_OF(MGLStyleLayer *) *layers; + +/** Returns a style layer with the given identifier in the current style. @return An instance of a concrete subclass of `MGLStyleLayer` associated with @@ -218,12 +229,30 @@ static const NSInteger MGLStyleDefaultVersion = 9; - (void)addLayer:(MGLStyleLayer *)layer; /** + Inserts a new layer into the style at the given index. + + @param layer The layer to insert. + @param index The index at which to insert the layer. An index of 0 would send + the layer to the back; an index equal to the number of objects in the + `layers` property would bring the layer to the front. + */ +- (void)insertLayer:(MGLStyleLayer *)layer atIndex:(NSUInteger)index; + +/** Inserts a new layer below another layer. - @param layer Layer to be inserted. - @param belowLayer A layer that's already on the map view. + @param layer The layer to insert. + @param sibling An existing layer in the style. + */ +- (void)insertLayer:(MGLStyleLayer *)layer belowLayer:(MGLStyleLayer *)sibling; + +/** + Inserts a new layer above another layer. + + @param layer The layer to insert. + @param sibling An existing layer in the style. */ -- (void)insertLayer:(MGLStyleLayer *)layer belowLayer:(MGLStyleLayer *)otherLayer; +- (void)insertLayer:(MGLStyleLayer *)layer aboveLayer:(MGLStyleLayer *)sibling; /** Removes a layer from the map view. |