summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorJesse Bounds <jesse@rebounds.net>2016-11-14 16:59:30 -0800
committerJesse Bounds <jesse@rebounds.net>2016-11-22 19:53:54 -0800
commit13e0f9e527366dce43f59055fde17818f443e356 (patch)
tree83b3ca4e2b0f103575c28335ac39fc76b7ec33a5 /platform
parent4e4e05ef50808a27d7a9a46c830d05165bd85e94 (diff)
downloadqtlocation-mapboxgl-13e0f9e527366dce43f59055fde17818f443e356.tar.gz
[ios, macos] Refactor runtime styling enumeration properties
Correctly map SDK runtime styling enumerations to mbgl equivalents. Also, add category methods to NSValue so enums can be wrapped up with less of the details of how they are layed out in memory in Objective-C.
Diffstat (limited to 'platform')
-rw-r--r--platform/darwin/scripts/generate-style-code.js22
-rw-r--r--platform/darwin/src/MGLBackgroundStyleLayer.mm19
-rw-r--r--platform/darwin/src/MGLCircleStyleLayer.mm72
-rw-r--r--platform/darwin/src/MGLFillStyleLayer.mm60
-rw-r--r--platform/darwin/src/MGLLineStyleLayer.mm114
-rw-r--r--platform/darwin/src/MGLRasterStyleLayer.mm36
-rw-r--r--platform/darwin/src/MGLStyleLayer.mm.ejs81
-rw-r--r--platform/darwin/src/MGLStyleValue_Private.h100
-rw-r--r--platform/darwin/src/MGLSymbolStyleLayer.mm346
-rw-r--r--platform/darwin/src/NSValue+MGLStyleEnumAttributeAdditions.h232
-rw-r--r--platform/darwin/src/NSValue+MGLStyleEnumAttributeAdditions.h.ejs66
-rw-r--r--platform/darwin/src/NSValue+MGLStyleEnumAttributeAdditions.mm169
-rw-r--r--platform/darwin/src/NSValue+MGLStyleEnumAttributeAdditions.mm.ejs46
-rw-r--r--platform/ios/app/MBXViewController.m55
-rw-r--r--platform/ios/ios.xcodeproj/project.pbxproj16
-rw-r--r--platform/ios/src/Mapbox.h1
-rw-r--r--platform/macos/macos.xcodeproj/project.pbxproj12
-rw-r--r--platform/macos/src/Mapbox.h1
18 files changed, 1160 insertions, 288 deletions
diff --git a/platform/darwin/scripts/generate-style-code.js b/platform/darwin/scripts/generate-style-code.js
index 80d7504de4..9090bb40e6 100644
--- a/platform/darwin/scripts/generate-style-code.js
+++ b/platform/darwin/scripts/generate-style-code.js
@@ -301,6 +301,8 @@ global.mbglType = function(property) {
const layerH = ejs.compile(fs.readFileSync('platform/darwin/src/MGLStyleLayer.h.ejs', 'utf8'), { strict: true });
const layerM = ejs.compile(fs.readFileSync('platform/darwin/src/MGLStyleLayer.mm.ejs', 'utf8'), { strict: true});
const testLayers = ejs.compile(fs.readFileSync('platform/darwin/src/MGLRuntimeStylingTests.m.ejs', 'utf8'), { strict: true});
+const categoryH = ejs.compile(fs.readFileSync('platform/darwin/src/NSValue+MGLStyleEnumAttributeAdditions.h.ejs', 'utf8'), { strict: true});
+const categoryM = ejs.compile(fs.readFileSync('platform/darwin/src/NSValue+MGLStyleEnumAttributeAdditions.mm.ejs', 'utf8'), { strict: true});
const layers = Object.keys(spec.layer.type.values).map((type) => {
const layoutProperties = Object.keys(spec[`layout_${type}`]).reduce((memo, name) => {
@@ -345,8 +347,28 @@ ${macosComment}${decl}
});
}
+var allLayoutProperties = [];
+var allPaintProperties = [];
+var allTypes = [];
+
for (var layer of layers) {
+ allLayoutProperties.push(layer.layoutProperties);
+ allPaintProperties.push(layer.paintProperties);
+ allTypes.push(layer.type);
+ const containsEnumerationProperties = _.filter(layer.layoutProperties, function(property){ return property["type"] === "enum"; }).length || _.filter(layer.paintProperties, function(property){ return property["type"] === "enum"; }).length;
+ layer.containsEnumerationProperties = containsEnumerationProperties;
+
fs.writeFileSync(`platform/darwin/src/${prefix}${camelize(layer.type)}${suffix}.h`, duplicatePlatformDecls(layerH(layer)));
fs.writeFileSync(`platform/darwin/src/${prefix}${camelize(layer.type)}${suffix}.mm`, layerM(layer));
fs.writeFileSync(`platform/darwin/test/${prefix}${camelize(layer.type)}${suffix}Tests.m`, testLayers(layer));
}
+
+fs.writeFileSync(`platform/darwin/src/NSValue+MGLStyleEnumAttributeAdditions.h`, categoryH({
+ layoutProperties: _.flatten(allLayoutProperties),
+ paintProperties: _.flatten(allPaintProperties),
+ types: allTypes
+}));
+fs.writeFileSync(`platform/darwin/src/NSValue+MGLStyleEnumAttributeAdditions.mm`, categoryM({
+ layoutProperties: _.flatten(allLayoutProperties),
+ paintProperties: _.flatten(allPaintProperties)
+}));
diff --git a/platform/darwin/src/MGLBackgroundStyleLayer.mm b/platform/darwin/src/MGLBackgroundStyleLayer.mm
index a4914d3242..386c6322eb 100644
--- a/platform/darwin/src/MGLBackgroundStyleLayer.mm
+++ b/platform/darwin/src/MGLBackgroundStyleLayer.mm
@@ -10,6 +10,7 @@
#include <mbgl/style/layers/background_layer.hpp>
+
@interface MGLBackgroundStyleLayer ()
@property (nonatomic) mbgl::style::BackgroundLayer *rawLayer;
@@ -26,13 +27,11 @@
if (self = [super initWithIdentifier:identifier]) {
auto layer = std::make_unique<mbgl::style::BackgroundLayer>(identifier.UTF8String);
_pendingLayer = std::move(layer);
- self.rawLayer = _pendingLayer.get();
+ _rawLayer = _pendingLayer.get();
}
return self;
}
-
-
#pragma mark - Adding to and removing from a map view
- (void)addToMapView:(MGLMapView *)mapView
@@ -54,38 +53,38 @@
{
auto removedLayer = mapView.mbglMap->removeLayer(self.identifier.UTF8String);
_pendingLayer = std::move(reinterpret_cast<std::unique_ptr<mbgl::style::BackgroundLayer> &>(removedLayer));
- self.rawLayer = _pendingLayer.get();
+ _rawLayer = _pendingLayer.get();
}
#pragma mark - Accessing the Paint Attributes
- (void)setBackgroundColor:(MGLStyleValue<MGLColor *> *)backgroundColor {
auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue(backgroundColor);
- self.rawLayer->setBackgroundColor(mbglValue);
+ _rawLayer->setBackgroundColor(mbglValue);
}
- (MGLStyleValue<MGLColor *> *)backgroundColor {
- auto propertyValue = self.rawLayer->getBackgroundColor() ?: self.rawLayer->getDefaultBackgroundColor();
+ auto propertyValue = _rawLayer->getBackgroundColor() ?: _rawLayer->getDefaultBackgroundColor();
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toStyleValue(propertyValue);
}
- (void)setBackgroundPattern:(MGLStyleValue<NSString *> *)backgroundPattern {
auto mbglValue = MGLStyleValueTransformer<std::string, NSString *>().toPropertyValue(backgroundPattern);
- self.rawLayer->setBackgroundPattern(mbglValue);
+ _rawLayer->setBackgroundPattern(mbglValue);
}
- (MGLStyleValue<NSString *> *)backgroundPattern {
- auto propertyValue = self.rawLayer->getBackgroundPattern() ?: self.rawLayer->getDefaultBackgroundPattern();
+ auto propertyValue = _rawLayer->getBackgroundPattern() ?: _rawLayer->getDefaultBackgroundPattern();
return MGLStyleValueTransformer<std::string, NSString *>().toStyleValue(propertyValue);
}
- (void)setBackgroundOpacity:(MGLStyleValue<NSNumber *> *)backgroundOpacity {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(backgroundOpacity);
- self.rawLayer->setBackgroundOpacity(mbglValue);
+ _rawLayer->setBackgroundOpacity(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)backgroundOpacity {
- auto propertyValue = self.rawLayer->getBackgroundOpacity() ?: self.rawLayer->getDefaultBackgroundOpacity();
+ auto propertyValue = _rawLayer->getBackgroundOpacity() ?: _rawLayer->getDefaultBackgroundOpacity();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
diff --git a/platform/darwin/src/MGLCircleStyleLayer.mm b/platform/darwin/src/MGLCircleStyleLayer.mm
index 13262a8c9c..4e5f2c7fdf 100644
--- a/platform/darwin/src/MGLCircleStyleLayer.mm
+++ b/platform/darwin/src/MGLCircleStyleLayer.mm
@@ -10,6 +10,20 @@
#include <mbgl/style/layers/circle_layer.hpp>
+namespace mbgl {
+
+ MBGL_DEFINE_ENUM(MGLCircleTranslateAnchor, {
+ { MGLCircleTranslateAnchorMap, "map" },
+ { MGLCircleTranslateAnchorViewport, "viewport" },
+ });
+
+ MBGL_DEFINE_ENUM(MGLCirclePitchScale, {
+ { MGLCirclePitchScaleMap, "map" },
+ { MGLCirclePitchScaleViewport, "viewport" },
+ });
+
+}
+
@interface MGLCircleStyleLayer ()
@property (nonatomic) mbgl::style::CircleLayer *rawLayer;
@@ -26,34 +40,30 @@
if (self = [super initWithIdentifier:identifier source:source]) {
auto layer = std::make_unique<mbgl::style::CircleLayer>(identifier.UTF8String, source.identifier.UTF8String);
_pendingLayer = std::move(layer);
- self.rawLayer = _pendingLayer.get();
+ _rawLayer = _pendingLayer.get();
}
return self;
}
-
-
- (NSString *)sourceLayerIdentifier
{
- auto layerID = self.rawLayer->getSourceLayer();
+ auto layerID = _rawLayer->getSourceLayer();
return layerID.empty() ? nil : @(layerID.c_str());
}
- (void)setSourceLayerIdentifier:(NSString *)sourceLayerIdentifier
{
- self.rawLayer->setSourceLayer(sourceLayerIdentifier.UTF8String ?: "");
+ _rawLayer->setSourceLayer(sourceLayerIdentifier.UTF8String ?: "");
}
- (void)setPredicate:(NSPredicate *)predicate
{
- self.rawLayer->setFilter(predicate.mgl_filter);
+ _rawLayer->setFilter(predicate.mgl_filter);
}
- (NSPredicate *)predicate
{
- return [NSPredicate mgl_predicateWithFilter:self.rawLayer->getFilter()];
+ return [NSPredicate mgl_predicateWithFilter:_rawLayer->getFilter()];
}
-
-
#pragma mark - Adding to and removing from a map view
- (void)addToMapView:(MGLMapView *)mapView
@@ -75,79 +85,85 @@
{
auto removedLayer = mapView.mbglMap->removeLayer(self.identifier.UTF8String);
_pendingLayer = std::move(reinterpret_cast<std::unique_ptr<mbgl::style::CircleLayer> &>(removedLayer));
- self.rawLayer = _pendingLayer.get();
+ _rawLayer = _pendingLayer.get();
}
#pragma mark - Accessing the Paint Attributes
- (void)setCircleRadius:(MGLStyleValue<NSNumber *> *)circleRadius {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(circleRadius);
- self.rawLayer->setCircleRadius(mbglValue);
+ _rawLayer->setCircleRadius(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)circleRadius {
- auto propertyValue = self.rawLayer->getCircleRadius() ?: self.rawLayer->getDefaultCircleRadius();
+ auto propertyValue = _rawLayer->getCircleRadius() ?: _rawLayer->getDefaultCircleRadius();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setCircleColor:(MGLStyleValue<MGLColor *> *)circleColor {
auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue(circleColor);
- self.rawLayer->setCircleColor(mbglValue);
+ _rawLayer->setCircleColor(mbglValue);
}
- (MGLStyleValue<MGLColor *> *)circleColor {
- auto propertyValue = self.rawLayer->getCircleColor() ?: self.rawLayer->getDefaultCircleColor();
+ auto propertyValue = _rawLayer->getCircleColor() ?: _rawLayer->getDefaultCircleColor();
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toStyleValue(propertyValue);
}
- (void)setCircleBlur:(MGLStyleValue<NSNumber *> *)circleBlur {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(circleBlur);
- self.rawLayer->setCircleBlur(mbglValue);
+ _rawLayer->setCircleBlur(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)circleBlur {
- auto propertyValue = self.rawLayer->getCircleBlur() ?: self.rawLayer->getDefaultCircleBlur();
+ auto propertyValue = _rawLayer->getCircleBlur() ?: _rawLayer->getDefaultCircleBlur();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setCircleOpacity:(MGLStyleValue<NSNumber *> *)circleOpacity {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(circleOpacity);
- self.rawLayer->setCircleOpacity(mbglValue);
+ _rawLayer->setCircleOpacity(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)circleOpacity {
- auto propertyValue = self.rawLayer->getCircleOpacity() ?: self.rawLayer->getDefaultCircleOpacity();
+ auto propertyValue = _rawLayer->getCircleOpacity() ?: _rawLayer->getDefaultCircleOpacity();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setCircleTranslate:(MGLStyleValue<NSValue *> *)circleTranslate {
auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue(circleTranslate);
- self.rawLayer->setCircleTranslate(mbglValue);
+ _rawLayer->setCircleTranslate(mbglValue);
}
- (MGLStyleValue<NSValue *> *)circleTranslate {
- auto propertyValue = self.rawLayer->getCircleTranslate() ?: self.rawLayer->getDefaultCircleTranslate();
+ auto propertyValue = _rawLayer->getCircleTranslate() ?: _rawLayer->getDefaultCircleTranslate();
return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
- (void)setCircleTranslateAnchor:(MGLStyleValue<NSValue *> *)circleTranslateAnchor {
- auto mbglValue = MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *>().toPropertyValue(circleTranslateAnchor);
- self.rawLayer->setCircleTranslateAnchor(mbglValue);
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::TranslateAnchorType,
+ NSValue *,
+ mbgl::style::TranslateAnchorType,
+ MGLCircleTranslateAnchor>().toEnumPropertyValue(circleTranslateAnchor);
+ _rawLayer->setCircleTranslateAnchor(mbglValue);
}
- (MGLStyleValue<NSValue *> *)circleTranslateAnchor {
- auto propertyValue = self.rawLayer->getCircleTranslateAnchor() ?: self.rawLayer->getDefaultCircleTranslateAnchor();
- return MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *>().toStyleValue(propertyValue);
+ auto propertyValue = _rawLayer->getCircleTranslateAnchor() ?: _rawLayer->getDefaultCircleTranslateAnchor();
+ return MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *, mbgl::style::TranslateAnchorType, MGLCircleTranslateAnchor>().toEnumStyleValue(propertyValue);
}
- (void)setCirclePitchScale:(MGLStyleValue<NSValue *> *)circlePitchScale {
- auto mbglValue = MGLStyleValueTransformer<mbgl::style::CirclePitchScaleType, NSValue *>().toPropertyValue(circlePitchScale);
- self.rawLayer->setCirclePitchScale(mbglValue);
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::CirclePitchScaleType,
+ NSValue *,
+ mbgl::style::CirclePitchScaleType,
+ MGLCirclePitchScale>().toEnumPropertyValue(circlePitchScale);
+ _rawLayer->setCirclePitchScale(mbglValue);
}
- (MGLStyleValue<NSValue *> *)circlePitchScale {
- auto propertyValue = self.rawLayer->getCirclePitchScale() ?: self.rawLayer->getDefaultCirclePitchScale();
- return MGLStyleValueTransformer<mbgl::style::CirclePitchScaleType, NSValue *>().toStyleValue(propertyValue);
+ auto propertyValue = _rawLayer->getCirclePitchScale() ?: _rawLayer->getDefaultCirclePitchScale();
+ return MGLStyleValueTransformer<mbgl::style::CirclePitchScaleType, NSValue *, mbgl::style::CirclePitchScaleType, MGLCirclePitchScale>().toEnumStyleValue(propertyValue);
}
diff --git a/platform/darwin/src/MGLFillStyleLayer.mm b/platform/darwin/src/MGLFillStyleLayer.mm
index 5aed779c86..24c8a90f7f 100644
--- a/platform/darwin/src/MGLFillStyleLayer.mm
+++ b/platform/darwin/src/MGLFillStyleLayer.mm
@@ -10,6 +10,15 @@
#include <mbgl/style/layers/fill_layer.hpp>
+namespace mbgl {
+
+ MBGL_DEFINE_ENUM(MGLFillTranslateAnchor, {
+ { MGLFillTranslateAnchorMap, "map" },
+ { MGLFillTranslateAnchorViewport, "viewport" },
+ });
+
+}
+
@interface MGLFillStyleLayer ()
@property (nonatomic) mbgl::style::FillLayer *rawLayer;
@@ -26,34 +35,30 @@
if (self = [super initWithIdentifier:identifier source:source]) {
auto layer = std::make_unique<mbgl::style::FillLayer>(identifier.UTF8String, source.identifier.UTF8String);
_pendingLayer = std::move(layer);
- self.rawLayer = _pendingLayer.get();
+ _rawLayer = _pendingLayer.get();
}
return self;
}
-
-
- (NSString *)sourceLayerIdentifier
{
- auto layerID = self.rawLayer->getSourceLayer();
+ auto layerID = _rawLayer->getSourceLayer();
return layerID.empty() ? nil : @(layerID.c_str());
}
- (void)setSourceLayerIdentifier:(NSString *)sourceLayerIdentifier
{
- self.rawLayer->setSourceLayer(sourceLayerIdentifier.UTF8String ?: "");
+ _rawLayer->setSourceLayer(sourceLayerIdentifier.UTF8String ?: "");
}
- (void)setPredicate:(NSPredicate *)predicate
{
- self.rawLayer->setFilter(predicate.mgl_filter);
+ _rawLayer->setFilter(predicate.mgl_filter);
}
- (NSPredicate *)predicate
{
- return [NSPredicate mgl_predicateWithFilter:self.rawLayer->getFilter()];
+ return [NSPredicate mgl_predicateWithFilter:_rawLayer->getFilter()];
}
-
-
#pragma mark - Adding to and removing from a map view
- (void)addToMapView:(MGLMapView *)mapView
@@ -75,78 +80,81 @@
{
auto removedLayer = mapView.mbglMap->removeLayer(self.identifier.UTF8String);
_pendingLayer = std::move(reinterpret_cast<std::unique_ptr<mbgl::style::FillLayer> &>(removedLayer));
- self.rawLayer = _pendingLayer.get();
+ _rawLayer = _pendingLayer.get();
}
#pragma mark - Accessing the Paint Attributes
- (void)setFillAntialias:(MGLStyleValue<NSNumber *> *)fillAntialias {
auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue(fillAntialias);
- self.rawLayer->setFillAntialias(mbglValue);
+ _rawLayer->setFillAntialias(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)fillAntialias {
- auto propertyValue = self.rawLayer->getFillAntialias() ?: self.rawLayer->getDefaultFillAntialias();
+ auto propertyValue = _rawLayer->getFillAntialias() ?: _rawLayer->getDefaultFillAntialias();
return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setFillOpacity:(MGLStyleValue<NSNumber *> *)fillOpacity {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(fillOpacity);
- self.rawLayer->setFillOpacity(mbglValue);
+ _rawLayer->setFillOpacity(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)fillOpacity {
- auto propertyValue = self.rawLayer->getFillOpacity() ?: self.rawLayer->getDefaultFillOpacity();
+ auto propertyValue = _rawLayer->getFillOpacity() ?: _rawLayer->getDefaultFillOpacity();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setFillColor:(MGLStyleValue<MGLColor *> *)fillColor {
auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue(fillColor);
- self.rawLayer->setFillColor(mbglValue);
+ _rawLayer->setFillColor(mbglValue);
}
- (MGLStyleValue<MGLColor *> *)fillColor {
- auto propertyValue = self.rawLayer->getFillColor() ?: self.rawLayer->getDefaultFillColor();
+ auto propertyValue = _rawLayer->getFillColor() ?: _rawLayer->getDefaultFillColor();
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toStyleValue(propertyValue);
}
- (void)setFillOutlineColor:(MGLStyleValue<MGLColor *> *)fillOutlineColor {
auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue(fillOutlineColor);
- self.rawLayer->setFillOutlineColor(mbglValue);
+ _rawLayer->setFillOutlineColor(mbglValue);
}
- (MGLStyleValue<MGLColor *> *)fillOutlineColor {
- auto propertyValue = self.rawLayer->getFillOutlineColor() ?: self.rawLayer->getDefaultFillOutlineColor();
+ auto propertyValue = _rawLayer->getFillOutlineColor() ?: _rawLayer->getDefaultFillOutlineColor();
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toStyleValue(propertyValue);
}
- (void)setFillTranslate:(MGLStyleValue<NSValue *> *)fillTranslate {
auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue(fillTranslate);
- self.rawLayer->setFillTranslate(mbglValue);
+ _rawLayer->setFillTranslate(mbglValue);
}
- (MGLStyleValue<NSValue *> *)fillTranslate {
- auto propertyValue = self.rawLayer->getFillTranslate() ?: self.rawLayer->getDefaultFillTranslate();
+ auto propertyValue = _rawLayer->getFillTranslate() ?: _rawLayer->getDefaultFillTranslate();
return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
- (void)setFillTranslateAnchor:(MGLStyleValue<NSValue *> *)fillTranslateAnchor {
- auto mbglValue = MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *>().toPropertyValue(fillTranslateAnchor);
- self.rawLayer->setFillTranslateAnchor(mbglValue);
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::TranslateAnchorType,
+ NSValue *,
+ mbgl::style::TranslateAnchorType,
+ MGLFillTranslateAnchor>().toEnumPropertyValue(fillTranslateAnchor);
+ _rawLayer->setFillTranslateAnchor(mbglValue);
}
- (MGLStyleValue<NSValue *> *)fillTranslateAnchor {
- auto propertyValue = self.rawLayer->getFillTranslateAnchor() ?: self.rawLayer->getDefaultFillTranslateAnchor();
- return MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *>().toStyleValue(propertyValue);
+ auto propertyValue = _rawLayer->getFillTranslateAnchor() ?: _rawLayer->getDefaultFillTranslateAnchor();
+ return MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *, mbgl::style::TranslateAnchorType, MGLFillTranslateAnchor>().toEnumStyleValue(propertyValue);
}
- (void)setFillPattern:(MGLStyleValue<NSString *> *)fillPattern {
auto mbglValue = MGLStyleValueTransformer<std::string, NSString *>().toPropertyValue(fillPattern);
- self.rawLayer->setFillPattern(mbglValue);
+ _rawLayer->setFillPattern(mbglValue);
}
- (MGLStyleValue<NSString *> *)fillPattern {
- auto propertyValue = self.rawLayer->getFillPattern() ?: self.rawLayer->getDefaultFillPattern();
+ auto propertyValue = _rawLayer->getFillPattern() ?: _rawLayer->getDefaultFillPattern();
return MGLStyleValueTransformer<std::string, NSString *>().toStyleValue(propertyValue);
}
diff --git a/platform/darwin/src/MGLLineStyleLayer.mm b/platform/darwin/src/MGLLineStyleLayer.mm
index c7509e2870..93e3106032 100644
--- a/platform/darwin/src/MGLLineStyleLayer.mm
+++ b/platform/darwin/src/MGLLineStyleLayer.mm
@@ -10,6 +10,27 @@
#include <mbgl/style/layers/line_layer.hpp>
+namespace mbgl {
+
+ MBGL_DEFINE_ENUM(MGLLineCap, {
+ { MGLLineCapButt, "butt" },
+ { MGLLineCapRound, "round" },
+ { MGLLineCapSquare, "square" },
+ });
+
+ MBGL_DEFINE_ENUM(MGLLineJoin, {
+ { MGLLineJoinBevel, "bevel" },
+ { MGLLineJoinRound, "round" },
+ { MGLLineJoinMiter, "miter" },
+ });
+
+ MBGL_DEFINE_ENUM(MGLLineTranslateAnchor, {
+ { MGLLineTranslateAnchorMap, "map" },
+ { MGLLineTranslateAnchorViewport, "viewport" },
+ });
+
+}
+
@interface MGLLineStyleLayer ()
@property (nonatomic) mbgl::style::LineLayer *rawLayer;
@@ -26,34 +47,30 @@
if (self = [super initWithIdentifier:identifier source:source]) {
auto layer = std::make_unique<mbgl::style::LineLayer>(identifier.UTF8String, source.identifier.UTF8String);
_pendingLayer = std::move(layer);
- self.rawLayer = _pendingLayer.get();
+ _rawLayer = _pendingLayer.get();
}
return self;
}
-
-
- (NSString *)sourceLayerIdentifier
{
- auto layerID = self.rawLayer->getSourceLayer();
+ auto layerID = _rawLayer->getSourceLayer();
return layerID.empty() ? nil : @(layerID.c_str());
}
- (void)setSourceLayerIdentifier:(NSString *)sourceLayerIdentifier
{
- self.rawLayer->setSourceLayer(sourceLayerIdentifier.UTF8String ?: "");
+ _rawLayer->setSourceLayer(sourceLayerIdentifier.UTF8String ?: "");
}
- (void)setPredicate:(NSPredicate *)predicate
{
- self.rawLayer->setFilter(predicate.mgl_filter);
+ _rawLayer->setFilter(predicate.mgl_filter);
}
- (NSPredicate *)predicate
{
- return [NSPredicate mgl_predicateWithFilter:self.rawLayer->getFilter()];
+ return [NSPredicate mgl_predicateWithFilter:_rawLayer->getFilter()];
}
-
-
#pragma mark - Adding to and removing from a map view
- (void)addToMapView:(MGLMapView *)mapView
@@ -75,48 +92,54 @@
{
auto removedLayer = mapView.mbglMap->removeLayer(self.identifier.UTF8String);
_pendingLayer = std::move(reinterpret_cast<std::unique_ptr<mbgl::style::LineLayer> &>(removedLayer));
- self.rawLayer = _pendingLayer.get();
+ _rawLayer = _pendingLayer.get();
}
#pragma mark - Accessing the Layout Attributes
- (void)setLineCap:(MGLStyleValue<NSValue *> *)lineCap {
- auto mbglValue = MGLStyleValueTransformer<mbgl::style::LineCapType, NSValue *>().toPropertyValue(lineCap);
- self.rawLayer->setLineCap(mbglValue);
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::LineCapType,
+ NSValue *,
+ mbgl::style::LineCapType,
+ MGLLineCap>().toEnumPropertyValue(lineCap);
+ _rawLayer->setLineCap(mbglValue);
}
- (MGLStyleValue<NSValue *> *)lineCap {
- auto propertyValue = self.rawLayer->getLineCap() ?: self.rawLayer->getDefaultLineCap();
- return MGLStyleValueTransformer<mbgl::style::LineCapType, NSValue *>().toStyleValue(propertyValue);
+ auto propertyValue = _rawLayer->getLineCap() ?: _rawLayer->getDefaultLineCap();
+ return MGLStyleValueTransformer<mbgl::style::LineCapType, NSValue *, mbgl::style::LineCapType, MGLLineCap>().toEnumStyleValue(propertyValue);
}
- (void)setLineJoin:(MGLStyleValue<NSValue *> *)lineJoin {
- auto mbglValue = MGLStyleValueTransformer<mbgl::style::LineJoinType, NSValue *>().toPropertyValue(lineJoin);
- self.rawLayer->setLineJoin(mbglValue);
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::LineJoinType,
+ NSValue *,
+ mbgl::style::LineJoinType,
+ MGLLineJoin>().toEnumPropertyValue(lineJoin);
+ _rawLayer->setLineJoin(mbglValue);
}
- (MGLStyleValue<NSValue *> *)lineJoin {
- auto propertyValue = self.rawLayer->getLineJoin() ?: self.rawLayer->getDefaultLineJoin();
- return MGLStyleValueTransformer<mbgl::style::LineJoinType, NSValue *>().toStyleValue(propertyValue);
+ auto propertyValue = _rawLayer->getLineJoin() ?: _rawLayer->getDefaultLineJoin();
+ return MGLStyleValueTransformer<mbgl::style::LineJoinType, NSValue *, mbgl::style::LineJoinType, MGLLineJoin>().toEnumStyleValue(propertyValue);
}
- (void)setLineMiterLimit:(MGLStyleValue<NSNumber *> *)lineMiterLimit {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(lineMiterLimit);
- self.rawLayer->setLineMiterLimit(mbglValue);
+ _rawLayer->setLineMiterLimit(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)lineMiterLimit {
- auto propertyValue = self.rawLayer->getLineMiterLimit() ?: self.rawLayer->getDefaultLineMiterLimit();
+ auto propertyValue = _rawLayer->getLineMiterLimit() ?: _rawLayer->getDefaultLineMiterLimit();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setLineRoundLimit:(MGLStyleValue<NSNumber *> *)lineRoundLimit {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(lineRoundLimit);
- self.rawLayer->setLineRoundLimit(mbglValue);
+ _rawLayer->setLineRoundLimit(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)lineRoundLimit {
- auto propertyValue = self.rawLayer->getLineRoundLimit() ?: self.rawLayer->getDefaultLineRoundLimit();
+ auto propertyValue = _rawLayer->getLineRoundLimit() ?: _rawLayer->getDefaultLineRoundLimit();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
@@ -124,101 +147,104 @@
- (void)setLineOpacity:(MGLStyleValue<NSNumber *> *)lineOpacity {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(lineOpacity);
- self.rawLayer->setLineOpacity(mbglValue);
+ _rawLayer->setLineOpacity(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)lineOpacity {
- auto propertyValue = self.rawLayer->getLineOpacity() ?: self.rawLayer->getDefaultLineOpacity();
+ auto propertyValue = _rawLayer->getLineOpacity() ?: _rawLayer->getDefaultLineOpacity();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setLineColor:(MGLStyleValue<MGLColor *> *)lineColor {
auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue(lineColor);
- self.rawLayer->setLineColor(mbglValue);
+ _rawLayer->setLineColor(mbglValue);
}
- (MGLStyleValue<MGLColor *> *)lineColor {
- auto propertyValue = self.rawLayer->getLineColor() ?: self.rawLayer->getDefaultLineColor();
+ auto propertyValue = _rawLayer->getLineColor() ?: _rawLayer->getDefaultLineColor();
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toStyleValue(propertyValue);
}
- (void)setLineTranslate:(MGLStyleValue<NSValue *> *)lineTranslate {
auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue(lineTranslate);
- self.rawLayer->setLineTranslate(mbglValue);
+ _rawLayer->setLineTranslate(mbglValue);
}
- (MGLStyleValue<NSValue *> *)lineTranslate {
- auto propertyValue = self.rawLayer->getLineTranslate() ?: self.rawLayer->getDefaultLineTranslate();
+ auto propertyValue = _rawLayer->getLineTranslate() ?: _rawLayer->getDefaultLineTranslate();
return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
- (void)setLineTranslateAnchor:(MGLStyleValue<NSValue *> *)lineTranslateAnchor {
- auto mbglValue = MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *>().toPropertyValue(lineTranslateAnchor);
- self.rawLayer->setLineTranslateAnchor(mbglValue);
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::TranslateAnchorType,
+ NSValue *,
+ mbgl::style::TranslateAnchorType,
+ MGLLineTranslateAnchor>().toEnumPropertyValue(lineTranslateAnchor);
+ _rawLayer->setLineTranslateAnchor(mbglValue);
}
- (MGLStyleValue<NSValue *> *)lineTranslateAnchor {
- auto propertyValue = self.rawLayer->getLineTranslateAnchor() ?: self.rawLayer->getDefaultLineTranslateAnchor();
- return MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *>().toStyleValue(propertyValue);
+ auto propertyValue = _rawLayer->getLineTranslateAnchor() ?: _rawLayer->getDefaultLineTranslateAnchor();
+ return MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *, mbgl::style::TranslateAnchorType, MGLLineTranslateAnchor>().toEnumStyleValue(propertyValue);
}
- (void)setLineWidth:(MGLStyleValue<NSNumber *> *)lineWidth {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(lineWidth);
- self.rawLayer->setLineWidth(mbglValue);
+ _rawLayer->setLineWidth(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)lineWidth {
- auto propertyValue = self.rawLayer->getLineWidth() ?: self.rawLayer->getDefaultLineWidth();
+ auto propertyValue = _rawLayer->getLineWidth() ?: _rawLayer->getDefaultLineWidth();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setLineGapWidth:(MGLStyleValue<NSNumber *> *)lineGapWidth {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(lineGapWidth);
- self.rawLayer->setLineGapWidth(mbglValue);
+ _rawLayer->setLineGapWidth(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)lineGapWidth {
- auto propertyValue = self.rawLayer->getLineGapWidth() ?: self.rawLayer->getDefaultLineGapWidth();
+ auto propertyValue = _rawLayer->getLineGapWidth() ?: _rawLayer->getDefaultLineGapWidth();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setLineOffset:(MGLStyleValue<NSNumber *> *)lineOffset {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(lineOffset);
- self.rawLayer->setLineOffset(mbglValue);
+ _rawLayer->setLineOffset(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)lineOffset {
- auto propertyValue = self.rawLayer->getLineOffset() ?: self.rawLayer->getDefaultLineOffset();
+ auto propertyValue = _rawLayer->getLineOffset() ?: _rawLayer->getDefaultLineOffset();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setLineBlur:(MGLStyleValue<NSNumber *> *)lineBlur {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(lineBlur);
- self.rawLayer->setLineBlur(mbglValue);
+ _rawLayer->setLineBlur(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)lineBlur {
- auto propertyValue = self.rawLayer->getLineBlur() ?: self.rawLayer->getDefaultLineBlur();
+ auto propertyValue = _rawLayer->getLineBlur() ?: _rawLayer->getDefaultLineBlur();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setLineDasharray:(MGLStyleValue<NSArray<NSNumber *> *> *)lineDasharray {
auto mbglValue = MGLStyleValueTransformer<std::vector<float>, NSArray<NSNumber *> *, float>().toPropertyValue(lineDasharray);
- self.rawLayer->setLineDasharray(mbglValue);
+ _rawLayer->setLineDasharray(mbglValue);
}
- (MGLStyleValue<NSArray<NSNumber *> *> *)lineDasharray {
- auto propertyValue = self.rawLayer->getLineDasharray() ?: self.rawLayer->getDefaultLineDasharray();
+ auto propertyValue = _rawLayer->getLineDasharray() ?: _rawLayer->getDefaultLineDasharray();
return MGLStyleValueTransformer<std::vector<float>, NSArray<NSNumber *> *, float>().toStyleValue(propertyValue);
}
- (void)setLinePattern:(MGLStyleValue<NSString *> *)linePattern {
auto mbglValue = MGLStyleValueTransformer<std::string, NSString *>().toPropertyValue(linePattern);
- self.rawLayer->setLinePattern(mbglValue);
+ _rawLayer->setLinePattern(mbglValue);
}
- (MGLStyleValue<NSString *> *)linePattern {
- auto propertyValue = self.rawLayer->getLinePattern() ?: self.rawLayer->getDefaultLinePattern();
+ auto propertyValue = _rawLayer->getLinePattern() ?: _rawLayer->getDefaultLinePattern();
return MGLStyleValueTransformer<std::string, NSString *>().toStyleValue(propertyValue);
}
diff --git a/platform/darwin/src/MGLRasterStyleLayer.mm b/platform/darwin/src/MGLRasterStyleLayer.mm
index 063f5e3384..c6283d89ea 100644
--- a/platform/darwin/src/MGLRasterStyleLayer.mm
+++ b/platform/darwin/src/MGLRasterStyleLayer.mm
@@ -10,6 +10,7 @@
#include <mbgl/style/layers/raster_layer.hpp>
+
@interface MGLRasterStyleLayer ()
@property (nonatomic) mbgl::style::RasterLayer *rawLayer;
@@ -26,13 +27,10 @@
if (self = [super initWithIdentifier:identifier source:source]) {
auto layer = std::make_unique<mbgl::style::RasterLayer>(identifier.UTF8String, source.identifier.UTF8String);
_pendingLayer = std::move(layer);
- self.rawLayer = _pendingLayer.get();
+ _rawLayer = _pendingLayer.get();
}
return self;
}
-
-
-
#pragma mark - Adding to and removing from a map view
- (void)addToMapView:(MGLMapView *)mapView
@@ -54,78 +52,78 @@
{
auto removedLayer = mapView.mbglMap->removeLayer(self.identifier.UTF8String);
_pendingLayer = std::move(reinterpret_cast<std::unique_ptr<mbgl::style::RasterLayer> &>(removedLayer));
- self.rawLayer = _pendingLayer.get();
+ _rawLayer = _pendingLayer.get();
}
#pragma mark - Accessing the Paint Attributes
- (void)setRasterOpacity:(MGLStyleValue<NSNumber *> *)rasterOpacity {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(rasterOpacity);
- self.rawLayer->setRasterOpacity(mbglValue);
+ _rawLayer->setRasterOpacity(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)rasterOpacity {
- auto propertyValue = self.rawLayer->getRasterOpacity() ?: self.rawLayer->getDefaultRasterOpacity();
+ auto propertyValue = _rawLayer->getRasterOpacity() ?: _rawLayer->getDefaultRasterOpacity();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setRasterHueRotate:(MGLStyleValue<NSNumber *> *)rasterHueRotate {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(rasterHueRotate);
- self.rawLayer->setRasterHueRotate(mbglValue);
+ _rawLayer->setRasterHueRotate(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)rasterHueRotate {
- auto propertyValue = self.rawLayer->getRasterHueRotate() ?: self.rawLayer->getDefaultRasterHueRotate();
+ auto propertyValue = _rawLayer->getRasterHueRotate() ?: _rawLayer->getDefaultRasterHueRotate();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setRasterBrightnessMin:(MGLStyleValue<NSNumber *> *)rasterBrightnessMin {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(rasterBrightnessMin);
- self.rawLayer->setRasterBrightnessMin(mbglValue);
+ _rawLayer->setRasterBrightnessMin(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)rasterBrightnessMin {
- auto propertyValue = self.rawLayer->getRasterBrightnessMin() ?: self.rawLayer->getDefaultRasterBrightnessMin();
+ auto propertyValue = _rawLayer->getRasterBrightnessMin() ?: _rawLayer->getDefaultRasterBrightnessMin();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setRasterBrightnessMax:(MGLStyleValue<NSNumber *> *)rasterBrightnessMax {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(rasterBrightnessMax);
- self.rawLayer->setRasterBrightnessMax(mbglValue);
+ _rawLayer->setRasterBrightnessMax(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)rasterBrightnessMax {
- auto propertyValue = self.rawLayer->getRasterBrightnessMax() ?: self.rawLayer->getDefaultRasterBrightnessMax();
+ auto propertyValue = _rawLayer->getRasterBrightnessMax() ?: _rawLayer->getDefaultRasterBrightnessMax();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setRasterSaturation:(MGLStyleValue<NSNumber *> *)rasterSaturation {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(rasterSaturation);
- self.rawLayer->setRasterSaturation(mbglValue);
+ _rawLayer->setRasterSaturation(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)rasterSaturation {
- auto propertyValue = self.rawLayer->getRasterSaturation() ?: self.rawLayer->getDefaultRasterSaturation();
+ auto propertyValue = _rawLayer->getRasterSaturation() ?: _rawLayer->getDefaultRasterSaturation();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setRasterContrast:(MGLStyleValue<NSNumber *> *)rasterContrast {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(rasterContrast);
- self.rawLayer->setRasterContrast(mbglValue);
+ _rawLayer->setRasterContrast(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)rasterContrast {
- auto propertyValue = self.rawLayer->getRasterContrast() ?: self.rawLayer->getDefaultRasterContrast();
+ auto propertyValue = _rawLayer->getRasterContrast() ?: _rawLayer->getDefaultRasterContrast();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setRasterFadeDuration:(MGLStyleValue<NSNumber *> *)rasterFadeDuration {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(rasterFadeDuration);
- self.rawLayer->setRasterFadeDuration(mbglValue);
+ _rawLayer->setRasterFadeDuration(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)rasterFadeDuration {
- auto propertyValue = self.rawLayer->getRasterFadeDuration() ?: self.rawLayer->getDefaultRasterFadeDuration();
+ auto propertyValue = _rawLayer->getRasterFadeDuration() ?: _rawLayer->getDefaultRasterFadeDuration();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
diff --git a/platform/darwin/src/MGLStyleLayer.mm.ejs b/platform/darwin/src/MGLStyleLayer.mm.ejs
index d366a1955b..894375e764 100644
--- a/platform/darwin/src/MGLStyleLayer.mm.ejs
+++ b/platform/darwin/src/MGLStyleLayer.mm.ejs
@@ -2,6 +2,7 @@
const type = locals.type;
const layoutProperties = locals.layoutProperties;
const paintProperties = locals.paintProperties;
+ const containsEnumerationProperties = locals.containsEnumerationProperties;
-%>
// This file is generated.
// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
@@ -15,6 +16,36 @@
#include <mbgl/style/layers/<%- type %>_layer.hpp>
+<% if (containsEnumerationProperties) { -%>
+namespace mbgl {
+
+<% if (layoutProperties.length) { -%>
+<% for (const property of layoutProperties) { -%>
+<% if (property.type == "enum") { -%>
+ MBGL_DEFINE_ENUM(MGL<%- camelize(property.name) %>, {
+<% for (const value in property.values) { -%>
+ { MGL<%- camelize(property.name) %><%- camelize(value) %>, "<%-value%>" },
+<% } -%>
+ });
+
+<% } -%>
+<% } -%>
+<% } -%>
+<% if (paintProperties.length) { -%>
+<% for (const property of paintProperties) { -%>
+<% if (property.type == "enum") { -%>
+ MBGL_DEFINE_ENUM(MGL<%- camelize(property.name) %>, {
+<% for (const value in property.values) { -%>
+ { MGL<%- camelize(property.name) %><%- camelize(value) %>, "<%-value%>" },
+<% } -%>
+ });
+
+<% } -%>
+<% } -%>
+<% } -%>
+}
+<% } -%>
+
@interface MGL<%- camelize(type) %>StyleLayer ()
@property (nonatomic) mbgl::style::<%- camelize(type) %>Layer *rawLayer;
@@ -32,7 +63,7 @@
if (self = [super initWithIdentifier:identifier]) {
auto layer = std::make_unique<mbgl::style::<%- camelize(type) %>Layer>(identifier.UTF8String);
_pendingLayer = std::move(layer);
- self.rawLayer = _pendingLayer.get();
+ _rawLayer = _pendingLayer.get();
}
return self;
}
@@ -43,37 +74,33 @@
if (self = [super initWithIdentifier:identifier source:source]) {
auto layer = std::make_unique<mbgl::style::<%- camelize(type) %>Layer>(identifier.UTF8String, source.identifier.UTF8String);
_pendingLayer = std::move(layer);
- self.rawLayer = _pendingLayer.get();
+ _rawLayer = _pendingLayer.get();
}
return self;
}
-
<% } -%>
-
<% if (type !== 'background' && type !== 'raster') { -%>
- (NSString *)sourceLayerIdentifier
{
- auto layerID = self.rawLayer->getSourceLayer();
+ auto layerID = _rawLayer->getSourceLayer();
return layerID.empty() ? nil : @(layerID.c_str());
}
- (void)setSourceLayerIdentifier:(NSString *)sourceLayerIdentifier
{
- self.rawLayer->setSourceLayer(sourceLayerIdentifier.UTF8String ?: "");
+ _rawLayer->setSourceLayer(sourceLayerIdentifier.UTF8String ?: "");
}
- (void)setPredicate:(NSPredicate *)predicate
{
- self.rawLayer->setFilter(predicate.mgl_filter);
+ _rawLayer->setFilter(predicate.mgl_filter);
}
- (NSPredicate *)predicate
{
- return [NSPredicate mgl_predicateWithFilter:self.rawLayer->getFilter()];
+ return [NSPredicate mgl_predicateWithFilter:_rawLayer->getFilter()];
}
-
<% } -%>
-
#pragma mark - Adding to and removing from a map view
- (void)addToMapView:(MGLMapView *)mapView
@@ -95,7 +122,7 @@
{
auto removedLayer = mapView.mbglMap->removeLayer(self.identifier.UTF8String);
_pendingLayer = std::move(reinterpret_cast<std::unique_ptr<mbgl::style::<%- camelize(type) %>Layer> &>(removedLayer));
- self.rawLayer = _pendingLayer.get();
+ _rawLayer = _pendingLayer.get();
}
<% if (layoutProperties.length) { -%>
@@ -103,13 +130,25 @@
<% for (const property of layoutProperties) { -%>
- (void)set<%- camelize(property.name) %>:(MGLStyleValue<<%- propertyType(property, true) %>> *)<%- objCName(property) %> {
+<% if (property.type == "enum") { -%>
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::<%- mbglType(property) %>,
+ NSValue *,
+ mbgl::style::<%- mbglType(property) %>,
+ MGL<%- camelize(property.name) %>>().toEnumPropertyValue(<%- objCName(property) %>);
+ _rawLayer->set<%- camelize(property.name) %>(mbglValue);
+<% } else { -%>
auto mbglValue = MGLStyleValueTransformer<<%- valueTransformerArguments(property).join(', ') %>>().toPropertyValue(<%- objCName(property) %>);
- self.rawLayer->set<%- camelize(property.name) %>(mbglValue);
+ _rawLayer->set<%- camelize(property.name) %>(mbglValue);
+<% } -%>
}
- (MGLStyleValue<<%- propertyType(property, true) %>> *)<%- objCName(property) %> {
- auto propertyValue = self.rawLayer->get<%- camelize(property.name) %>() ?: self.rawLayer->getDefault<%- camelize(property.name) %>();
+ auto propertyValue = _rawLayer->get<%- camelize(property.name) %>() ?: _rawLayer->getDefault<%- camelize(property.name) %>();
+<% if (property.type == "enum") { -%>
+ return MGLStyleValueTransformer<mbgl::style::<%- mbglType(property) %>, NSValue *, mbgl::style::<%- mbglType(property) %>, MGL<%- camelize(property.name) %>>().toEnumStyleValue(propertyValue);
+<% } else { -%>
return MGLStyleValueTransformer<<%- valueTransformerArguments(property).join(', ') %>>().toStyleValue(propertyValue);
+<% } -%>
}
<% } -%>
@@ -119,13 +158,25 @@
<% for (const property of paintProperties) { -%>
- (void)set<%- camelize(property.name) %>:(MGLStyleValue<<%- propertyType(property, true) %>> *)<%- objCName(property) %> {
+<% if (property.type == "enum") { -%>
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::<%- mbglType(property) %>,
+ NSValue *,
+ mbgl::style::<%- mbglType(property) %>,
+ MGL<%- camelize(property.name) %>>().toEnumPropertyValue(<%- objCName(property) %>);
+ _rawLayer->set<%- camelize(property.name) %>(mbglValue);
+<% } else { -%>
auto mbglValue = MGLStyleValueTransformer<<%- valueTransformerArguments(property).join(', ') %>>().toPropertyValue(<%- objCName(property) %>);
- self.rawLayer->set<%- camelize(property.name) %>(mbglValue);
+ _rawLayer->set<%- camelize(property.name) %>(mbglValue);
+<% } -%>
}
- (MGLStyleValue<<%- propertyType(property, true) %>> *)<%- objCName(property) %> {
- auto propertyValue = self.rawLayer->get<%- camelize(property.name) %>() ?: self.rawLayer->getDefault<%- camelize(property.name) %>();
+ auto propertyValue = _rawLayer->get<%- camelize(property.name) %>() ?: _rawLayer->getDefault<%- camelize(property.name) %>();
+<% if (property.type == "enum") { -%>
+ return MGLStyleValueTransformer<mbgl::style::<%- mbglType(property) %>, NSValue *, mbgl::style::<%- mbglType(property) %>, MGL<%- camelize(property.name) %>>().toEnumStyleValue(propertyValue);
+<% } else { -%>
return MGLStyleValueTransformer<<%- valueTransformerArguments(property).join(', ') %>>().toStyleValue(propertyValue);
+<% } -%>
}
<% } -%>
diff --git a/platform/darwin/src/MGLStyleValue_Private.h b/platform/darwin/src/MGLStyleValue_Private.h
index fdad07aafa..492ce20f1a 100644
--- a/platform/darwin/src/MGLStyleValue_Private.h
+++ b/platform/darwin/src/MGLStyleValue_Private.h
@@ -4,6 +4,8 @@
#import "NSValue+MGLStyleAttributeAdditions.h"
#import "MGLTypes.h"
+#import "MGLLineStyleLayer.h"
+#import <mbgl/util/enum.hpp>
#if TARGET_OS_IPHONE
#import "UIColor+MGLAdditions.h"
@@ -13,7 +15,7 @@
#include <array>
-template <typename MBGLType, typename ObjCType, typename MBGLElement = MBGLType>
+template <typename MBGLType, typename ObjCType, typename MBGLElement = MBGLType, typename ObjCEnum = ObjCType>
class MGLStyleValueTransformer {
public:
@@ -26,7 +28,26 @@ public:
return nil;
}
}
-
+
+ template <typename MBGLEnum = MBGLType,
+ class = typename std::enable_if<std::is_enum<MBGLEnum>::value>::type,
+ typename MGLEnum = ObjCEnum,
+ class = typename std::enable_if<std::is_enum<MGLEnum>::value>::type>
+ MGLStyleValue<ObjCType> *toEnumStyleValue(const mbgl::style::PropertyValue<MBGLEnum> &mbglValue) {
+ if (mbglValue.isConstant()) {
+ return toEnumStyleConstantValue<>(mbglValue.asConstant());
+ } else if (mbglValue.isFunction()) {
+ const auto &mbglStops = mbglValue.asFunction().getStops();
+ NSMutableDictionary *stops = [NSMutableDictionary dictionaryWithCapacity:mbglStops.size()];
+ for (const auto &mbglStop : mbglStops) {
+ stops[@(mbglStop.first)] = toEnumStyleConstantValue<>(mbglStop.second);
+ }
+ return [MGLStyleFunction<NSValue *> functionWithBase:mbglValue.asFunction().getBase() stops:stops];
+ } else {
+ return nil;
+ }
+ }
+
mbgl::style::PropertyValue<MBGLType> toPropertyValue(MGLStyleValue<ObjCType> *value) {
if ([value isKindOfClass:[MGLStyleConstantValue class]]) {
MBGLType mbglValue;
@@ -52,9 +73,39 @@ public:
return {};
}
}
-
+
+ template <typename MBGLEnum = MBGLType,
+ class = typename std::enable_if<std::is_enum<MBGLEnum>::value>::type,
+ typename MGLEnum = ObjCEnum,
+ class = typename std::enable_if<std::is_enum<MGLEnum>::value>::type>
+ mbgl::style::PropertyValue<MBGLEnum> toEnumPropertyValue(MGLStyleValue<ObjCType> *value) {
+ if ([value isKindOfClass:[MGLStyleConstantValue class]]) {
+ MBGLEnum mbglValue;
+ getMBGLValue([(MGLStyleConstantValue<ObjCType> *)value rawValue], mbglValue);
+ return mbglValue;
+ } else if ([value isKindOfClass:[MGLStyleFunction class]]) {
+ MGLStyleFunction<NSValue *> *function = (MGLStyleFunction<NSValue *> *)value;
+ __block std::vector<std::pair<float, MBGLEnum>> mbglStops;
+ [function.stops enumerateKeysAndObjectsUsingBlock:^(NSNumber * _Nonnull zoomKey, MGLStyleValue<NSValue *> * _Nonnull stopValue, BOOL * _Nonnull stop) {
+ NSCAssert([stopValue isKindOfClass:[MGLStyleValue class]], @"Stops should be MGLStyleValues");
+ auto mbglStopValue = toEnumPropertyValue(stopValue);
+ NSCAssert(mbglStopValue.isConstant(), @"Stops must be constant");
+ mbglStops.emplace_back(zoomKey.floatValue, mbglStopValue.asConstant());
+ }];
+ return mbgl::style::Function<MBGLEnum>({{mbglStops}}, function.base);
+ } else if (value) {
+ [NSException raise:@"MGLAbstractClassException" format:
+ @"The style value %@ cannot be applied to the style. "
+ @"Make sure the style value was created as a member of a concrete subclass of MGLStyleValue.",
+ NSStringFromClass([value class])];
+ return {};
+ } else {
+ return {};
+ }
+ }
+
private:
-
+
MGLStyleConstantValue<ObjCType> *toStyleConstantValue(const MBGLType mbglValue) {
auto rawValue = toMGLRawStyleValue(mbglValue);
return [MGLStyleConstantValue<ObjCType> valueWithRawValue:rawValue];
@@ -69,7 +120,17 @@ private:
}
return [MGLStyleFunction<ObjCType> functionWithBase:mbglFunction.getBase() stops:stops];
}
-
+
+ template <typename MBGLEnum = MBGLType,
+ class = typename std::enable_if<std::is_enum<MBGLEnum>::value>::type,
+ typename MGLEnum = ObjCEnum,
+ class = typename std::enable_if<std::is_enum<MGLEnum>::value>::type>
+ MGLStyleConstantValue<ObjCType> *toEnumStyleConstantValue(const MBGLEnum mbglValue) {
+ auto str = mbgl::Enum<MBGLEnum>::toString(mbglValue);
+ MGLEnum mglType = *mbgl::Enum<MGLEnum>::toEnum(str);
+ return [MGLStyleConstantValue<ObjCType> valueWithRawValue:[NSValue value:&mglType withObjCType:@encode(MGLEnum)]];
+ }
+
NSNumber *toMGLRawStyleValue(const bool mbglStopValue) {
return @(mbglStopValue);
}
@@ -92,13 +153,6 @@ private:
return [NSValue mgl_valueWithPaddingArray:mbglStopValue];
}
- // Enumerations
- template <typename MBGLEnum = MBGLType, class = typename std::enable_if<std::is_enum<MBGLEnum>::value>::type>
- ObjCType toMGLRawStyleValue(const MBGLType &mbglStopValue) {
- NSUInteger rawValue = static_cast<NSUInteger>(mbglStopValue);
- return [NSValue value:&rawValue withObjCType:@encode(NSUInteger)];
- }
-
MGLColor *toMGLRawStyleValue(const mbgl::Color mbglStopValue) {
return [MGLColor mgl_colorWithColor:mbglStopValue];
}
@@ -110,9 +164,9 @@ private:
}
return array;
}
-
+
private:
-
+
void getMBGLValue(NSNumber *rawValue, bool &mbglValue) {
mbglValue = !!rawValue.boolValue;
}
@@ -135,12 +189,6 @@ private:
mbglValue = rawValue.mgl_paddingArrayValue;
}
- // Enumerations
- template <typename MBGLEnum = MBGLType, class = typename std::enable_if<std::is_enum<MBGLEnum>::value>::type>
- void getMBGLValue(ObjCType rawValue, MBGLType &mbglValue) {
- [rawValue getValue:&mbglValue];
- }
-
void getMBGLValue(MGLColor *rawValue, mbgl::Color &mbglValue) {
mbglValue = rawValue.mgl_color;
}
@@ -153,4 +201,16 @@ private:
mbglValue.push_back(mbglElement);
}
}
+
+ // Enumerations
+ template <typename MBGLEnum = MBGLType,
+ class = typename std::enable_if<std::is_enum<MBGLEnum>::value>::type,
+ typename MGLEnum = ObjCEnum,
+ class = typename std::enable_if<std::is_enum<MGLEnum>::value>::type>
+ void getMBGLValue(ObjCType rawValue, MBGLEnum &mbglValue) {
+ MGLEnum mglEnum;
+ [rawValue getValue:&mglEnum];
+ auto str = mbgl::Enum<MGLEnum>::toString(mglEnum);
+ mbglValue = *mbgl::Enum<MBGLEnum>::toEnum(str);
+ }
};
diff --git a/platform/darwin/src/MGLSymbolStyleLayer.mm b/platform/darwin/src/MGLSymbolStyleLayer.mm
index 082743be58..636849e87a 100644
--- a/platform/darwin/src/MGLSymbolStyleLayer.mm
+++ b/platform/darwin/src/MGLSymbolStyleLayer.mm
@@ -10,6 +10,74 @@
#include <mbgl/style/layers/symbol_layer.hpp>
+namespace mbgl {
+
+ MBGL_DEFINE_ENUM(MGLSymbolPlacement, {
+ { MGLSymbolPlacementPoint, "point" },
+ { MGLSymbolPlacementLine, "line" },
+ });
+
+ MBGL_DEFINE_ENUM(MGLIconRotationAlignment, {
+ { MGLIconRotationAlignmentMap, "map" },
+ { MGLIconRotationAlignmentViewport, "viewport" },
+ { MGLIconRotationAlignmentAuto, "auto" },
+ });
+
+ MBGL_DEFINE_ENUM(MGLIconTextFit, {
+ { MGLIconTextFitNone, "none" },
+ { MGLIconTextFitWidth, "width" },
+ { MGLIconTextFitHeight, "height" },
+ { MGLIconTextFitBoth, "both" },
+ });
+
+ MBGL_DEFINE_ENUM(MGLTextPitchAlignment, {
+ { MGLTextPitchAlignmentMap, "map" },
+ { MGLTextPitchAlignmentViewport, "viewport" },
+ { MGLTextPitchAlignmentAuto, "auto" },
+ });
+
+ MBGL_DEFINE_ENUM(MGLTextRotationAlignment, {
+ { MGLTextRotationAlignmentMap, "map" },
+ { MGLTextRotationAlignmentViewport, "viewport" },
+ { MGLTextRotationAlignmentAuto, "auto" },
+ });
+
+ MBGL_DEFINE_ENUM(MGLTextJustify, {
+ { MGLTextJustifyLeft, "left" },
+ { MGLTextJustifyCenter, "center" },
+ { MGLTextJustifyRight, "right" },
+ });
+
+ MBGL_DEFINE_ENUM(MGLTextAnchor, {
+ { MGLTextAnchorCenter, "center" },
+ { MGLTextAnchorLeft, "left" },
+ { MGLTextAnchorRight, "right" },
+ { MGLTextAnchorTop, "top" },
+ { MGLTextAnchorBottom, "bottom" },
+ { MGLTextAnchorTopLeft, "top-left" },
+ { MGLTextAnchorTopRight, "top-right" },
+ { MGLTextAnchorBottomLeft, "bottom-left" },
+ { MGLTextAnchorBottomRight, "bottom-right" },
+ });
+
+ MBGL_DEFINE_ENUM(MGLTextTransform, {
+ { MGLTextTransformNone, "none" },
+ { MGLTextTransformUppercase, "uppercase" },
+ { MGLTextTransformLowercase, "lowercase" },
+ });
+
+ MBGL_DEFINE_ENUM(MGLIconTranslateAnchor, {
+ { MGLIconTranslateAnchorMap, "map" },
+ { MGLIconTranslateAnchorViewport, "viewport" },
+ });
+
+ MBGL_DEFINE_ENUM(MGLTextTranslateAnchor, {
+ { MGLTextTranslateAnchorMap, "map" },
+ { MGLTextTranslateAnchorViewport, "viewport" },
+ });
+
+}
+
@interface MGLSymbolStyleLayer ()
@property (nonatomic) mbgl::style::SymbolLayer *rawLayer;
@@ -26,34 +94,30 @@
if (self = [super initWithIdentifier:identifier source:source]) {
auto layer = std::make_unique<mbgl::style::SymbolLayer>(identifier.UTF8String, source.identifier.UTF8String);
_pendingLayer = std::move(layer);
- self.rawLayer = _pendingLayer.get();
+ _rawLayer = _pendingLayer.get();
}
return self;
}
-
-
- (NSString *)sourceLayerIdentifier
{
- auto layerID = self.rawLayer->getSourceLayer();
+ auto layerID = _rawLayer->getSourceLayer();
return layerID.empty() ? nil : @(layerID.c_str());
}
- (void)setSourceLayerIdentifier:(NSString *)sourceLayerIdentifier
{
- self.rawLayer->setSourceLayer(sourceLayerIdentifier.UTF8String ?: "");
+ _rawLayer->setSourceLayer(sourceLayerIdentifier.UTF8String ?: "");
}
- (void)setPredicate:(NSPredicate *)predicate
{
- self.rawLayer->setFilter(predicate.mgl_filter);
+ _rawLayer->setFilter(predicate.mgl_filter);
}
- (NSPredicate *)predicate
{
- return [NSPredicate mgl_predicateWithFilter:self.rawLayer->getFilter()];
+ return [NSPredicate mgl_predicateWithFilter:_rawLayer->getFilter()];
}
-
-
#pragma mark - Adding to and removing from a map view
- (void)addToMapView:(MGLMapView *)mapView
@@ -75,348 +139,372 @@
{
auto removedLayer = mapView.mbglMap->removeLayer(self.identifier.UTF8String);
_pendingLayer = std::move(reinterpret_cast<std::unique_ptr<mbgl::style::SymbolLayer> &>(removedLayer));
- self.rawLayer = _pendingLayer.get();
+ _rawLayer = _pendingLayer.get();
}
#pragma mark - Accessing the Layout Attributes
- (void)setSymbolPlacement:(MGLStyleValue<NSValue *> *)symbolPlacement {
- auto mbglValue = MGLStyleValueTransformer<mbgl::style::SymbolPlacementType, NSValue *>().toPropertyValue(symbolPlacement);
- self.rawLayer->setSymbolPlacement(mbglValue);
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::SymbolPlacementType,
+ NSValue *,
+ mbgl::style::SymbolPlacementType,
+ MGLSymbolPlacement>().toEnumPropertyValue(symbolPlacement);
+ _rawLayer->setSymbolPlacement(mbglValue);
}
- (MGLStyleValue<NSValue *> *)symbolPlacement {
- auto propertyValue = self.rawLayer->getSymbolPlacement() ?: self.rawLayer->getDefaultSymbolPlacement();
- return MGLStyleValueTransformer<mbgl::style::SymbolPlacementType, NSValue *>().toStyleValue(propertyValue);
+ auto propertyValue = _rawLayer->getSymbolPlacement() ?: _rawLayer->getDefaultSymbolPlacement();
+ return MGLStyleValueTransformer<mbgl::style::SymbolPlacementType, NSValue *, mbgl::style::SymbolPlacementType, MGLSymbolPlacement>().toEnumStyleValue(propertyValue);
}
- (void)setSymbolSpacing:(MGLStyleValue<NSNumber *> *)symbolSpacing {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(symbolSpacing);
- self.rawLayer->setSymbolSpacing(mbglValue);
+ _rawLayer->setSymbolSpacing(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)symbolSpacing {
- auto propertyValue = self.rawLayer->getSymbolSpacing() ?: self.rawLayer->getDefaultSymbolSpacing();
+ auto propertyValue = _rawLayer->getSymbolSpacing() ?: _rawLayer->getDefaultSymbolSpacing();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setSymbolAvoidEdges:(MGLStyleValue<NSNumber *> *)symbolAvoidEdges {
auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue(symbolAvoidEdges);
- self.rawLayer->setSymbolAvoidEdges(mbglValue);
+ _rawLayer->setSymbolAvoidEdges(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)symbolAvoidEdges {
- auto propertyValue = self.rawLayer->getSymbolAvoidEdges() ?: self.rawLayer->getDefaultSymbolAvoidEdges();
+ auto propertyValue = _rawLayer->getSymbolAvoidEdges() ?: _rawLayer->getDefaultSymbolAvoidEdges();
return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setIconAllowOverlap:(MGLStyleValue<NSNumber *> *)iconAllowOverlap {
auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue(iconAllowOverlap);
- self.rawLayer->setIconAllowOverlap(mbglValue);
+ _rawLayer->setIconAllowOverlap(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)iconAllowOverlap {
- auto propertyValue = self.rawLayer->getIconAllowOverlap() ?: self.rawLayer->getDefaultIconAllowOverlap();
+ auto propertyValue = _rawLayer->getIconAllowOverlap() ?: _rawLayer->getDefaultIconAllowOverlap();
return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setIconIgnorePlacement:(MGLStyleValue<NSNumber *> *)iconIgnorePlacement {
auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue(iconIgnorePlacement);
- self.rawLayer->setIconIgnorePlacement(mbglValue);
+ _rawLayer->setIconIgnorePlacement(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)iconIgnorePlacement {
- auto propertyValue = self.rawLayer->getIconIgnorePlacement() ?: self.rawLayer->getDefaultIconIgnorePlacement();
+ auto propertyValue = _rawLayer->getIconIgnorePlacement() ?: _rawLayer->getDefaultIconIgnorePlacement();
return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setIconOptional:(MGLStyleValue<NSNumber *> *)iconOptional {
auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue(iconOptional);
- self.rawLayer->setIconOptional(mbglValue);
+ _rawLayer->setIconOptional(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)iconOptional {
- auto propertyValue = self.rawLayer->getIconOptional() ?: self.rawLayer->getDefaultIconOptional();
+ auto propertyValue = _rawLayer->getIconOptional() ?: _rawLayer->getDefaultIconOptional();
return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setIconRotationAlignment:(MGLStyleValue<NSValue *> *)iconRotationAlignment {
- auto mbglValue = MGLStyleValueTransformer<mbgl::style::AlignmentType, NSValue *>().toPropertyValue(iconRotationAlignment);
- self.rawLayer->setIconRotationAlignment(mbglValue);
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::AlignmentType,
+ NSValue *,
+ mbgl::style::AlignmentType,
+ MGLIconRotationAlignment>().toEnumPropertyValue(iconRotationAlignment);
+ _rawLayer->setIconRotationAlignment(mbglValue);
}
- (MGLStyleValue<NSValue *> *)iconRotationAlignment {
- auto propertyValue = self.rawLayer->getIconRotationAlignment() ?: self.rawLayer->getDefaultIconRotationAlignment();
- return MGLStyleValueTransformer<mbgl::style::AlignmentType, NSValue *>().toStyleValue(propertyValue);
+ auto propertyValue = _rawLayer->getIconRotationAlignment() ?: _rawLayer->getDefaultIconRotationAlignment();
+ return MGLStyleValueTransformer<mbgl::style::AlignmentType, NSValue *, mbgl::style::AlignmentType, MGLIconRotationAlignment>().toEnumStyleValue(propertyValue);
}
- (void)setIconSize:(MGLStyleValue<NSNumber *> *)iconSize {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(iconSize);
- self.rawLayer->setIconSize(mbglValue);
+ _rawLayer->setIconSize(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)iconSize {
- auto propertyValue = self.rawLayer->getIconSize() ?: self.rawLayer->getDefaultIconSize();
+ auto propertyValue = _rawLayer->getIconSize() ?: _rawLayer->getDefaultIconSize();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setIconTextFit:(MGLStyleValue<NSValue *> *)iconTextFit {
- auto mbglValue = MGLStyleValueTransformer<mbgl::style::IconTextFitType, NSValue *>().toPropertyValue(iconTextFit);
- self.rawLayer->setIconTextFit(mbglValue);
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::IconTextFitType,
+ NSValue *,
+ mbgl::style::IconTextFitType,
+ MGLIconTextFit>().toEnumPropertyValue(iconTextFit);
+ _rawLayer->setIconTextFit(mbglValue);
}
- (MGLStyleValue<NSValue *> *)iconTextFit {
- auto propertyValue = self.rawLayer->getIconTextFit() ?: self.rawLayer->getDefaultIconTextFit();
- return MGLStyleValueTransformer<mbgl::style::IconTextFitType, NSValue *>().toStyleValue(propertyValue);
+ auto propertyValue = _rawLayer->getIconTextFit() ?: _rawLayer->getDefaultIconTextFit();
+ return MGLStyleValueTransformer<mbgl::style::IconTextFitType, NSValue *, mbgl::style::IconTextFitType, MGLIconTextFit>().toEnumStyleValue(propertyValue);
}
- (void)setIconTextFitPadding:(MGLStyleValue<NSValue *> *)iconTextFitPadding {
auto mbglValue = MGLStyleValueTransformer<std::array<float, 4>, NSValue *>().toPropertyValue(iconTextFitPadding);
- self.rawLayer->setIconTextFitPadding(mbglValue);
+ _rawLayer->setIconTextFitPadding(mbglValue);
}
- (MGLStyleValue<NSValue *> *)iconTextFitPadding {
- auto propertyValue = self.rawLayer->getIconTextFitPadding() ?: self.rawLayer->getDefaultIconTextFitPadding();
+ auto propertyValue = _rawLayer->getIconTextFitPadding() ?: _rawLayer->getDefaultIconTextFitPadding();
return MGLStyleValueTransformer<std::array<float, 4>, NSValue *>().toStyleValue(propertyValue);
}
- (void)setIconImage:(MGLStyleValue<NSString *> *)iconImage {
auto mbglValue = MGLStyleValueTransformer<std::string, NSString *>().toPropertyValue(iconImage);
- self.rawLayer->setIconImage(mbglValue);
+ _rawLayer->setIconImage(mbglValue);
}
- (MGLStyleValue<NSString *> *)iconImage {
- auto propertyValue = self.rawLayer->getIconImage() ?: self.rawLayer->getDefaultIconImage();
+ auto propertyValue = _rawLayer->getIconImage() ?: _rawLayer->getDefaultIconImage();
return MGLStyleValueTransformer<std::string, NSString *>().toStyleValue(propertyValue);
}
- (void)setIconRotate:(MGLStyleValue<NSNumber *> *)iconRotate {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(iconRotate);
- self.rawLayer->setIconRotate(mbglValue);
+ _rawLayer->setIconRotate(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)iconRotate {
- auto propertyValue = self.rawLayer->getIconRotate() ?: self.rawLayer->getDefaultIconRotate();
+ auto propertyValue = _rawLayer->getIconRotate() ?: _rawLayer->getDefaultIconRotate();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setIconPadding:(MGLStyleValue<NSNumber *> *)iconPadding {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(iconPadding);
- self.rawLayer->setIconPadding(mbglValue);
+ _rawLayer->setIconPadding(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)iconPadding {
- auto propertyValue = self.rawLayer->getIconPadding() ?: self.rawLayer->getDefaultIconPadding();
+ auto propertyValue = _rawLayer->getIconPadding() ?: _rawLayer->getDefaultIconPadding();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setIconKeepUpright:(MGLStyleValue<NSNumber *> *)iconKeepUpright {
auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue(iconKeepUpright);
- self.rawLayer->setIconKeepUpright(mbglValue);
+ _rawLayer->setIconKeepUpright(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)iconKeepUpright {
- auto propertyValue = self.rawLayer->getIconKeepUpright() ?: self.rawLayer->getDefaultIconKeepUpright();
+ auto propertyValue = _rawLayer->getIconKeepUpright() ?: _rawLayer->getDefaultIconKeepUpright();
return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setIconOffset:(MGLStyleValue<NSValue *> *)iconOffset {
auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue(iconOffset);
- self.rawLayer->setIconOffset(mbglValue);
+ _rawLayer->setIconOffset(mbglValue);
}
- (MGLStyleValue<NSValue *> *)iconOffset {
- auto propertyValue = self.rawLayer->getIconOffset() ?: self.rawLayer->getDefaultIconOffset();
+ auto propertyValue = _rawLayer->getIconOffset() ?: _rawLayer->getDefaultIconOffset();
return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
- (void)setTextPitchAlignment:(MGLStyleValue<NSValue *> *)textPitchAlignment {
- auto mbglValue = MGLStyleValueTransformer<mbgl::style::AlignmentType, NSValue *>().toPropertyValue(textPitchAlignment);
- self.rawLayer->setTextPitchAlignment(mbglValue);
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::AlignmentType,
+ NSValue *,
+ mbgl::style::AlignmentType,
+ MGLTextPitchAlignment>().toEnumPropertyValue(textPitchAlignment);
+ _rawLayer->setTextPitchAlignment(mbglValue);
}
- (MGLStyleValue<NSValue *> *)textPitchAlignment {
- auto propertyValue = self.rawLayer->getTextPitchAlignment() ?: self.rawLayer->getDefaultTextPitchAlignment();
- return MGLStyleValueTransformer<mbgl::style::AlignmentType, NSValue *>().toStyleValue(propertyValue);
+ auto propertyValue = _rawLayer->getTextPitchAlignment() ?: _rawLayer->getDefaultTextPitchAlignment();
+ return MGLStyleValueTransformer<mbgl::style::AlignmentType, NSValue *, mbgl::style::AlignmentType, MGLTextPitchAlignment>().toEnumStyleValue(propertyValue);
}
- (void)setTextRotationAlignment:(MGLStyleValue<NSValue *> *)textRotationAlignment {
- auto mbglValue = MGLStyleValueTransformer<mbgl::style::AlignmentType, NSValue *>().toPropertyValue(textRotationAlignment);
- self.rawLayer->setTextRotationAlignment(mbglValue);
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::AlignmentType,
+ NSValue *,
+ mbgl::style::AlignmentType,
+ MGLTextRotationAlignment>().toEnumPropertyValue(textRotationAlignment);
+ _rawLayer->setTextRotationAlignment(mbglValue);
}
- (MGLStyleValue<NSValue *> *)textRotationAlignment {
- auto propertyValue = self.rawLayer->getTextRotationAlignment() ?: self.rawLayer->getDefaultTextRotationAlignment();
- return MGLStyleValueTransformer<mbgl::style::AlignmentType, NSValue *>().toStyleValue(propertyValue);
+ auto propertyValue = _rawLayer->getTextRotationAlignment() ?: _rawLayer->getDefaultTextRotationAlignment();
+ return MGLStyleValueTransformer<mbgl::style::AlignmentType, NSValue *, mbgl::style::AlignmentType, MGLTextRotationAlignment>().toEnumStyleValue(propertyValue);
}
- (void)setTextField:(MGLStyleValue<NSString *> *)textField {
auto mbglValue = MGLStyleValueTransformer<std::string, NSString *>().toPropertyValue(textField);
- self.rawLayer->setTextField(mbglValue);
+ _rawLayer->setTextField(mbglValue);
}
- (MGLStyleValue<NSString *> *)textField {
- auto propertyValue = self.rawLayer->getTextField() ?: self.rawLayer->getDefaultTextField();
+ auto propertyValue = _rawLayer->getTextField() ?: _rawLayer->getDefaultTextField();
return MGLStyleValueTransformer<std::string, NSString *>().toStyleValue(propertyValue);
}
- (void)setTextFont:(MGLStyleValue<NSArray<NSString *> *> *)textFont {
auto mbglValue = MGLStyleValueTransformer<std::vector<std::string>, NSArray<NSString *> *, std::string>().toPropertyValue(textFont);
- self.rawLayer->setTextFont(mbglValue);
+ _rawLayer->setTextFont(mbglValue);
}
- (MGLStyleValue<NSArray<NSString *> *> *)textFont {
- auto propertyValue = self.rawLayer->getTextFont() ?: self.rawLayer->getDefaultTextFont();
+ auto propertyValue = _rawLayer->getTextFont() ?: _rawLayer->getDefaultTextFont();
return MGLStyleValueTransformer<std::vector<std::string>, NSArray<NSString *> *, std::string>().toStyleValue(propertyValue);
}
- (void)setTextSize:(MGLStyleValue<NSNumber *> *)textSize {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(textSize);
- self.rawLayer->setTextSize(mbglValue);
+ _rawLayer->setTextSize(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)textSize {
- auto propertyValue = self.rawLayer->getTextSize() ?: self.rawLayer->getDefaultTextSize();
+ auto propertyValue = _rawLayer->getTextSize() ?: _rawLayer->getDefaultTextSize();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setTextMaxWidth:(MGLStyleValue<NSNumber *> *)textMaxWidth {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(textMaxWidth);
- self.rawLayer->setTextMaxWidth(mbglValue);
+ _rawLayer->setTextMaxWidth(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)textMaxWidth {
- auto propertyValue = self.rawLayer->getTextMaxWidth() ?: self.rawLayer->getDefaultTextMaxWidth();
+ auto propertyValue = _rawLayer->getTextMaxWidth() ?: _rawLayer->getDefaultTextMaxWidth();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setTextLineHeight:(MGLStyleValue<NSNumber *> *)textLineHeight {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(textLineHeight);
- self.rawLayer->setTextLineHeight(mbglValue);
+ _rawLayer->setTextLineHeight(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)textLineHeight {
- auto propertyValue = self.rawLayer->getTextLineHeight() ?: self.rawLayer->getDefaultTextLineHeight();
+ auto propertyValue = _rawLayer->getTextLineHeight() ?: _rawLayer->getDefaultTextLineHeight();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setTextLetterSpacing:(MGLStyleValue<NSNumber *> *)textLetterSpacing {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(textLetterSpacing);
- self.rawLayer->setTextLetterSpacing(mbglValue);
+ _rawLayer->setTextLetterSpacing(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)textLetterSpacing {
- auto propertyValue = self.rawLayer->getTextLetterSpacing() ?: self.rawLayer->getDefaultTextLetterSpacing();
+ auto propertyValue = _rawLayer->getTextLetterSpacing() ?: _rawLayer->getDefaultTextLetterSpacing();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setTextJustify:(MGLStyleValue<NSValue *> *)textJustify {
- auto mbglValue = MGLStyleValueTransformer<mbgl::style::TextJustifyType, NSValue *>().toPropertyValue(textJustify);
- self.rawLayer->setTextJustify(mbglValue);
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::TextJustifyType,
+ NSValue *,
+ mbgl::style::TextJustifyType,
+ MGLTextJustify>().toEnumPropertyValue(textJustify);
+ _rawLayer->setTextJustify(mbglValue);
}
- (MGLStyleValue<NSValue *> *)textJustify {
- auto propertyValue = self.rawLayer->getTextJustify() ?: self.rawLayer->getDefaultTextJustify();
- return MGLStyleValueTransformer<mbgl::style::TextJustifyType, NSValue *>().toStyleValue(propertyValue);
+ auto propertyValue = _rawLayer->getTextJustify() ?: _rawLayer->getDefaultTextJustify();
+ return MGLStyleValueTransformer<mbgl::style::TextJustifyType, NSValue *, mbgl::style::TextJustifyType, MGLTextJustify>().toEnumStyleValue(propertyValue);
}
- (void)setTextAnchor:(MGLStyleValue<NSValue *> *)textAnchor {
- auto mbglValue = MGLStyleValueTransformer<mbgl::style::TextAnchorType, NSValue *>().toPropertyValue(textAnchor);
- self.rawLayer->setTextAnchor(mbglValue);
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::TextAnchorType,
+ NSValue *,
+ mbgl::style::TextAnchorType,
+ MGLTextAnchor>().toEnumPropertyValue(textAnchor);
+ _rawLayer->setTextAnchor(mbglValue);
}
- (MGLStyleValue<NSValue *> *)textAnchor {
- auto propertyValue = self.rawLayer->getTextAnchor() ?: self.rawLayer->getDefaultTextAnchor();
- return MGLStyleValueTransformer<mbgl::style::TextAnchorType, NSValue *>().toStyleValue(propertyValue);
+ auto propertyValue = _rawLayer->getTextAnchor() ?: _rawLayer->getDefaultTextAnchor();
+ return MGLStyleValueTransformer<mbgl::style::TextAnchorType, NSValue *, mbgl::style::TextAnchorType, MGLTextAnchor>().toEnumStyleValue(propertyValue);
}
- (void)setTextMaxAngle:(MGLStyleValue<NSNumber *> *)textMaxAngle {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(textMaxAngle);
- self.rawLayer->setTextMaxAngle(mbglValue);
+ _rawLayer->setTextMaxAngle(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)textMaxAngle {
- auto propertyValue = self.rawLayer->getTextMaxAngle() ?: self.rawLayer->getDefaultTextMaxAngle();
+ auto propertyValue = _rawLayer->getTextMaxAngle() ?: _rawLayer->getDefaultTextMaxAngle();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setTextRotate:(MGLStyleValue<NSNumber *> *)textRotate {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(textRotate);
- self.rawLayer->setTextRotate(mbglValue);
+ _rawLayer->setTextRotate(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)textRotate {
- auto propertyValue = self.rawLayer->getTextRotate() ?: self.rawLayer->getDefaultTextRotate();
+ auto propertyValue = _rawLayer->getTextRotate() ?: _rawLayer->getDefaultTextRotate();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setTextPadding:(MGLStyleValue<NSNumber *> *)textPadding {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(textPadding);
- self.rawLayer->setTextPadding(mbglValue);
+ _rawLayer->setTextPadding(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)textPadding {
- auto propertyValue = self.rawLayer->getTextPadding() ?: self.rawLayer->getDefaultTextPadding();
+ auto propertyValue = _rawLayer->getTextPadding() ?: _rawLayer->getDefaultTextPadding();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setTextKeepUpright:(MGLStyleValue<NSNumber *> *)textKeepUpright {
auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue(textKeepUpright);
- self.rawLayer->setTextKeepUpright(mbglValue);
+ _rawLayer->setTextKeepUpright(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)textKeepUpright {
- auto propertyValue = self.rawLayer->getTextKeepUpright() ?: self.rawLayer->getDefaultTextKeepUpright();
+ auto propertyValue = _rawLayer->getTextKeepUpright() ?: _rawLayer->getDefaultTextKeepUpright();
return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setTextTransform:(MGLStyleValue<NSValue *> *)textTransform {
- auto mbglValue = MGLStyleValueTransformer<mbgl::style::TextTransformType, NSValue *>().toPropertyValue(textTransform);
- self.rawLayer->setTextTransform(mbglValue);
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::TextTransformType,
+ NSValue *,
+ mbgl::style::TextTransformType,
+ MGLTextTransform>().toEnumPropertyValue(textTransform);
+ _rawLayer->setTextTransform(mbglValue);
}
- (MGLStyleValue<NSValue *> *)textTransform {
- auto propertyValue = self.rawLayer->getTextTransform() ?: self.rawLayer->getDefaultTextTransform();
- return MGLStyleValueTransformer<mbgl::style::TextTransformType, NSValue *>().toStyleValue(propertyValue);
+ auto propertyValue = _rawLayer->getTextTransform() ?: _rawLayer->getDefaultTextTransform();
+ return MGLStyleValueTransformer<mbgl::style::TextTransformType, NSValue *, mbgl::style::TextTransformType, MGLTextTransform>().toEnumStyleValue(propertyValue);
}
- (void)setTextOffset:(MGLStyleValue<NSValue *> *)textOffset {
auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue(textOffset);
- self.rawLayer->setTextOffset(mbglValue);
+ _rawLayer->setTextOffset(mbglValue);
}
- (MGLStyleValue<NSValue *> *)textOffset {
- auto propertyValue = self.rawLayer->getTextOffset() ?: self.rawLayer->getDefaultTextOffset();
+ auto propertyValue = _rawLayer->getTextOffset() ?: _rawLayer->getDefaultTextOffset();
return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
- (void)setTextAllowOverlap:(MGLStyleValue<NSNumber *> *)textAllowOverlap {
auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue(textAllowOverlap);
- self.rawLayer->setTextAllowOverlap(mbglValue);
+ _rawLayer->setTextAllowOverlap(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)textAllowOverlap {
- auto propertyValue = self.rawLayer->getTextAllowOverlap() ?: self.rawLayer->getDefaultTextAllowOverlap();
+ auto propertyValue = _rawLayer->getTextAllowOverlap() ?: _rawLayer->getDefaultTextAllowOverlap();
return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setTextIgnorePlacement:(MGLStyleValue<NSNumber *> *)textIgnorePlacement {
auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue(textIgnorePlacement);
- self.rawLayer->setTextIgnorePlacement(mbglValue);
+ _rawLayer->setTextIgnorePlacement(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)textIgnorePlacement {
- auto propertyValue = self.rawLayer->getTextIgnorePlacement() ?: self.rawLayer->getDefaultTextIgnorePlacement();
+ auto propertyValue = _rawLayer->getTextIgnorePlacement() ?: _rawLayer->getDefaultTextIgnorePlacement();
return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setTextOptional:(MGLStyleValue<NSNumber *> *)textOptional {
auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue(textOptional);
- self.rawLayer->setTextOptional(mbglValue);
+ _rawLayer->setTextOptional(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)textOptional {
- auto propertyValue = self.rawLayer->getTextOptional() ?: self.rawLayer->getDefaultTextOptional();
+ auto propertyValue = _rawLayer->getTextOptional() ?: _rawLayer->getDefaultTextOptional();
return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue);
}
@@ -424,142 +512,148 @@
- (void)setIconOpacity:(MGLStyleValue<NSNumber *> *)iconOpacity {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(iconOpacity);
- self.rawLayer->setIconOpacity(mbglValue);
+ _rawLayer->setIconOpacity(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)iconOpacity {
- auto propertyValue = self.rawLayer->getIconOpacity() ?: self.rawLayer->getDefaultIconOpacity();
+ auto propertyValue = _rawLayer->getIconOpacity() ?: _rawLayer->getDefaultIconOpacity();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setIconColor:(MGLStyleValue<MGLColor *> *)iconColor {
auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue(iconColor);
- self.rawLayer->setIconColor(mbglValue);
+ _rawLayer->setIconColor(mbglValue);
}
- (MGLStyleValue<MGLColor *> *)iconColor {
- auto propertyValue = self.rawLayer->getIconColor() ?: self.rawLayer->getDefaultIconColor();
+ auto propertyValue = _rawLayer->getIconColor() ?: _rawLayer->getDefaultIconColor();
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toStyleValue(propertyValue);
}
- (void)setIconHaloColor:(MGLStyleValue<MGLColor *> *)iconHaloColor {
auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue(iconHaloColor);
- self.rawLayer->setIconHaloColor(mbglValue);
+ _rawLayer->setIconHaloColor(mbglValue);
}
- (MGLStyleValue<MGLColor *> *)iconHaloColor {
- auto propertyValue = self.rawLayer->getIconHaloColor() ?: self.rawLayer->getDefaultIconHaloColor();
+ auto propertyValue = _rawLayer->getIconHaloColor() ?: _rawLayer->getDefaultIconHaloColor();
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toStyleValue(propertyValue);
}
- (void)setIconHaloWidth:(MGLStyleValue<NSNumber *> *)iconHaloWidth {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(iconHaloWidth);
- self.rawLayer->setIconHaloWidth(mbglValue);
+ _rawLayer->setIconHaloWidth(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)iconHaloWidth {
- auto propertyValue = self.rawLayer->getIconHaloWidth() ?: self.rawLayer->getDefaultIconHaloWidth();
+ auto propertyValue = _rawLayer->getIconHaloWidth() ?: _rawLayer->getDefaultIconHaloWidth();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setIconHaloBlur:(MGLStyleValue<NSNumber *> *)iconHaloBlur {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(iconHaloBlur);
- self.rawLayer->setIconHaloBlur(mbglValue);
+ _rawLayer->setIconHaloBlur(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)iconHaloBlur {
- auto propertyValue = self.rawLayer->getIconHaloBlur() ?: self.rawLayer->getDefaultIconHaloBlur();
+ auto propertyValue = _rawLayer->getIconHaloBlur() ?: _rawLayer->getDefaultIconHaloBlur();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setIconTranslate:(MGLStyleValue<NSValue *> *)iconTranslate {
auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue(iconTranslate);
- self.rawLayer->setIconTranslate(mbglValue);
+ _rawLayer->setIconTranslate(mbglValue);
}
- (MGLStyleValue<NSValue *> *)iconTranslate {
- auto propertyValue = self.rawLayer->getIconTranslate() ?: self.rawLayer->getDefaultIconTranslate();
+ auto propertyValue = _rawLayer->getIconTranslate() ?: _rawLayer->getDefaultIconTranslate();
return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
- (void)setIconTranslateAnchor:(MGLStyleValue<NSValue *> *)iconTranslateAnchor {
- auto mbglValue = MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *>().toPropertyValue(iconTranslateAnchor);
- self.rawLayer->setIconTranslateAnchor(mbglValue);
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::TranslateAnchorType,
+ NSValue *,
+ mbgl::style::TranslateAnchorType,
+ MGLIconTranslateAnchor>().toEnumPropertyValue(iconTranslateAnchor);
+ _rawLayer->setIconTranslateAnchor(mbglValue);
}
- (MGLStyleValue<NSValue *> *)iconTranslateAnchor {
- auto propertyValue = self.rawLayer->getIconTranslateAnchor() ?: self.rawLayer->getDefaultIconTranslateAnchor();
- return MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *>().toStyleValue(propertyValue);
+ auto propertyValue = _rawLayer->getIconTranslateAnchor() ?: _rawLayer->getDefaultIconTranslateAnchor();
+ return MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *, mbgl::style::TranslateAnchorType, MGLIconTranslateAnchor>().toEnumStyleValue(propertyValue);
}
- (void)setTextOpacity:(MGLStyleValue<NSNumber *> *)textOpacity {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(textOpacity);
- self.rawLayer->setTextOpacity(mbglValue);
+ _rawLayer->setTextOpacity(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)textOpacity {
- auto propertyValue = self.rawLayer->getTextOpacity() ?: self.rawLayer->getDefaultTextOpacity();
+ auto propertyValue = _rawLayer->getTextOpacity() ?: _rawLayer->getDefaultTextOpacity();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setTextColor:(MGLStyleValue<MGLColor *> *)textColor {
auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue(textColor);
- self.rawLayer->setTextColor(mbglValue);
+ _rawLayer->setTextColor(mbglValue);
}
- (MGLStyleValue<MGLColor *> *)textColor {
- auto propertyValue = self.rawLayer->getTextColor() ?: self.rawLayer->getDefaultTextColor();
+ auto propertyValue = _rawLayer->getTextColor() ?: _rawLayer->getDefaultTextColor();
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toStyleValue(propertyValue);
}
- (void)setTextHaloColor:(MGLStyleValue<MGLColor *> *)textHaloColor {
auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue(textHaloColor);
- self.rawLayer->setTextHaloColor(mbglValue);
+ _rawLayer->setTextHaloColor(mbglValue);
}
- (MGLStyleValue<MGLColor *> *)textHaloColor {
- auto propertyValue = self.rawLayer->getTextHaloColor() ?: self.rawLayer->getDefaultTextHaloColor();
+ auto propertyValue = _rawLayer->getTextHaloColor() ?: _rawLayer->getDefaultTextHaloColor();
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toStyleValue(propertyValue);
}
- (void)setTextHaloWidth:(MGLStyleValue<NSNumber *> *)textHaloWidth {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(textHaloWidth);
- self.rawLayer->setTextHaloWidth(mbglValue);
+ _rawLayer->setTextHaloWidth(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)textHaloWidth {
- auto propertyValue = self.rawLayer->getTextHaloWidth() ?: self.rawLayer->getDefaultTextHaloWidth();
+ auto propertyValue = _rawLayer->getTextHaloWidth() ?: _rawLayer->getDefaultTextHaloWidth();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setTextHaloBlur:(MGLStyleValue<NSNumber *> *)textHaloBlur {
auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(textHaloBlur);
- self.rawLayer->setTextHaloBlur(mbglValue);
+ _rawLayer->setTextHaloBlur(mbglValue);
}
- (MGLStyleValue<NSNumber *> *)textHaloBlur {
- auto propertyValue = self.rawLayer->getTextHaloBlur() ?: self.rawLayer->getDefaultTextHaloBlur();
+ auto propertyValue = _rawLayer->getTextHaloBlur() ?: _rawLayer->getDefaultTextHaloBlur();
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
- (void)setTextTranslate:(MGLStyleValue<NSValue *> *)textTranslate {
auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue(textTranslate);
- self.rawLayer->setTextTranslate(mbglValue);
+ _rawLayer->setTextTranslate(mbglValue);
}
- (MGLStyleValue<NSValue *> *)textTranslate {
- auto propertyValue = self.rawLayer->getTextTranslate() ?: self.rawLayer->getDefaultTextTranslate();
+ auto propertyValue = _rawLayer->getTextTranslate() ?: _rawLayer->getDefaultTextTranslate();
return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
- (void)setTextTranslateAnchor:(MGLStyleValue<NSValue *> *)textTranslateAnchor {
- auto mbglValue = MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *>().toPropertyValue(textTranslateAnchor);
- self.rawLayer->setTextTranslateAnchor(mbglValue);
+ auto mbglValue = MGLStyleValueTransformer<mbgl::style::TranslateAnchorType,
+ NSValue *,
+ mbgl::style::TranslateAnchorType,
+ MGLTextTranslateAnchor>().toEnumPropertyValue(textTranslateAnchor);
+ _rawLayer->setTextTranslateAnchor(mbglValue);
}
- (MGLStyleValue<NSValue *> *)textTranslateAnchor {
- auto propertyValue = self.rawLayer->getTextTranslateAnchor() ?: self.rawLayer->getDefaultTextTranslateAnchor();
- return MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *>().toStyleValue(propertyValue);
+ auto propertyValue = _rawLayer->getTextTranslateAnchor() ?: _rawLayer->getDefaultTextTranslateAnchor();
+ return MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *, mbgl::style::TranslateAnchorType, MGLTextTranslateAnchor>().toEnumStyleValue(propertyValue);
}
diff --git a/platform/darwin/src/NSValue+MGLStyleEnumAttributeAdditions.h b/platform/darwin/src/NSValue+MGLStyleEnumAttributeAdditions.h
new file mode 100644
index 0000000000..63ff869410
--- /dev/null
+++ b/platform/darwin/src/NSValue+MGLStyleEnumAttributeAdditions.h
@@ -0,0 +1,232 @@
+// This file is generated.
+// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+
+#import <Foundation/Foundation.h>
+
+#import "MGLFillStyleLayer.h"
+#import "MGLLineStyleLayer.h"
+#import "MGLSymbolStyleLayer.h"
+#import "MGLCircleStyleLayer.h"
+#import "MGLRasterStyleLayer.h"
+#import "MGLBackgroundStyleLayer.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+/**
+ Methods for round-tripping values for Mapbox style layer enumeration values.
+*/
+@interface NSValue (MGLStyleEnumAttributeAdditions)
+
+#pragma mark Working with Style Layer Enumeration Attribute Values
+
+/**
+ Creates a new value object containing the given `MGLLineCap` enumeration.
+
+ @param type The value for the new object.
+ @return A new value object that contains the style enumeration type.
+*/
++ (instancetype)valueWithMGLLineCap:(MGLLineCap)lineCap;
+
+/**
+ The `MGLLineCap` enumeration representation of the value.
+*/
+@property (readonly) MGLLineCap lineCap;
+
+/**
+ Creates a new value object containing the given `MGLLineJoin` enumeration.
+
+ @param type The value for the new object.
+ @return A new value object that contains the style enumeration type.
+*/
++ (instancetype)valueWithMGLLineJoin:(MGLLineJoin)lineJoin;
+
+/**
+ The `MGLLineJoin` enumeration representation of the value.
+*/
+@property (readonly) MGLLineJoin lineJoin;
+
+/**
+ Creates a new value object containing the given `MGLSymbolPlacement` enumeration.
+
+ @param type The value for the new object.
+ @return A new value object that contains the style enumeration type.
+*/
++ (instancetype)valueWithMGLSymbolPlacement:(MGLSymbolPlacement)symbolPlacement;
+
+/**
+ The `MGLSymbolPlacement` enumeration representation of the value.
+*/
+@property (readonly) MGLSymbolPlacement symbolPlacement;
+
+/**
+ Creates a new value object containing the given `MGLIconRotationAlignment` enumeration.
+
+ @param type The value for the new object.
+ @return A new value object that contains the style enumeration type.
+*/
++ (instancetype)valueWithMGLIconRotationAlignment:(MGLIconRotationAlignment)iconRotationAlignment;
+
+/**
+ The `MGLIconRotationAlignment` enumeration representation of the value.
+*/
+@property (readonly) MGLIconRotationAlignment iconRotationAlignment;
+
+/**
+ Creates a new value object containing the given `MGLIconTextFit` enumeration.
+
+ @param type The value for the new object.
+ @return A new value object that contains the style enumeration type.
+*/
++ (instancetype)valueWithMGLIconTextFit:(MGLIconTextFit)iconTextFit;
+
+/**
+ The `MGLIconTextFit` enumeration representation of the value.
+*/
+@property (readonly) MGLIconTextFit iconTextFit;
+
+/**
+ Creates a new value object containing the given `MGLTextPitchAlignment` enumeration.
+
+ @param type The value for the new object.
+ @return A new value object that contains the style enumeration type.
+*/
++ (instancetype)valueWithMGLTextPitchAlignment:(MGLTextPitchAlignment)textPitchAlignment;
+
+/**
+ The `MGLTextPitchAlignment` enumeration representation of the value.
+*/
+@property (readonly) MGLTextPitchAlignment textPitchAlignment;
+
+/**
+ Creates a new value object containing the given `MGLTextRotationAlignment` enumeration.
+
+ @param type The value for the new object.
+ @return A new value object that contains the style enumeration type.
+*/
++ (instancetype)valueWithMGLTextRotationAlignment:(MGLTextRotationAlignment)textRotationAlignment;
+
+/**
+ The `MGLTextRotationAlignment` enumeration representation of the value.
+*/
+@property (readonly) MGLTextRotationAlignment textRotationAlignment;
+
+/**
+ Creates a new value object containing the given `MGLTextJustify` enumeration.
+
+ @param type The value for the new object.
+ @return A new value object that contains the style enumeration type.
+*/
++ (instancetype)valueWithMGLTextJustify:(MGLTextJustify)textJustify;
+
+/**
+ The `MGLTextJustify` enumeration representation of the value.
+*/
+@property (readonly) MGLTextJustify textJustify;
+
+/**
+ Creates a new value object containing the given `MGLTextAnchor` enumeration.
+
+ @param type The value for the new object.
+ @return A new value object that contains the style enumeration type.
+*/
++ (instancetype)valueWithMGLTextAnchor:(MGLTextAnchor)textAnchor;
+
+/**
+ The `MGLTextAnchor` enumeration representation of the value.
+*/
+@property (readonly) MGLTextAnchor textAnchor;
+
+/**
+ Creates a new value object containing the given `MGLTextTransform` enumeration.
+
+ @param type The value for the new object.
+ @return A new value object that contains the style enumeration type.
+*/
++ (instancetype)valueWithMGLTextTransform:(MGLTextTransform)textTransform;
+
+/**
+ The `MGLTextTransform` enumeration representation of the value.
+*/
+@property (readonly) MGLTextTransform textTransform;
+
+/**
+ Creates a new value object containing the given `MGLFillTranslateAnchor` structure.
+
+ @param type The value for the new object.
+ @return A new value object that contains the style enumeration type.
+*/
++ (instancetype)valueWithMGLFillTranslateAnchor:(MGLFillTranslateAnchor)fillTranslateAnchor;
+
+/**
+ The `MGLFillTranslateAnchor` enumeration representation of the value.
+*/
+@property (readonly) MGLFillTranslateAnchor fillTranslateAnchor;
+
+/**
+ Creates a new value object containing the given `MGLLineTranslateAnchor` structure.
+
+ @param type The value for the new object.
+ @return A new value object that contains the style enumeration type.
+*/
++ (instancetype)valueWithMGLLineTranslateAnchor:(MGLLineTranslateAnchor)lineTranslateAnchor;
+
+/**
+ The `MGLLineTranslateAnchor` enumeration representation of the value.
+*/
+@property (readonly) MGLLineTranslateAnchor lineTranslateAnchor;
+
+/**
+ Creates a new value object containing the given `MGLIconTranslateAnchor` structure.
+
+ @param type The value for the new object.
+ @return A new value object that contains the style enumeration type.
+*/
++ (instancetype)valueWithMGLIconTranslateAnchor:(MGLIconTranslateAnchor)iconTranslateAnchor;
+
+/**
+ The `MGLIconTranslateAnchor` enumeration representation of the value.
+*/
+@property (readonly) MGLIconTranslateAnchor iconTranslateAnchor;
+
+/**
+ Creates a new value object containing the given `MGLTextTranslateAnchor` structure.
+
+ @param type The value for the new object.
+ @return A new value object that contains the style enumeration type.
+*/
++ (instancetype)valueWithMGLTextTranslateAnchor:(MGLTextTranslateAnchor)textTranslateAnchor;
+
+/**
+ The `MGLTextTranslateAnchor` enumeration representation of the value.
+*/
+@property (readonly) MGLTextTranslateAnchor textTranslateAnchor;
+
+/**
+ Creates a new value object containing the given `MGLCircleTranslateAnchor` structure.
+
+ @param type The value for the new object.
+ @return A new value object that contains the style enumeration type.
+*/
++ (instancetype)valueWithMGLCircleTranslateAnchor:(MGLCircleTranslateAnchor)circleTranslateAnchor;
+
+/**
+ The `MGLCircleTranslateAnchor` enumeration representation of the value.
+*/
+@property (readonly) MGLCircleTranslateAnchor circleTranslateAnchor;
+
+/**
+ Creates a new value object containing the given `MGLCirclePitchScale` structure.
+
+ @param type The value for the new object.
+ @return A new value object that contains the style enumeration type.
+*/
++ (instancetype)valueWithMGLCirclePitchScale:(MGLCirclePitchScale)circlePitchScale;
+
+/**
+ The `MGLCirclePitchScale` enumeration representation of the value.
+*/
+@property (readonly) MGLCirclePitchScale circlePitchScale;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/platform/darwin/src/NSValue+MGLStyleEnumAttributeAdditions.h.ejs b/platform/darwin/src/NSValue+MGLStyleEnumAttributeAdditions.h.ejs
new file mode 100644
index 0000000000..6748f7ec90
--- /dev/null
+++ b/platform/darwin/src/NSValue+MGLStyleEnumAttributeAdditions.h.ejs
@@ -0,0 +1,66 @@
+// This file is generated.
+// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+
+<%
+const types = locals.types;
+const layoutProperties = locals.layoutProperties;
+const paintProperties = locals.paintProperties;
+-%>
+#import <Foundation/Foundation.h>
+
+<% if (types) { -%>
+<% for (const type of types) { -%>
+#import "MGL<%- camelize(type) %>StyleLayer.h"
+<% } -%>
+<% } -%>
+
+NS_ASSUME_NONNULL_BEGIN
+
+/**
+ Methods for round-tripping values for Mapbox style layer enumeration values.
+*/
+@interface NSValue (MGLStyleEnumAttributeAdditions)
+
+#pragma mark Working with Style Layer Enumeration Attribute Values
+
+<% if (layoutProperties.length) { -%>
+<% for (const property of layoutProperties) { -%>
+<% if (property.type == "enum") { -%>
+/**
+ Creates a new value object containing the given `MGL<%- camelize(property.name) %>` enumeration.
+
+ @param type The value for the new object.
+ @return A new value object that contains the style enumeration type.
+*/
++ (instancetype)valueWithMGL<%- camelize(property.name) %>:(MGL<%- camelize(property.name) %>)<%- objCName(property) %>;
+
+/**
+ The `MGL<%- camelize(property.name) %>` enumeration representation of the value.
+*/
+@property (readonly) MGL<%- camelize(property.name) %> <%- objCName(property) %>;
+
+<% } -%>
+<% } -%>
+<% } -%>
+<% if (paintProperties.length) { -%>
+<% for (const property of paintProperties) { -%>
+<% if (property.type == "enum") { -%>
+/**
+ Creates a new value object containing the given `MGL<%- camelize(property.name) %>` structure.
+
+ @param type The value for the new object.
+ @return A new value object that contains the style enumeration type.
+*/
++ (instancetype)valueWithMGL<%- camelize(property.name) %>:(MGL<%- camelize(property.name) %>)<%- objCName(property) %>;
+
+/**
+ The `MGL<%- camelize(property.name) %>` enumeration representation of the value.
+*/
+@property (readonly) MGL<%- camelize(property.name) %> <%- objCName(property) %>;
+
+<% } -%>
+<% } -%>
+<% } -%>
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/platform/darwin/src/NSValue+MGLStyleEnumAttributeAdditions.mm b/platform/darwin/src/NSValue+MGLStyleEnumAttributeAdditions.mm
new file mode 100644
index 0000000000..dedff5cf37
--- /dev/null
+++ b/platform/darwin/src/NSValue+MGLStyleEnumAttributeAdditions.mm
@@ -0,0 +1,169 @@
+// This file is generated.
+// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+
+#import "NSValue+MGLStyleEnumAttributeAdditions.h"
+
+@implementation NSValue (MGLStyleEnumAttributeAdditions)
+
++ (NSValue *)valueWithMGLLineCap:(MGLLineCap)lineCap {
+ return [NSValue value:&lineCap withObjCType:@encode(MGLLineCap)];
+}
+
+- (MGLLineCap)lineCap {
+ MGLLineCap value;
+ [self getValue:&value];
+ return value;
+}
+
++ (NSValue *)valueWithMGLLineJoin:(MGLLineJoin)lineJoin {
+ return [NSValue value:&lineJoin withObjCType:@encode(MGLLineJoin)];
+}
+
+- (MGLLineJoin)lineJoin {
+ MGLLineJoin value;
+ [self getValue:&value];
+ return value;
+}
+
++ (NSValue *)valueWithMGLSymbolPlacement:(MGLSymbolPlacement)symbolPlacement {
+ return [NSValue value:&symbolPlacement withObjCType:@encode(MGLSymbolPlacement)];
+}
+
+- (MGLSymbolPlacement)symbolPlacement {
+ MGLSymbolPlacement value;
+ [self getValue:&value];
+ return value;
+}
+
++ (NSValue *)valueWithMGLIconRotationAlignment:(MGLIconRotationAlignment)iconRotationAlignment {
+ return [NSValue value:&iconRotationAlignment withObjCType:@encode(MGLIconRotationAlignment)];
+}
+
+- (MGLIconRotationAlignment)iconRotationAlignment {
+ MGLIconRotationAlignment value;
+ [self getValue:&value];
+ return value;
+}
+
++ (NSValue *)valueWithMGLIconTextFit:(MGLIconTextFit)iconTextFit {
+ return [NSValue value:&iconTextFit withObjCType:@encode(MGLIconTextFit)];
+}
+
+- (MGLIconTextFit)iconTextFit {
+ MGLIconTextFit value;
+ [self getValue:&value];
+ return value;
+}
+
++ (NSValue *)valueWithMGLTextPitchAlignment:(MGLTextPitchAlignment)textPitchAlignment {
+ return [NSValue value:&textPitchAlignment withObjCType:@encode(MGLTextPitchAlignment)];
+}
+
+- (MGLTextPitchAlignment)textPitchAlignment {
+ MGLTextPitchAlignment value;
+ [self getValue:&value];
+ return value;
+}
+
++ (NSValue *)valueWithMGLTextRotationAlignment:(MGLTextRotationAlignment)textRotationAlignment {
+ return [NSValue value:&textRotationAlignment withObjCType:@encode(MGLTextRotationAlignment)];
+}
+
+- (MGLTextRotationAlignment)textRotationAlignment {
+ MGLTextRotationAlignment value;
+ [self getValue:&value];
+ return value;
+}
+
++ (NSValue *)valueWithMGLTextJustify:(MGLTextJustify)textJustify {
+ return [NSValue value:&textJustify withObjCType:@encode(MGLTextJustify)];
+}
+
+- (MGLTextJustify)textJustify {
+ MGLTextJustify value;
+ [self getValue:&value];
+ return value;
+}
+
++ (NSValue *)valueWithMGLTextAnchor:(MGLTextAnchor)textAnchor {
+ return [NSValue value:&textAnchor withObjCType:@encode(MGLTextAnchor)];
+}
+
+- (MGLTextAnchor)textAnchor {
+ MGLTextAnchor value;
+ [self getValue:&value];
+ return value;
+}
+
++ (NSValue *)valueWithMGLTextTransform:(MGLTextTransform)textTransform {
+ return [NSValue value:&textTransform withObjCType:@encode(MGLTextTransform)];
+}
+
+- (MGLTextTransform)textTransform {
+ MGLTextTransform value;
+ [self getValue:&value];
+ return value;
+}
+
++ (NSValue *)valueWithMGLFillTranslateAnchor:(MGLFillTranslateAnchor)fillTranslateAnchor {
+return [NSValue value:&fillTranslateAnchor withObjCType:@encode(MGLFillTranslateAnchor)];
+}
+
+- (MGLFillTranslateAnchor)fillTranslateAnchor {
+ MGLFillTranslateAnchor value;
+ [self getValue:&value];
+ return value;
+}
+
++ (NSValue *)valueWithMGLLineTranslateAnchor:(MGLLineTranslateAnchor)lineTranslateAnchor {
+return [NSValue value:&lineTranslateAnchor withObjCType:@encode(MGLLineTranslateAnchor)];
+}
+
+- (MGLLineTranslateAnchor)lineTranslateAnchor {
+ MGLLineTranslateAnchor value;
+ [self getValue:&value];
+ return value;
+}
+
++ (NSValue *)valueWithMGLIconTranslateAnchor:(MGLIconTranslateAnchor)iconTranslateAnchor {
+return [NSValue value:&iconTranslateAnchor withObjCType:@encode(MGLIconTranslateAnchor)];
+}
+
+- (MGLIconTranslateAnchor)iconTranslateAnchor {
+ MGLIconTranslateAnchor value;
+ [self getValue:&value];
+ return value;
+}
+
++ (NSValue *)valueWithMGLTextTranslateAnchor:(MGLTextTranslateAnchor)textTranslateAnchor {
+return [NSValue value:&textTranslateAnchor withObjCType:@encode(MGLTextTranslateAnchor)];
+}
+
+- (MGLTextTranslateAnchor)textTranslateAnchor {
+ MGLTextTranslateAnchor value;
+ [self getValue:&value];
+ return value;
+}
+
++ (NSValue *)valueWithMGLCircleTranslateAnchor:(MGLCircleTranslateAnchor)circleTranslateAnchor {
+return [NSValue value:&circleTranslateAnchor withObjCType:@encode(MGLCircleTranslateAnchor)];
+}
+
+- (MGLCircleTranslateAnchor)circleTranslateAnchor {
+ MGLCircleTranslateAnchor value;
+ [self getValue:&value];
+ return value;
+}
+
++ (NSValue *)valueWithMGLCirclePitchScale:(MGLCirclePitchScale)circlePitchScale {
+return [NSValue value:&circlePitchScale withObjCType:@encode(MGLCirclePitchScale)];
+}
+
+- (MGLCirclePitchScale)circlePitchScale {
+ MGLCirclePitchScale value;
+ [self getValue:&value];
+ return value;
+}
+
+
+@end
diff --git a/platform/darwin/src/NSValue+MGLStyleEnumAttributeAdditions.mm.ejs b/platform/darwin/src/NSValue+MGLStyleEnumAttributeAdditions.mm.ejs
new file mode 100644
index 0000000000..d445fa0a55
--- /dev/null
+++ b/platform/darwin/src/NSValue+MGLStyleEnumAttributeAdditions.mm.ejs
@@ -0,0 +1,46 @@
+// This file is generated.
+// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+<%
+const type = locals.type;
+const layoutProperties = locals.layoutProperties;
+const paintProperties = locals.paintProperties;
+-%>
+
+#import "NSValue+MGLStyleEnumAttributeAdditions.h"
+
+@implementation NSValue (MGLStyleEnumAttributeAdditions)
+
+<% if (layoutProperties.length) { -%>
+<% for (const property of layoutProperties) { -%>
+<% if (property.type == "enum") { -%>
++ (NSValue *)valueWithMGL<%- camelize(property.name) %>:(MGL<%- camelize(property.name) %>)<%- objCName(property) %> {
+ return [NSValue value:&<%- objCName(property) %> withObjCType:@encode(MGL<%- camelize(property.name) %>)];
+}
+
+- (MGL<%- camelize(property.name) %>)<%- objCName(property) %> {
+ MGL<%- camelize(property.name) %> value;
+ [self getValue:&value];
+ return value;
+}
+
+<% } -%>
+<% } -%>
+<% } -%>
+<% if (paintProperties.length) { -%>
+<% for (const property of paintProperties) { -%>
+<% if (property.type == "enum") { -%>
++ (NSValue *)valueWithMGL<%- camelize(property.name) %>:(MGL<%- camelize(property.name) %>)<%- objCName(property) %> {
+return [NSValue value:&<%- objCName(property) %> withObjCType:@encode(MGL<%- camelize(property.name) %>)];
+}
+
+- (MGL<%- camelize(property.name) %>)<%- objCName(property) %> {
+ MGL<%- camelize(property.name) %> value;
+ [self getValue:&value];
+ return value;
+}
+
+<% } -%>
+<% } -%>
+<% } -%>
+
+@end
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m
index 11247ea3f7..91e934ed1f 100644
--- a/platform/ios/app/MBXViewController.m
+++ b/platform/ios/app/MBXViewController.m
@@ -71,6 +71,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsRuntimeStylingRows) {
MBXSettingsRuntimeStylingVectorSource,
MBXSettingsRuntimeStylingRasterSource,
MBXSettingsRuntimeStylingCountryLabels,
+ MBXSettingsRuntimeStylingRouteLine,
};
typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
@@ -332,6 +333,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
@"Style Vector Source",
@"Style Raster Source",
[NSString stringWithFormat:@"Label Countries in %@", (_usingLocaleBasedCountryLabels ? @"Local Language" : [[NSLocale currentLocale] displayNameForKey:NSLocaleIdentifier value:[self bestLanguageForUser]])],
+ @"Add Route Line",
]];
break;
case MBXSettingsMiscellaneous:
@@ -490,6 +492,9 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
case MBXSettingsRuntimeStylingCountryLabels:
[self styleCountryLabelsLanguage];
break;
+ case MBXSettingsRuntimeStylingRouteLine:
+ [self styleRouteLine];
+ break;
default:
NSAssert(NO, @"All runtime styling setting rows should be implemented");
break;
@@ -816,6 +821,18 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
});
}
++ (MGLStyleConstantValue<NSValue *> *)testEnum:(NSUInteger)value type:(const char *)type
+{
+ return [MGLStyleConstantValue<NSValue *> valueWithRawValue:[NSValue value:&value withObjCType:type]];
+}
+
++ (MGLStyleFunction<NSValue *> *)testEnumFunction:(NSUInteger)value type:(const char *)type
+{
+ return [MGLStyleFunction<NSValue *> valueWithStops:@{
+ @18: [self testEnum:value type:type],
+ }];
+}
+
- (void)styleFilteredLines
{
// set style and focus on lower 48
@@ -1081,6 +1098,44 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
[self styleLabelLanguageForLayersNamed:labelLayers];
}
+- (void)styleRouteLine
+{
+ CLLocationCoordinate2D coords[] = {
+ { 43.84455590478528, 10.504238605499268 },
+ { 43.84385562343126, 10.504125952720642 },
+ { 43.84388657526694, 10.503299832344055 },
+ { 43.84332557075269, 10.503235459327698 },
+ { 43.843441641085036, 10.502264499664307 },
+ { 43.84396395478592, 10.50242006778717 },
+ { 43.84406067904351, 10.501744151115416 },
+ { 43.84422317544319, 10.501792430877686 }
+ };
+ NSInteger count = sizeof(coords) / sizeof(coords[0]);
+
+ [self.mapView setCenterCoordinate:coords[0] zoomLevel:16 animated:YES];
+
+ MGLPolylineFeature *routeLine = [MGLPolylineFeature polylineWithCoordinates:coords count:count];
+
+ MGLGeoJSONSource *routeSource = [[MGLGeoJSONSource alloc] initWithIdentifier:@"style-route-source" features:@[routeLine] options:nil];
+ [self.mapView.style addSource:routeSource];
+
+ MGLLineStyleLayer *baseRouteLayer = [[MGLLineStyleLayer alloc] initWithIdentifier:@"style-base-route-layer" source:routeSource];
+ baseRouteLayer.lineColor = [MGLStyleConstantValue valueWithRawValue:[UIColor orangeColor]];
+ baseRouteLayer.lineWidth = [MGLStyleConstantValue valueWithRawValue:@20];
+ baseRouteLayer.lineOpacity = [MGLStyleConstantValue valueWithRawValue:@0.5];
+ baseRouteLayer.lineCap = [MGLStyleConstantValue valueWithRawValue:[NSValue valueWithMGLLineCap:MGLLineCapRound]];
+ baseRouteLayer.lineJoin = [MGLStyleConstantValue valueWithRawValue:[NSValue valueWithMGLLineJoin:MGLLineJoinRound]];
+ [self.mapView.style addLayer:baseRouteLayer];
+
+ MGLLineStyleLayer *routeLayer = [[MGLLineStyleLayer alloc] initWithIdentifier:@"style-base-route-layer" source:routeSource];
+ routeLayer.lineColor = [MGLStyleConstantValue valueWithRawValue:[UIColor whiteColor]];
+ routeLayer.lineWidth = [MGLStyleConstantValue valueWithRawValue:@15];
+ routeLayer.lineOpacity = [MGLStyleConstantValue valueWithRawValue:@0.8];
+ routeLayer.lineCap = [MGLStyleConstantValue valueWithRawValue:[NSValue valueWithMGLLineCap:MGLLineCapRound]];
+ routeLayer.lineJoin = [MGLStyleConstantValue valueWithRawValue:[NSValue valueWithMGLLineJoin:MGLLineJoinRound]];
+ [self.mapView.style addLayer:routeLayer];
+}
+
- (void)styleLabelLanguageForLayersNamed:(NSArray<NSString *> *)layers
{
_usingLocaleBasedCountryLabels = !_usingLocaleBasedCountryLabels;
diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj
index 9561c741a6..2149df9db7 100644
--- a/platform/ios/ios.xcodeproj/project.pbxproj
+++ b/platform/ios/ios.xcodeproj/project.pbxproj
@@ -127,6 +127,10 @@
4018B1C91CDC288A00F666AF /* MGLAnnotationView_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 4018B1C31CDC277F00F666AF /* MGLAnnotationView_Private.h */; };
4018B1CA1CDC288E00F666AF /* MGLAnnotationView.h in Headers */ = {isa = PBXBuildFile; fileRef = 4018B1C51CDC277F00F666AF /* MGLAnnotationView.h */; settings = {ATTRIBUTES = (Public, ); }; };
4018B1CB1CDC288E00F666AF /* MGLAnnotationView.h in Headers */ = {isa = PBXBuildFile; fileRef = 4018B1C51CDC277F00F666AF /* MGLAnnotationView.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 4032C5BF1DE1FC780062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 4032C5B81DE1EE7D0062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 4032C5C01DE1FC780062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 4032C5B81DE1EE7D0062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 4032C5C11DE1FC7E0062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4032C5BD1DE1FC690062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.mm */; };
+ 4032C5C21DE1FC7E0062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4032C5BD1DE1FC690062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.mm */; };
404326891D5B9B27007111BD /* MGLAnnotationContainerView_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 404326881D5B9B1A007111BD /* MGLAnnotationContainerView_Private.h */; };
4049C29D1DB6CD6C00B3F799 /* MGLPointCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 4049C29B1DB6CD6C00B3F799 /* MGLPointCollection.h */; settings = {ATTRIBUTES = (Public, ); }; };
4049C29E1DB6CD6C00B3F799 /* MGLPointCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 4049C29B1DB6CD6C00B3F799 /* MGLPointCollection.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -560,6 +564,10 @@
4018B1C41CDC277F00F666AF /* MGLAnnotationView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLAnnotationView.mm; sourceTree = "<group>"; };
4018B1C51CDC277F00F666AF /* MGLAnnotationView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLAnnotationView.h; sourceTree = "<group>"; };
402E9DE01CD2C76200FD4519 /* Mapbox.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; path = Mapbox.playground; sourceTree = "<group>"; };
+ 4032C5B71DE1EBB90062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.h.ejs */ = {isa = PBXFileReference; lastKnownFileType = text; path = "NSValue+MGLStyleEnumAttributeAdditions.h.ejs"; sourceTree = "<group>"; };
+ 4032C5B81DE1EE7D0062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSValue+MGLStyleEnumAttributeAdditions.h"; sourceTree = "<group>"; };
+ 4032C5BC1DE1FAFC0062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.mm.ejs */ = {isa = PBXFileReference; lastKnownFileType = text; path = "NSValue+MGLStyleEnumAttributeAdditions.mm.ejs"; sourceTree = "<group>"; };
+ 4032C5BD1DE1FC690062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSValue+MGLStyleEnumAttributeAdditions.mm"; sourceTree = "<group>"; };
404326881D5B9B1A007111BD /* MGLAnnotationContainerView_Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGLAnnotationContainerView_Private.h; sourceTree = "<group>"; };
4049C29B1DB6CD6C00B3F799 /* MGLPointCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLPointCollection.h; sourceTree = "<group>"; };
4049C29C1DB6CD6C00B3F799 /* MGLPointCollection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLPointCollection.mm; sourceTree = "<group>"; };
@@ -879,6 +887,8 @@
35599DB81D46AD7F0048254D /* Categories */ = {
isa = PBXGroup;
children = (
+ 4032C5B81DE1EE7D0062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.h */,
+ 4032C5BD1DE1FC690062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.mm */,
350098DA1D484E60004B2AF0 /* NSValue+MGLStyleAttributeAdditions.h */,
350098DB1D484E60004B2AF0 /* NSValue+MGLStyleAttributeAdditions.mm */,
);
@@ -1206,6 +1216,8 @@
DA8F25B91D51D2570010E6B5 /* MGLRuntimeStylingTests.m.ejs */,
DA8F25BA1D51D2570010E6B5 /* MGLStyleLayer.h.ejs */,
DA8F25BB1D51D2570010E6B5 /* MGLStyleLayer.mm.ejs */,
+ 4032C5B71DE1EBB90062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.h.ejs */,
+ 4032C5BC1DE1FAFC0062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.mm.ejs */,
);
name = "Foundation Templates";
path = ../../darwin/src;
@@ -1462,6 +1474,7 @@
DA88488B1CBB037E00AB86E3 /* SMCalloutView.h in Headers */,
DA8847FE1CBAFA5100AB86E3 /* MGLTypes.h in Headers */,
DA8847F11CBAFA5100AB86E3 /* MGLGeometry.h in Headers */,
+ 4032C5BF1DE1FC780062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.h in Headers */,
DA8848221CBAFA6200AB86E3 /* MGLOfflineRegion_Private.h in Headers */,
35136D4C1D4277FC00C20EFD /* MGLSource.h in Headers */,
3566C76C1D4A8DFA008152BC /* MGLRasterSource.h in Headers */,
@@ -1502,6 +1515,7 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
+ 4032C5C01DE1FC780062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.h in Headers */,
35B82BF91D6C5F8400B1B721 /* NSPredicate+MGLAdditions.h in Headers */,
DA35A2CA1CCAAAD200E826B2 /* NSValue+MGLAdditions.h in Headers */,
350098BC1D480108004B2AF0 /* MGLVectorSource.h in Headers */,
@@ -1962,6 +1976,7 @@
DA8848301CBAFA6200AB86E3 /* NSProcessInfo+MGLAdditions.m in Sources */,
353AFA161D65AB17005A69F4 /* NSDate+MGLAdditions.mm in Sources */,
35D13AC51D3D19DD00AFB4E0 /* MGLFillStyleLayer.mm in Sources */,
+ 4032C5C11DE1FC7E0062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.mm in Sources */,
DA8848241CBAFA6200AB86E3 /* MGLOfflineStorage.mm in Sources */,
DA88482A1CBAFA6200AB86E3 /* MGLTilePyramidOfflineRegion.mm in Sources */,
4049C29F1DB6CD6C00B3F799 /* MGLPointCollection.mm in Sources */,
@@ -2034,6 +2049,7 @@
DAA4E4231CBB730400178DFB /* MGLPolygon.mm in Sources */,
353AFA171D65AB17005A69F4 /* NSDate+MGLAdditions.mm in Sources */,
35D13AC61D3D19DD00AFB4E0 /* MGLFillStyleLayer.mm in Sources */,
+ 4032C5C21DE1FC7E0062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.mm in Sources */,
DAA4E42A1CBB730400178DFB /* NSProcessInfo+MGLAdditions.m in Sources */,
DAA4E4211CBB730400178DFB /* MGLOfflineStorage.mm in Sources */,
4049C2A01DB6CD6C00B3F799 /* MGLPointCollection.mm in Sources */,
diff --git a/platform/ios/src/Mapbox.h b/platform/ios/src/Mapbox.h
index c2fda1be1f..7664695315 100644
--- a/platform/ios/src/Mapbox.h
+++ b/platform/ios/src/Mapbox.h
@@ -51,5 +51,6 @@ FOUNDATION_EXPORT const unsigned char MapboxVersionString[];
#import "MGLUserLocation.h"
#import "MGLUserLocationAnnotationView.h"
#import "NSValue+MGLAdditions.h"
+#import "NSValue+MGLStyleEnumAttributeAdditions.h"
#import "MGLStyleValue.h"
#import "MGLTileSet.h"
diff --git a/platform/macos/macos.xcodeproj/project.pbxproj b/platform/macos/macos.xcodeproj/project.pbxproj
index 194d543f82..3ab9d4d9c0 100644
--- a/platform/macos/macos.xcodeproj/project.pbxproj
+++ b/platform/macos/macos.xcodeproj/project.pbxproj
@@ -40,6 +40,8 @@
35C5D84A1D6DD66D00E95907 /* NSCompoundPredicate+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35C5D8461D6DD66D00E95907 /* NSCompoundPredicate+MGLAdditions.mm */; };
35D65C5A1D65AD5500722C23 /* NSDate+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 35D65C581D65AD5500722C23 /* NSDate+MGLAdditions.h */; };
35D65C5B1D65AD5500722C23 /* NSDate+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35D65C591D65AD5500722C23 /* NSDate+MGLAdditions.mm */; };
+ 4032C5C51DE1FE930062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 4032C5B91DE1EEBA0062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 4032C5C61DE1FE9B0062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4032C5C31DE1FE810062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.mm */; };
4049C2A51DB6CE7F00B3F799 /* MGLPointCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 4049C2A11DB6CE7800B3F799 /* MGLPointCollection.h */; settings = {ATTRIBUTES = (Public, ); }; };
4049C2AD1DB8020600B3F799 /* MGLPointCollection.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4049C2A71DB6D09B00B3F799 /* MGLPointCollection.mm */; };
408AA85B1DAEECFE00022900 /* MGLShape_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 408AA85A1DAEECF100022900 /* MGLShape_Private.h */; };
@@ -265,6 +267,10 @@
35C5D84B1D6DD75B00E95907 /* MGLFilterTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLFilterTests.mm; sourceTree = "<group>"; };
35D65C581D65AD5500722C23 /* NSDate+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDate+MGLAdditions.h"; sourceTree = "<group>"; };
35D65C591D65AD5500722C23 /* NSDate+MGLAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSDate+MGLAdditions.mm"; sourceTree = "<group>"; };
+ 4032C5B91DE1EEBA0062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSValue+MGLStyleEnumAttributeAdditions.h"; sourceTree = "<group>"; };
+ 4032C5BA1DE1EECB0062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.h.ejs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "NSValue+MGLStyleEnumAttributeAdditions.h.ejs"; sourceTree = "<group>"; };
+ 4032C5C31DE1FE810062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSValue+MGLStyleEnumAttributeAdditions.mm"; sourceTree = "<group>"; };
+ 4032C5C71DE1FEAB0062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.mm.ejs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "NSValue+MGLStyleEnumAttributeAdditions.mm.ejs"; sourceTree = "<group>"; };
4049C2A11DB6CE7800B3F799 /* MGLPointCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLPointCollection.h; sourceTree = "<group>"; };
4049C2A71DB6D09B00B3F799 /* MGLPointCollection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLPointCollection.mm; sourceTree = "<group>"; };
405C03961DB0004E001AC280 /* NSImage+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSImage+MGLAdditions.h"; sourceTree = "<group>"; };
@@ -505,6 +511,8 @@
352742791D4C235C00A1ECE6 /* Categories */ = {
isa = PBXGroup;
children = (
+ 4032C5B91DE1EEBA0062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.h */,
+ 4032C5C31DE1FE810062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.mm */,
DA8F25A61D51CB270010E6B5 /* NSValue+MGLStyleAttributeAdditions.h */,
DA8F25A71D51CB270010E6B5 /* NSValue+MGLStyleAttributeAdditions.mm */,
);
@@ -666,6 +674,8 @@
DA8F25B81D51D2280010E6B5 /* Foundation Templates */ = {
isa = PBXGroup;
children = (
+ 4032C5BA1DE1EECB0062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.h.ejs */,
+ 4032C5C71DE1FEAB0062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.mm.ejs */,
DA8F25B51D51D2240010E6B5 /* MGLRuntimeStylingTests.m.ejs */,
DA8F25B61D51D2240010E6B5 /* MGLStyleLayer.h.ejs */,
DA8F25B71D51D2240010E6B5 /* MGLStyleLayer.mm.ejs */,
@@ -915,6 +925,7 @@
352742781D4C220900A1ECE6 /* MGLStyleValue.h in Headers */,
DAE6C35E1CC31E0400DB3429 /* MGLMultiPoint.h in Headers */,
35602BFF1D3EA9B40050646F /* MGLStyleLayer_Private.h in Headers */,
+ 4032C5C51DE1FE930062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.h in Headers */,
DAE6C3971CC31E2A00DB3429 /* NSBundle+MGLAdditions.h in Headers */,
DAED385F1D62CED700D7640F /* NSURL+MGLAdditions.h in Headers */,
DAD165741CF4CD7A001FF4B9 /* MGLShapeCollection.h in Headers */,
@@ -1176,6 +1187,7 @@
DAE6C3931CC31E2A00DB3429 /* MGLShape.mm in Sources */,
352742861D4C244700A1ECE6 /* MGLRasterSource.mm in Sources */,
DAE6C39D1CC31E2A00DB3429 /* NSString+MGLAdditions.m in Sources */,
+ 4032C5C61DE1FE9B0062E8BD /* NSValue+MGLStyleEnumAttributeAdditions.mm in Sources */,
DAE6C3941CC31E2A00DB3429 /* MGLStyle.mm in Sources */,
DAE6C3871CC31E2A00DB3429 /* MGLGeometry.mm in Sources */,
3527428E1D4C24AB00A1ECE6 /* MGLCircleStyleLayer.mm in Sources */,
diff --git a/platform/macos/src/Mapbox.h b/platform/macos/src/Mapbox.h
index cfddfe6e89..73b8624be0 100644
--- a/platform/macos/src/Mapbox.h
+++ b/platform/macos/src/Mapbox.h
@@ -46,4 +46,5 @@ FOUNDATION_EXPORT const unsigned char MapboxVersionString[];
#import "MGLTilePyramidOfflineRegion.h"
#import "MGLTypes.h"
#import "NSValue+MGLAdditions.h"
+#import "NSValue+MGLStyleEnumAttributeAdditions.h"
#import "MGLStyleValue.h"