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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
<%
const type = locals.type;
const layoutProperties = locals.layoutProperties;
const paintProperties = locals.paintProperties;
-%>
// This file is generated.
// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
#import "MGLSource.h"
#import "NSPredicate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#import "MGLStyleAttributeValue.h"
#import "MGL<%- camelize(type) %>StyleLayer.h"
#include <mbgl/style/layers/<%- type %>_layer.hpp>
@interface MGL<%- camelize(type) %>StyleLayer ()
@property (nonatomic) mbgl::style::<%- camelize(type) %>Layer *layer;
@property (nonatomic, readwrite) NSString *layerIdentifier;
@property (nonatomic, readwrite) NSString *sourceIdentifier;
@property (nonatomic, readwrite) NSString *sourceLayerIdentifier;
@end
@implementation MGL<%- camelize(type) %>StyleLayer
@synthesize mapView;
<% if (type == 'background') { -%>
- (instancetype)initWithLayerIdentifier:(NSString *)layerIdentifier
{
if (self = [super init]) {
_layerIdentifier = layerIdentifier;
<%- initLayerIdentifierOnly(type) %>
}
return self;
}
<% } -%>
- (instancetype)initWithLayerIdentifier:(NSString *)layerIdentifier source:(MGLSource *)source
{
if (self = [super init]) {
_layerIdentifier = layerIdentifier;
_sourceIdentifier = source.sourceIdentifier;
<%- initLayer(type) %>
}
return self;
}
<% if (type !== 'background' && type !== 'raster') { -%>
- (instancetype)initWithLayerIdentifier:(NSString *)layerIdentifier source:(MGLSource *)source sourceLayer:(NSString *)sourceLayer
{
if (self = [super init]) {
_layerIdentifier = layerIdentifier;
_sourceIdentifier = source.sourceIdentifier;
<%- initLayerWithSourceLayer(type) %>
<%- setSourceLayer() %>
}
return self;
}
<% } -%>
<% if (type !== 'background' && type !== 'raster') { -%>
- (void)setPredicate:(NSPredicate *)predicate
{
self.layer->setFilter(predicate.mgl_filter);
}
- (NSPredicate *)predicate
{
return [NSPredicate mgl_predicateWithFilter:self.layer->getFilter()];
}
<% } -%>
<% if (layoutProperties.length) { -%>
#pragma mark - Accessing the Layout Attributes
<% for (const property of layoutProperties) { -%>
- (void)set<%- camelize(property.name) %>:(<%- propertyType(property, true, type) %>)<%- objCName(property) %> {
<%- setterImplementation(property, type) %>
}
- (<%- propertyType(property, false, type) %>)<%- objCName(property) %> {
<%- getterImplementation(property, type) %>
}
<% } -%>
<% } -%>
<% if (paintProperties.length) { -%>
#pragma mark - Accessing the Paint Attributes
<% for (const property of paintProperties) { -%>
- (void)set<%- camelize(property.name) %>:(<%- propertyType(property, true, type) %>)<%- objCName(property) %> {
<%- setterImplementation(property, type) %>
}
- (<%- propertyType(property, false, type) %>)<%- objCName(property) %> {
<%- getterImplementation(property, type) %>
}
<% } -%>
<% } -%>
@end
|