blob: 47f41e0388c7a3bb2f9fc6cb49b3cb42fddda524 (
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
66
67
68
69
70
71
72
73
74
75
|
#import "MGLStyleLayer_Private.h"
#import "MGLMapView_Private.h"
#include <mbgl/style/layer.hpp>
@interface MGLStyleLayer ()
@property (nonatomic) mbgl::style::Layer *rawLayer;
@end
@implementation MGLStyleLayer
- (instancetype)initWithIdentifier:(NSString *)identifier
{
if (self = [super init]) {
_identifier = identifier;
}
return self;
}
- (void)setVisible:(BOOL)visible
{
MGLAssertStyleLayerIsValid();
mbgl::style::VisibilityType v = visible
? mbgl::style::VisibilityType::Visible
: mbgl::style::VisibilityType::None;
self.rawLayer->setVisibility(v);
}
- (BOOL)isVisible
{
MGLAssertStyleLayerIsValid();
mbgl::style::VisibilityType v = self.rawLayer->getVisibility();
return (v == mbgl::style::VisibilityType::Visible);
}
- (void)setMaximumZoomLevel:(float)maximumZoomLevel
{
MGLAssertStyleLayerIsValid();
self.rawLayer->setMaxZoom(maximumZoomLevel);
}
- (float)maximumZoomLevel
{
MGLAssertStyleLayerIsValid();
return self.rawLayer->getMaxZoom();
}
- (void)setMinimumZoomLevel:(float)minimumZoomLevel
{
MGLAssertStyleLayerIsValid();
self.rawLayer->setMinZoom(minimumZoomLevel);
}
- (float)minimumZoomLevel
{
MGLAssertStyleLayerIsValid();
return self.rawLayer->getMinZoom();
}
- (NSString *)description
{
return [NSString stringWithFormat:@"<%@: %p; identifier = %@; visible = %@>",
NSStringFromClass([self class]), (void *)self, self.identifier,
self.visible ? @"YES" : @"NO"];
}
@end
|