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

#include <mbgl/style/source.hpp>

@interface MGLSource ()

// Even though this class is abstract, MGLStyle uses it to represent some
// special internal source types like mbgl::AnnotationSource.
@property (nonatomic) mbgl::style::Source *rawSource;

@end

@implementation MGLSource

- (instancetype)initWithIdentifier:(NSString *)identifier
{
    if (self = [super init]) {
        _identifier = identifier;
    }
    return self;
}

- (void)addToMapView:(MGLMapView *)mapView {
    [NSException raise:NSInvalidArgumentException format:
     @"The source %@ cannot be added to the style. "
     @"Make sure the source was created as a member of a concrete subclass of MGLSource.",
     self];
}

- (void)removeFromMapView:(MGLMapView *)mapView {
    [NSException raise:NSInvalidArgumentException format:
     @"The source %@ cannot be removed from the style. "
     @"Make sure the source was created as a member of a concrete subclass of MGLSource.",
     self];
}

- (NSString *)description {
    return [NSString stringWithFormat:@"<%@: %p; identifier = %@>",
            NSStringFromClass([self class]), (void *)self, self.identifier];
}

@end