summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLSource_Private.h
blob: 3100e0ae6e6aa88f43ea6f42323f0fba6700c22c (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
#import "MGLSource.h"

namespace mbgl {
    namespace style {
        class Source;
    }
}

@class MGLMapView;

@interface MGLSource (Private)

/**
 Initializes and returns a source with a raw pointer to the backing store.
 */
- (instancetype)initWithRawSource:(mbgl::style::Source *)rawSource;

/**
 A raw pointer to the mbgl object, which is always initialized, either to the 
 value returned by `mbgl::Map getSource`, or for independently created objects,
 to the pointer value held in `pendingSource`. In the latter case, this raw
 pointer value stays even after ownership of the object is transferred via 
 `mbgl::Map addSource`.
 */
@property (nonatomic) mbgl::style::Source *rawSource;

/**
 Adds the mbgl source that this object represents to the mbgl map.
 
 Once a mbgl source 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::Source`. If this object's mbgl source is in that state, the mbgl source 
 can still be changed but the changes will not be visible until the `MGLSource` 
 is added back to the map via `-[MGLStyle addSource:]` and styled with a 
 `MGLLayer`.
 */
- (void)addToMapView:(MGLMapView *)mapView;

/**
 Removes the mbgl source that this object represents from the mbgl map.
 
 When a mbgl source is removed, ownership of the object is transferred back
 to the `MGLSource` instance and the unique_ptr reference is valid again. It is
 safe to add the source back to the style after it is removed.
 */
- (void)removeFromMapView:(MGLMapView *)mapView;

@end