blob: b5d709a7afc43263ec27b0052d2d81a01a23cf39 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#import <Foundation/Foundation.h>
#import "MGLStyleLayer.h"
#import "MGLStyleValue_Private.h"
#include <mbgl/style/layer.hpp>
NS_ASSUME_NONNULL_BEGIN
/**
Assert that the style layer is valid.
This macro should be used at the beginning of any public-facing instance method
of `MGLStyleLayer` and its subclasses. For private methods, an assertion is more appropriate.
*/
#define MGLAssertStyleLayerIsValid() \
do { \
if (!self.rawLayer) { \
[NSException raise:@"Invalid style layer" \
format: \
@"-[MGLStyle removeLayer:] has been called " \
@"with this instance but another style layer instance was added with the same identifer. It is an " \
@"error to send any message to this layer since it cannot be recovered after removal due to the " \
@"identifier collision. Use unique identifiers for all layer instances including layers of " \
@"different types."]; \
} \
} while (NO);
@class MGLMapView;
@interface MGLStyleLayer (Private)
@property (nonatomic, readwrite, copy) NSString *identifier;
/**
A raw pointer to the mbgl object, which is always initialized, either to the
value returned by `mbgl::Map getLayer`, or for independently created objects,
to the pointer value held in `pendingLayer`. In the latter case, this raw
pointer value stays even after ownership of the object is transferred via
`mbgl::Map addLayer`.
*/
@property (nonatomic) mbgl::style::Layer *rawLayer;
/**
Adds the mbgl style layer that this object represents to the mbgl map below the
specified `otherLayer`.
Once a mbgl style layer is added, ownership of the object is transferred to the
`mbgl::Map` and this object no longer has an active unique_ptr reference to the
`mbgl::style::Layer`.
*/
- (void)addToMapView:(MGLMapView *)mapView belowLayer:(nullable MGLStyleLayer *)otherLayer;
/**
Removes the mbgl style layer that this object represents from the mbgl map.
When a mbgl style layer is removed, ownership of the object is transferred back
to the `MGLStyleLayer` instance and the unique_ptr reference is valid again. It
is safe to add the layer back to the style after it is removed.
*/
- (void)removeFromMapView:(MGLMapView *)mapView;
@end
NS_ASSUME_NONNULL_END
|