summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLFillStyleLayer.mm
blob: 7127c3a5de835a8cc80675d1a0ced3be47acb4f4 (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// This file is generated. 
// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.

#import "MGLBaseStyleLayer_Private.hpp"
#import "MGLStyleLayer_Private.hpp"
#import "MGLStyleAttributeValue.h"
#import "MGLFillStyleLayer.h"

#include <mbgl/style/layers/fill_layer.hpp>

@interface MGLFillStyleLayer ()

@property (nonatomic) mbgl::style::FillLayer *layer;
@property (nonatomic, readwrite) NSString *layerIdentifier;
@property (nonatomic, readwrite) NSString *sourceIdentifier;

@end

@implementation MGLFillStyleLayer

@synthesize mapView;

- (instancetype)initWithLayerIdentifier:(NSString *)layerIdentifier sourceIdentifier:(NSString *)sourceIdentifier {
    if (self = [super init]) {
        _layerIdentifier = layerIdentifier;
        _sourceIdentifier = sourceIdentifier;
        _layer = new mbgl::style::FillLayer(layerIdentifier.UTF8String, sourceIdentifier.UTF8String);
    }
    return self;
}

#pragma mark - Accessing the Paint Attributes

- (void)setFillAntialias:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)fillAntialias {
    self.layer->setFillAntialias(fillAntialias.mbgl_boolPropertyValue);
    [self update];
}

- (id <MGLStyleAttributeValue>)fillAntialias {
    return [MGLStyleAttribute mbgl_boolPropertyValueWith:self.layer->getFillAntialias()];
}

- (void)setFillOpacity:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)fillOpacity {
    self.layer->setFillOpacity(fillOpacity.mbgl_floatPropertyValue);
    [self update];
}

- (id <MGLStyleAttributeValue>)fillOpacity {
    return [MGLStyleAttribute mbgl_numberPropertyValueWith:self.layer->getFillOpacity()];
}

- (void)setFillColor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)fillColor {
    self.layer->setFillColor(fillColor.mbgl_colorPropertyValue);
    [self update];
}

- (id <MGLStyleAttributeValue>)fillColor {
    return [MGLStyleAttribute mbgl_colorPropertyValueWith:self.layer->getFillColor()];
}

- (void)setFillOutlineColor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)fillOutlineColor {
    self.layer->setFillOutlineColor(fillOutlineColor.mbgl_colorPropertyValue);
    [self update];
}

- (id <MGLStyleAttributeValue>)fillOutlineColor {
    return [MGLStyleAttribute mbgl_colorPropertyValueWith:self.layer->getFillOutlineColor()];
}

- (void)setFillTranslate:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)fillTranslate {
    self.layer->setFillTranslate(fillTranslate.mbgl_offsetPropertyValue);
    [self update];
}

- (id <MGLStyleAttributeValue>)fillTranslate {
    return [MGLStyleAttribute mbgl_offsetPropertyValueWith:self.layer->getFillTranslate()];
}

- (void)setFillTranslateAnchor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)fillTranslateAnchor {
    MGLSetEnumProperty(fillTranslateAnchor, FillTranslateAnchor, TranslateAnchorType, MGLFillStyleLayerFillTranslateAnchor);
    [self update];
}

- (id <MGLStyleAttributeValue>)fillTranslateAnchor {
    MGLGetEnumProperty(FillTranslateAnchor, TranslateAnchorType, MGLFillStyleLayerFillTranslateAnchor);
}

- (void)setFillPattern:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)fillPattern {
    self.layer->setFillPattern(fillPattern.mbgl_stringPropertyValue);
    [self update];
}

- (id <MGLStyleAttributeValue>)fillPattern {
    return [MGLStyleAttribute mbgl_stringPropertyValueWith:self.layer->getFillPattern()];
}

@end