From 24598f3a747e9353afde09cc0eaf1552f64d879b Mon Sep 17 00:00:00 2001 From: Fredrik Karlsson Date: Fri, 22 Jul 2016 12:13:20 +0200 Subject: [PATCH] [ios, macos] #5626 - outlined template for layer implementation files --- .../darwin/src/MGLBackgroundStyleLayer.mm | 48 ++ platform/darwin/src/MGLCircleStyleLayer.mm | 82 +++ platform/darwin/src/MGLFillStyleLayer.mm | 69 ++- platform/darwin/src/MGLLineStyleLayer.mm | 152 ++++++ platform/darwin/src/MGLRasterStyleLayer.mm | 86 +++ platform/darwin/src/MGLStyleLayer.h | 2 + platform/darwin/src/MGLStyleLayer.mm.ejs | 117 ++++ platform/darwin/src/MGLSymbolStyleLayer.mm | 507 ++++++++++++++++++ platform/ios/app/MBXViewController.m | 2 + platform/ios/ios.xcodeproj/project.pbxproj | 32 +- platform/ios/scripts/generate-style-code.js | 2 + platform/ios/src/UIColor+MGLAdditions.hpp | 2 + platform/ios/src/UIColor+MGLAdditions.mm | 5 + platform/macos/app/MapDocument.m | 1 + .../macos/macos.xcodeproj/project.pbxproj | 18 +- platform/macos/src/NSColor+MGLAdditions.hpp | 2 + platform/macos/src/NSColor+MGLAdditions.mm | 4 + 17 files changed, 1118 insertions(+), 13 deletions(-) create mode 100644 platform/darwin/src/MGLBackgroundStyleLayer.mm create mode 100644 platform/darwin/src/MGLCircleStyleLayer.mm create mode 100644 platform/darwin/src/MGLLineStyleLayer.mm create mode 100644 platform/darwin/src/MGLRasterStyleLayer.mm create mode 100644 platform/darwin/src/MGLStyleLayer.mm.ejs create mode 100644 platform/darwin/src/MGLSymbolStyleLayer.mm diff --git a/platform/darwin/src/MGLBackgroundStyleLayer.mm b/platform/darwin/src/MGLBackgroundStyleLayer.mm new file mode 100644 index 00000000000..95cedc26ee0 --- /dev/null +++ b/platform/darwin/src/MGLBackgroundStyleLayer.mm @@ -0,0 +1,48 @@ +// This file is generated. +// Edit platform/ios/scripts/generate-style-code.js, then run `make style-code-ios`. + +#import "MGLStyleLayer_Private.hpp" +#import "MGLBackgroundStyleLayer.h" +#import + +@interface MGLBackgroundStyleLayer() { + mbgl::style::BackgroundLayer *backgroundLayer; +} +@end + +@implementation MGLBackgroundStyleLayer + +- (void)setLayer:(mbgl::style::Layer *)layer +{ + backgroundLayer = reinterpret_cast(layer); +} + +#pragma mark - Accessing the Paint Attributes + +- (void)setBackgroundColor:(MGLColor*)backgroundColor +{ + backgroundLayer->setBackgroundColor(backgroundColor.mbgl_color); +} +- (MGLColor *)backgroundColor +{ + return [MGLColor mbgl_color:backgroundLayer->getBackgroundColor().asConstant()]; +} +- (void)setBackgroundPattern:(NSString*)backgroundPattern +{ +} +- (NSString *)backgroundPattern +{ + // TODO: + return @"string"; +} +- (void)setBackgroundOpacity:(CGFloat)backgroundOpacity +{ + backgroundLayer->setBackgroundOpacity(backgroundOpacity); +} +- (CGFloat)backgroundOpacity +{ + // TODO: + return 0; +} + +@end \ No newline at end of file diff --git a/platform/darwin/src/MGLCircleStyleLayer.mm b/platform/darwin/src/MGLCircleStyleLayer.mm new file mode 100644 index 00000000000..023a318b178 --- /dev/null +++ b/platform/darwin/src/MGLCircleStyleLayer.mm @@ -0,0 +1,82 @@ +// This file is generated. +// Edit platform/ios/scripts/generate-style-code.js, then run `make style-code-ios`. + +#import "MGLStyleLayer_Private.hpp" +#import "MGLCircleStyleLayer.h" +#import + +@interface MGLCircleStyleLayer() { + mbgl::style::CircleLayer *circleLayer; +} +@end + +@implementation MGLCircleStyleLayer + +- (void)setLayer:(mbgl::style::Layer *)layer +{ + circleLayer = reinterpret_cast(layer); +} + +#pragma mark - Accessing the Paint Attributes + +- (void)setCircleRadius:(CGFloat)circleRadius +{ + circleLayer->setCircleRadius(circleRadius); +} +- (CGFloat)circleRadius +{ + // TODO: + return 0; +} +- (void)setCircleColor:(MGLColor*)circleColor +{ + circleLayer->setCircleColor(circleColor.mbgl_color); +} +- (MGLColor *)circleColor +{ + return [MGLColor mbgl_color:circleLayer->getCircleColor().asConstant()]; +} +- (void)setCircleBlur:(CGFloat)circleBlur +{ + circleLayer->setCircleBlur(circleBlur); +} +- (CGFloat)circleBlur +{ + // TODO: + return 0; +} +- (void)setCircleOpacity:(CGFloat)circleOpacity +{ + circleLayer->setCircleOpacity(circleOpacity); +} +- (CGFloat)circleOpacity +{ + // TODO: + return 0; +} +- (void)setCircleTranslate:(NSArray*)circleTranslate +{ +} +- (NSArray *)circleTranslate +{ + // TODO: + return @[]; +} +- (void)setCircleTranslateAnchor:(MGLCircleStyleLayerCircleTranslateAnchor)circleTranslateAnchor +{ +} +- (MGLCircleStyleLayerCircleTranslateAnchor)circleTranslateAnchor +{ + // TODO: + return MGLCircleStyleLayerCircleTranslateAnchorMap; +} +- (void)setCirclePitchScale:(MGLCircleStyleLayerCirclePitchScale)circlePitchScale +{ +} +- (MGLCircleStyleLayerCirclePitchScale)circlePitchScale +{ + // TODO: + return MGLCircleStyleLayerCirclePitchScaleMap; +} + +@end \ No newline at end of file diff --git a/platform/darwin/src/MGLFillStyleLayer.mm b/platform/darwin/src/MGLFillStyleLayer.mm index de915162ad4..f6478f8086b 100644 --- a/platform/darwin/src/MGLFillStyleLayer.mm +++ b/platform/darwin/src/MGLFillStyleLayer.mm @@ -1,7 +1,9 @@ -#import "MGLFillStyleLayer.h" +// This file is generated. +// Edit platform/ios/scripts/generate-style-code.js, then run `make style-code-ios`. -#include "MGLStyleLayer_Private.hpp" -#include +#import "MGLStyleLayer_Private.hpp" +#import "MGLFillStyleLayer.h" +#import @interface MGLFillStyleLayer() { mbgl::style::FillLayer *fillLayer; @@ -15,11 +17,64 @@ - (void)setLayer:(mbgl::style::Layer *)layer fillLayer = reinterpret_cast(layer); } -- (void)setFillColor:(MGLColor *)fillColor +#pragma mark - Accessing the Paint Attributes + +- (void)setFillAntialias:(BOOL)fillAntialias +{ +} +- (BOOL)fillAntialias +{ + // TODO: + return YES; +} +- (void)setFillOpacity:(CGFloat)fillOpacity +{ + fillLayer->setFillOpacity(fillOpacity); +} +- (CGFloat)fillOpacity +{ + // TODO: + return 0; +} +- (void)setFillColor:(MGLColor*)fillColor { - _fillColor = fillColor; fillLayer->setFillColor(fillColor.mbgl_color); - [self updateStyleAndClasses]; +} +- (MGLColor *)fillColor +{ + return [MGLColor mbgl_color:fillLayer->getFillColor().asConstant()]; +} +- (void)setFillOutlineColor:(MGLColor*)fillOutlineColor +{ + fillLayer->setFillOutlineColor(fillOutlineColor.mbgl_color); +} +- (MGLColor *)fillOutlineColor +{ + return [MGLColor mbgl_color:fillLayer->getFillOutlineColor().asConstant()]; +} +- (void)setFillTranslate:(NSArray*)fillTranslate +{ +} +- (NSArray *)fillTranslate +{ + // TODO: + return @[]; +} +- (void)setFillTranslateAnchor:(MGLFillStyleLayerFillTranslateAnchor)fillTranslateAnchor +{ +} +- (MGLFillStyleLayerFillTranslateAnchor)fillTranslateAnchor +{ + // TODO: + return MGLFillStyleLayerFillTranslateAnchorMap; +} +- (void)setFillPattern:(NSString*)fillPattern +{ +} +- (NSString *)fillPattern +{ + // TODO: + return @"string"; } -@end +@end \ No newline at end of file diff --git a/platform/darwin/src/MGLLineStyleLayer.mm b/platform/darwin/src/MGLLineStyleLayer.mm new file mode 100644 index 00000000000..b531bac6299 --- /dev/null +++ b/platform/darwin/src/MGLLineStyleLayer.mm @@ -0,0 +1,152 @@ +// This file is generated. +// Edit platform/ios/scripts/generate-style-code.js, then run `make style-code-ios`. + +#import "MGLStyleLayer_Private.hpp" +#import "MGLLineStyleLayer.h" +#import + +@interface MGLLineStyleLayer() { + mbgl::style::LineLayer *lineLayer; +} +@end + +@implementation MGLLineStyleLayer + +- (void)setLayer:(mbgl::style::Layer *)layer +{ + lineLayer = reinterpret_cast(layer); +} + +#pragma mark - Accessing the Layout Attributes + + +- (void)setLineCap:(MGLLineStyleLayerLineCap)lineCap +{ +} + +- (MGLLineStyleLayerLineCap)lineCap +{ + // TODO: + return MGLLineStyleLayerLineCapButt; +} + +- (void)setLineJoin:(MGLLineStyleLayerLineJoin)lineJoin +{ +} + +- (MGLLineStyleLayerLineJoin)lineJoin +{ + // TODO: + return MGLLineStyleLayerLineJoinBevel; +} + +- (void)setLineMiterLimit:(CGFloat)lineMiterLimit +{ + lineLayer->setLineMiterLimit(lineMiterLimit); +} + +- (CGFloat)lineMiterLimit +{ + // TODO: + return 0; +} + +- (void)setLineRoundLimit:(CGFloat)lineRoundLimit +{ + lineLayer->setLineRoundLimit(lineRoundLimit); +} + +- (CGFloat)lineRoundLimit +{ + // TODO: + return 0; +} +#pragma mark - Accessing the Paint Attributes + +- (void)setLineOpacity:(CGFloat)lineOpacity +{ + lineLayer->setLineOpacity(lineOpacity); +} +- (CGFloat)lineOpacity +{ + // TODO: + return 0; +} +- (void)setLineColor:(MGLColor*)lineColor +{ + lineLayer->setLineColor(lineColor.mbgl_color); +} +- (MGLColor *)lineColor +{ + return [MGLColor mbgl_color:lineLayer->getLineColor().asConstant()]; +} +- (void)setLineTranslate:(NSArray*)lineTranslate +{ +} +- (NSArray *)lineTranslate +{ + // TODO: + return @[]; +} +- (void)setLineTranslateAnchor:(MGLLineStyleLayerLineTranslateAnchor)lineTranslateAnchor +{ +} +- (MGLLineStyleLayerLineTranslateAnchor)lineTranslateAnchor +{ + // TODO: + return MGLLineStyleLayerLineTranslateAnchorMap; +} +- (void)setLineWidth:(CGFloat)lineWidth +{ + lineLayer->setLineWidth(lineWidth); +} +- (CGFloat)lineWidth +{ + // TODO: + return 0; +} +- (void)setLineGapWidth:(CGFloat)lineGapWidth +{ + lineLayer->setLineGapWidth(lineGapWidth); +} +- (CGFloat)lineGapWidth +{ + // TODO: + return 0; +} +- (void)setLineOffset:(CGFloat)lineOffset +{ + lineLayer->setLineOffset(lineOffset); +} +- (CGFloat)lineOffset +{ + // TODO: + return 0; +} +- (void)setLineBlur:(CGFloat)lineBlur +{ + lineLayer->setLineBlur(lineBlur); +} +- (CGFloat)lineBlur +{ + // TODO: + return 0; +} +- (void)setLineDasharray:(NSArray*)lineDasharray +{ +} +- (NSArray *)lineDasharray +{ + // TODO: + return @[]; +} +- (void)setLinePattern:(NSString*)linePattern +{ +} +- (NSString *)linePattern +{ + // TODO: + return @"string"; +} + +@end \ No newline at end of file diff --git a/platform/darwin/src/MGLRasterStyleLayer.mm b/platform/darwin/src/MGLRasterStyleLayer.mm new file mode 100644 index 00000000000..19d6943ade1 --- /dev/null +++ b/platform/darwin/src/MGLRasterStyleLayer.mm @@ -0,0 +1,86 @@ +// This file is generated. +// Edit platform/ios/scripts/generate-style-code.js, then run `make style-code-ios`. + +#import "MGLStyleLayer_Private.hpp" +#import "MGLRasterStyleLayer.h" +#import + +@interface MGLRasterStyleLayer() { + mbgl::style::RasterLayer *rasterLayer; +} +@end + +@implementation MGLRasterStyleLayer + +- (void)setLayer:(mbgl::style::Layer *)layer +{ + rasterLayer = reinterpret_cast(layer); +} + +#pragma mark - Accessing the Paint Attributes + +- (void)setRasterOpacity:(CGFloat)rasterOpacity +{ + rasterLayer->setRasterOpacity(rasterOpacity); +} +- (CGFloat)rasterOpacity +{ + // TODO: + return 0; +} +- (void)setRasterHueRotate:(CGFloat)rasterHueRotate +{ + rasterLayer->setRasterHueRotate(rasterHueRotate); +} +- (CGFloat)rasterHueRotate +{ + // TODO: + return 0; +} +- (void)setRasterBrightnessMin:(CGFloat)rasterBrightnessMin +{ + rasterLayer->setRasterBrightnessMin(rasterBrightnessMin); +} +- (CGFloat)rasterBrightnessMin +{ + // TODO: + return 0; +} +- (void)setRasterBrightnessMax:(CGFloat)rasterBrightnessMax +{ + rasterLayer->setRasterBrightnessMax(rasterBrightnessMax); +} +- (CGFloat)rasterBrightnessMax +{ + // TODO: + return 0; +} +- (void)setRasterSaturation:(CGFloat)rasterSaturation +{ + rasterLayer->setRasterSaturation(rasterSaturation); +} +- (CGFloat)rasterSaturation +{ + // TODO: + return 0; +} +- (void)setRasterContrast:(CGFloat)rasterContrast +{ + rasterLayer->setRasterContrast(rasterContrast); +} +- (CGFloat)rasterContrast +{ + // TODO: + return 0; +} +- (void)setRasterFadeDuration:(CGFloat)rasterFadeDuration +{ + rasterLayer->setRasterFadeDuration(rasterFadeDuration); +} +- (CGFloat)rasterFadeDuration +{ + // TODO: + return 0; +} + +@end \ No newline at end of file diff --git a/platform/darwin/src/MGLStyleLayer.h b/platform/darwin/src/MGLStyleLayer.h index e726fe43952..e3aa44f1c51 100644 --- a/platform/darwin/src/MGLStyleLayer.h +++ b/platform/darwin/src/MGLStyleLayer.h @@ -2,4 +2,6 @@ @interface MGLStyleLayer : NSObject +- (void)updateStyleAndClasses; + @end diff --git a/platform/darwin/src/MGLStyleLayer.mm.ejs b/platform/darwin/src/MGLStyleLayer.mm.ejs new file mode 100644 index 00000000000..19931f519fd --- /dev/null +++ b/platform/darwin/src/MGLStyleLayer.mm.ejs @@ -0,0 +1,117 @@ +<% + const type = locals.type; + const layoutProperties = locals.layoutProperties; + const paintProperties = locals.paintProperties; +-%> +// This file is generated. +// Edit platform/ios/scripts/generate-style-code.js, then run `make style-code-ios`. + +#import "MGLStyleLayer_Private.hpp" +#import "MGL<%- camelize(type) %>StyleLayer.h" +#import _layer.hpp> + +@interface MGL<%- camelize(type) %>StyleLayer() { + mbgl::style::<%- camelize(type) %>Layer *<%- type %>Layer; +} +@end + +@implementation MGL<%- camelize(type) %>StyleLayer + +- (void)setLayer:(mbgl::style::Layer *)layer +{ + <%- camelizeWithLeadingLowercase(type) %>Layer = reinterpret_castLayer *>(layer); +} + +<% if (layoutProperties.length) { -%> +#pragma mark - Accessing the Layout Attributes + +<% for (const property of layoutProperties) { -%> + +- (void)set<%- camelize(property.name) %>:(<%- propertyType(property, type) %><% if (isObject(property)) { -%>*<% } -%>)<%- camelizeWithLeadingLowercase(property.name) %> +{ +<% if (property.type == "boolean") { -%> + // TODO: Boolean +<% } -%> +<% if (property.type == "number") { -%> + <%- camelizeWithLeadingLowercase(type) %>Layer->set<%- camelize(property.name) %>(<%- camelizeWithLeadingLowercase(property.name) %>); +<% } -%> +<% if (property.type == "string") { -%> + // TODO: + return @"string"; +<% } -%> +<% if (property.type == "color") { -%> + <%- camelizeWithLeadingLowercase(type) %>Layer->set<%- camelize(property.name) %>(<%- camelizeWithLeadingLowercase(property.name) %>.mbgl_color); +<% } -%> +} + +- (<%- propertyType(property, type) %><% if (isObject(property)) { -%> *<% } -%>)<%- camelizeWithLeadingLowercase(property.name) %> +{ +<% if (property.type == "color") { -%> + return [MGLColor mbgl_color:<%- camelizeWithLeadingLowercase(type) %>Layer->get<%- camelize(property.name) %>().asConstant()]; +<% } -%> +<% if (property.type == "boolean") { -%> + // TODO: + return YES; +<% } -%> +<% if (property.type == "number") { -%> + // TODO: + return 0; +<% } -%> +<% if (property.type == "array") { -%> + // TODO: + return @[]; +<% } -%> +<% if (property.type == "string") { -%> + // TODO: + return @"string"; +<% } -%> +<% if (property.type == "enum") { -%> + // TODO: + return MGL<%- camelize(type) %>StyleLayer<%- camelize(property.name) %><%- camelize(property.values[0]) %>; +<% } -%> +} +<% } -%> +<% } -%> +<% if (paintProperties.length) { -%> +#pragma mark - Accessing the Paint Attributes + +<% for (const property of paintProperties) { -%> +- (void)set<%- camelize(property.name) %>:(<%- propertyType(property, type) %><% if (isObject(property)) { -%>*<% } -%>)<%- camelizeWithLeadingLowercase(property.name) %> +{ +<% if (property.type == "color") { -%> + <%- camelizeWithLeadingLowercase(type) %>Layer->set<%- camelize(property.name) %>(<%- camelizeWithLeadingLowercase(property.name) %>.mbgl_color); +<% } -%> +<% if (property.type == "number") { -%> + <%- camelizeWithLeadingLowercase(type) %>Layer->set<%- camelize(property.name) %>(<%- camelizeWithLeadingLowercase(property.name) %>); +<% } -%> +} +- (<%- propertyType(property, type) %><% if (isObject(property)) { -%> *<% } -%>)<%- camelizeWithLeadingLowercase(property.name) %> +{ +<% if (property.type == "color") { -%> + return [MGLColor mbgl_color:<%- camelizeWithLeadingLowercase(type) %>Layer->get<%- camelize(property.name) %>().asConstant()]; +<% } -%> +<% if (property.type == "boolean") { -%> + // TODO: + return YES; +<% } -%> +<% if (property.type == "number") { -%> + // TODO: + return 0; +<% } -%> +<% if (property.type == "array") { -%> + // TODO: + return @[]; +<% } -%> +<% if (property.type == "string") { -%> + // TODO: + return @"string"; +<% } -%> +<% if (property.type == "enum") { -%> + // TODO: + return MGL<%- camelize(type) %>StyleLayer<%- camelize(property.name) %><%- camelize(property.values[0]) %>; +<% } -%> +} +<% } -%> +<% } -%> + +@end \ No newline at end of file diff --git a/platform/darwin/src/MGLSymbolStyleLayer.mm b/platform/darwin/src/MGLSymbolStyleLayer.mm new file mode 100644 index 00000000000..2dc72853a33 --- /dev/null +++ b/platform/darwin/src/MGLSymbolStyleLayer.mm @@ -0,0 +1,507 @@ +// This file is generated. +// Edit platform/ios/scripts/generate-style-code.js, then run `make style-code-ios`. + +#import "MGLStyleLayer_Private.hpp" +#import "MGLSymbolStyleLayer.h" +#import + +@interface MGLSymbolStyleLayer() { + mbgl::style::SymbolLayer *symbolLayer; +} +@end + +@implementation MGLSymbolStyleLayer + +- (void)setLayer:(mbgl::style::Layer *)layer +{ + symbolLayer = reinterpret_cast(layer); +} + +#pragma mark - Accessing the Layout Attributes + + +- (void)setSymbolPlacement:(MGLSymbolStyleLayerSymbolPlacement)symbolPlacement +{ +} + +- (MGLSymbolStyleLayerSymbolPlacement)symbolPlacement +{ + // TODO: + return MGLSymbolStyleLayerSymbolPlacementPoint; +} + +- (void)setSymbolSpacing:(CGFloat)symbolSpacing +{ + symbolLayer->setSymbolSpacing(symbolSpacing); +} + +- (CGFloat)symbolSpacing +{ + // TODO: + return 0; +} + +- (void)setSymbolAvoidEdges:(BOOL)symbolAvoidEdges +{ + // TODO: Boolean +} + +- (BOOL)symbolAvoidEdges +{ + // TODO: + return YES; +} + +- (void)setIconAllowOverlap:(BOOL)iconAllowOverlap +{ + // TODO: Boolean +} + +- (BOOL)iconAllowOverlap +{ + // TODO: + return YES; +} + +- (void)setIconIgnorePlacement:(BOOL)iconIgnorePlacement +{ + // TODO: Boolean +} + +- (BOOL)iconIgnorePlacement +{ + // TODO: + return YES; +} + +- (void)setIconOptional:(BOOL)iconOptional +{ + // TODO: Boolean +} + +- (BOOL)iconOptional +{ + // TODO: + return YES; +} + +- (void)setIconRotationAlignment:(MGLSymbolStyleLayerIconRotationAlignment)iconRotationAlignment +{ +} + +- (MGLSymbolStyleLayerIconRotationAlignment)iconRotationAlignment +{ + // TODO: + return MGLSymbolStyleLayerIconRotationAlignmentMap; +} + +- (void)setIconSize:(CGFloat)iconSize +{ + symbolLayer->setIconSize(iconSize); +} + +- (CGFloat)iconSize +{ + // TODO: + return 0; +} + +- (void)setIconTextFit:(MGLSymbolStyleLayerIconTextFit)iconTextFit +{ +} + +- (MGLSymbolStyleLayerIconTextFit)iconTextFit +{ + // TODO: + return MGLSymbolStyleLayerIconTextFitNone; +} + +- (void)setIconTextFitPadding:(NSArray*)iconTextFitPadding +{ +} + +- (NSArray *)iconTextFitPadding +{ + // TODO: + return @[]; +} + +- (void)setIconImage:(NSString*)iconImage +{ + // TODO: + return @"string"; +} + +- (NSString *)iconImage +{ + // TODO: + return @"string"; +} + +- (void)setIconRotate:(CGFloat)iconRotate +{ + symbolLayer->setIconRotate(iconRotate); +} + +- (CGFloat)iconRotate +{ + // TODO: + return 0; +} + +- (void)setIconPadding:(CGFloat)iconPadding +{ + symbolLayer->setIconPadding(iconPadding); +} + +- (CGFloat)iconPadding +{ + // TODO: + return 0; +} + +- (void)setIconKeepUpright:(BOOL)iconKeepUpright +{ + // TODO: Boolean +} + +- (BOOL)iconKeepUpright +{ + // TODO: + return YES; +} + +- (void)setIconOffset:(NSArray*)iconOffset +{ +} + +- (NSArray *)iconOffset +{ + // TODO: + return @[]; +} + +- (void)setTextPitchAlignment:(MGLSymbolStyleLayerTextPitchAlignment)textPitchAlignment +{ +} + +- (MGLSymbolStyleLayerTextPitchAlignment)textPitchAlignment +{ + // TODO: + return MGLSymbolStyleLayerTextPitchAlignmentMap; +} + +- (void)setTextRotationAlignment:(MGLSymbolStyleLayerTextRotationAlignment)textRotationAlignment +{ +} + +- (MGLSymbolStyleLayerTextRotationAlignment)textRotationAlignment +{ + // TODO: + return MGLSymbolStyleLayerTextRotationAlignmentMap; +} + +- (void)setTextField:(NSString*)textField +{ + // TODO: + return @"string"; +} + +- (NSString *)textField +{ + // TODO: + return @"string"; +} + +- (void)setTextFont:(NSArray*)textFont +{ +} + +- (NSArray *)textFont +{ + // TODO: + return @[]; +} + +- (void)setTextSize:(CGFloat)textSize +{ + symbolLayer->setTextSize(textSize); +} + +- (CGFloat)textSize +{ + // TODO: + return 0; +} + +- (void)setTextMaxWidth:(CGFloat)textMaxWidth +{ + symbolLayer->setTextMaxWidth(textMaxWidth); +} + +- (CGFloat)textMaxWidth +{ + // TODO: + return 0; +} + +- (void)setTextLineHeight:(CGFloat)textLineHeight +{ + symbolLayer->setTextLineHeight(textLineHeight); +} + +- (CGFloat)textLineHeight +{ + // TODO: + return 0; +} + +- (void)setTextLetterSpacing:(CGFloat)textLetterSpacing +{ + symbolLayer->setTextLetterSpacing(textLetterSpacing); +} + +- (CGFloat)textLetterSpacing +{ + // TODO: + return 0; +} + +- (void)setTextJustify:(MGLSymbolStyleLayerTextJustify)textJustify +{ +} + +- (MGLSymbolStyleLayerTextJustify)textJustify +{ + // TODO: + return MGLSymbolStyleLayerTextJustifyLeft; +} + +- (void)setTextAnchor:(MGLSymbolStyleLayerTextAnchor)textAnchor +{ +} + +- (MGLSymbolStyleLayerTextAnchor)textAnchor +{ + // TODO: + return MGLSymbolStyleLayerTextAnchorCenter; +} + +- (void)setTextMaxAngle:(CGFloat)textMaxAngle +{ + symbolLayer->setTextMaxAngle(textMaxAngle); +} + +- (CGFloat)textMaxAngle +{ + // TODO: + return 0; +} + +- (void)setTextRotate:(CGFloat)textRotate +{ + symbolLayer->setTextRotate(textRotate); +} + +- (CGFloat)textRotate +{ + // TODO: + return 0; +} + +- (void)setTextPadding:(CGFloat)textPadding +{ + symbolLayer->setTextPadding(textPadding); +} + +- (CGFloat)textPadding +{ + // TODO: + return 0; +} + +- (void)setTextKeepUpright:(BOOL)textKeepUpright +{ + // TODO: Boolean +} + +- (BOOL)textKeepUpright +{ + // TODO: + return YES; +} + +- (void)setTextTransform:(MGLSymbolStyleLayerTextTransform)textTransform +{ +} + +- (MGLSymbolStyleLayerTextTransform)textTransform +{ + // TODO: + return MGLSymbolStyleLayerTextTransformNone; +} + +- (void)setTextOffset:(NSArray*)textOffset +{ +} + +- (NSArray *)textOffset +{ + // TODO: + return @[]; +} + +- (void)setTextAllowOverlap:(BOOL)textAllowOverlap +{ + // TODO: Boolean +} + +- (BOOL)textAllowOverlap +{ + // TODO: + return YES; +} + +- (void)setTextIgnorePlacement:(BOOL)textIgnorePlacement +{ + // TODO: Boolean +} + +- (BOOL)textIgnorePlacement +{ + // TODO: + return YES; +} + +- (void)setTextOptional:(BOOL)textOptional +{ + // TODO: Boolean +} + +- (BOOL)textOptional +{ + // TODO: + return YES; +} +#pragma mark - Accessing the Paint Attributes + +- (void)setIconOpacity:(CGFloat)iconOpacity +{ + symbolLayer->setIconOpacity(iconOpacity); +} +- (CGFloat)iconOpacity +{ + // TODO: + return 0; +} +- (void)setIconColor:(MGLColor*)iconColor +{ + symbolLayer->setIconColor(iconColor.mbgl_color); +} +- (MGLColor *)iconColor +{ + return [MGLColor mbgl_color:symbolLayer->getIconColor().asConstant()]; +} +- (void)setIconHaloColor:(MGLColor*)iconHaloColor +{ + symbolLayer->setIconHaloColor(iconHaloColor.mbgl_color); +} +- (MGLColor *)iconHaloColor +{ + return [MGLColor mbgl_color:symbolLayer->getIconHaloColor().asConstant()]; +} +- (void)setIconHaloWidth:(CGFloat)iconHaloWidth +{ + symbolLayer->setIconHaloWidth(iconHaloWidth); +} +- (CGFloat)iconHaloWidth +{ + // TODO: + return 0; +} +- (void)setIconHaloBlur:(CGFloat)iconHaloBlur +{ + symbolLayer->setIconHaloBlur(iconHaloBlur); +} +- (CGFloat)iconHaloBlur +{ + // TODO: + return 0; +} +- (void)setIconTranslate:(NSArray*)iconTranslate +{ +} +- (NSArray *)iconTranslate +{ + // TODO: + return @[]; +} +- (void)setIconTranslateAnchor:(MGLSymbolStyleLayerIconTranslateAnchor)iconTranslateAnchor +{ +} +- (MGLSymbolStyleLayerIconTranslateAnchor)iconTranslateAnchor +{ + // TODO: + return MGLSymbolStyleLayerIconTranslateAnchorMap; +} +- (void)setTextOpacity:(CGFloat)textOpacity +{ + symbolLayer->setTextOpacity(textOpacity); +} +- (CGFloat)textOpacity +{ + // TODO: + return 0; +} +- (void)setTextColor:(MGLColor*)textColor +{ + symbolLayer->setTextColor(textColor.mbgl_color); +} +- (MGLColor *)textColor +{ + return [MGLColor mbgl_color:symbolLayer->getTextColor().asConstant()]; +} +- (void)setTextHaloColor:(MGLColor*)textHaloColor +{ + symbolLayer->setTextHaloColor(textHaloColor.mbgl_color); +} +- (MGLColor *)textHaloColor +{ + return [MGLColor mbgl_color:symbolLayer->getTextHaloColor().asConstant()]; +} +- (void)setTextHaloWidth:(CGFloat)textHaloWidth +{ + symbolLayer->setTextHaloWidth(textHaloWidth); +} +- (CGFloat)textHaloWidth +{ + // TODO: + return 0; +} +- (void)setTextHaloBlur:(CGFloat)textHaloBlur +{ + symbolLayer->setTextHaloBlur(textHaloBlur); +} +- (CGFloat)textHaloBlur +{ + // TODO: + return 0; +} +- (void)setTextTranslate:(NSArray*)textTranslate +{ +} +- (NSArray *)textTranslate +{ + // TODO: + return @[]; +} +- (void)setTextTranslateAnchor:(MGLSymbolStyleLayerTextTranslateAnchor)textTranslateAnchor +{ +} +- (MGLSymbolStyleLayerTextTranslateAnchor)textTranslateAnchor +{ + // TODO: + return MGLSymbolStyleLayerTextTranslateAnchorMap; +} + +@end \ No newline at end of file diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m index 2b497da2dcb..e8d9e62a48c 100644 --- a/platform/ios/app/MBXViewController.m +++ b/platform/ios/app/MBXViewController.m @@ -417,6 +417,8 @@ - (void)testRuntimeStyling { MGLFillStyleLayer *waterLayer = (MGLFillStyleLayer *)[self.mapView.style layerWithIdentifier:@"water"]; waterLayer.fillColor = [UIColor redColor]; + waterLayer.fillOpacity = 0.4; + [waterLayer updateStyleAndClasses]; } - (IBAction)handleLongPress:(UILongPressGestureRecognizer *)longPress diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj index c08ef88e33b..0f0a8210428 100644 --- a/platform/ios/ios.xcodeproj/project.pbxproj +++ b/platform/ios/ios.xcodeproj/project.pbxproj @@ -7,6 +7,16 @@ objects = { /* Begin PBXBuildFile section */ + 35136D391D42271A00C20EFD /* MGLBackgroundStyleLayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35136D381D42271A00C20EFD /* MGLBackgroundStyleLayer.mm */; }; + 35136D3A1D42271A00C20EFD /* MGLBackgroundStyleLayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35136D381D42271A00C20EFD /* MGLBackgroundStyleLayer.mm */; }; + 35136D3C1D42272500C20EFD /* MGLCircleStyleLayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35136D3B1D42272500C20EFD /* MGLCircleStyleLayer.mm */; }; + 35136D3D1D42272500C20EFD /* MGLCircleStyleLayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35136D3B1D42272500C20EFD /* MGLCircleStyleLayer.mm */; }; + 35136D3F1D42273000C20EFD /* MGLLineStyleLayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35136D3E1D42273000C20EFD /* MGLLineStyleLayer.mm */; }; + 35136D401D42273000C20EFD /* MGLLineStyleLayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35136D3E1D42273000C20EFD /* MGLLineStyleLayer.mm */; }; + 35136D421D42274500C20EFD /* MGLRasterStyleLayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35136D411D42274500C20EFD /* MGLRasterStyleLayer.mm */; }; + 35136D431D42274500C20EFD /* MGLRasterStyleLayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35136D411D42274500C20EFD /* MGLRasterStyleLayer.mm */; }; + 35136D451D42275100C20EFD /* MGLSymbolStyleLayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35136D441D42275100C20EFD /* MGLSymbolStyleLayer.mm */; }; + 35136D461D42275100C20EFD /* MGLSymbolStyleLayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35136D441D42275100C20EFD /* MGLSymbolStyleLayer.mm */; }; 35305D481D22AA680007D005 /* NSData+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35305D471D22AA450007D005 /* NSData+MGLAdditions.mm */; }; 35305D491D22AA680007D005 /* NSData+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35305D471D22AA450007D005 /* NSData+MGLAdditions.mm */; }; 35305D4A1D22AA6A0007D005 /* NSData+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 35305D461D22AA450007D005 /* NSData+MGLAdditions.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -360,6 +370,11 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 35136D381D42271A00C20EFD /* MGLBackgroundStyleLayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLBackgroundStyleLayer.mm; sourceTree = ""; }; + 35136D3B1D42272500C20EFD /* MGLCircleStyleLayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLCircleStyleLayer.mm; sourceTree = ""; }; + 35136D3E1D42273000C20EFD /* MGLLineStyleLayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLLineStyleLayer.mm; sourceTree = ""; }; + 35136D411D42274500C20EFD /* MGLRasterStyleLayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLRasterStyleLayer.mm; sourceTree = ""; }; + 35136D441D42275100C20EFD /* MGLSymbolStyleLayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLSymbolStyleLayer.mm; sourceTree = ""; }; 35305D461D22AA450007D005 /* NSData+MGLAdditions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSData+MGLAdditions.h"; sourceTree = ""; }; 35305D471D22AA450007D005 /* NSData+MGLAdditions.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSData+MGLAdditions.mm"; sourceTree = ""; }; 353933F11D3FB753003F57D7 /* MGLCircleStyleLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLCircleStyleLayer.h; sourceTree = ""; }; @@ -606,15 +621,20 @@ isa = PBXGroup; children = ( 353933F41D3FB785003F57D7 /* MGLBackgroundStyleLayer.h */, + 35136D381D42271A00C20EFD /* MGLBackgroundStyleLayer.mm */, 353933F11D3FB753003F57D7 /* MGLCircleStyleLayer.h */, + 35136D3B1D42272500C20EFD /* MGLCircleStyleLayer.mm */, 35D13AC11D3D19DD00AFB4E0 /* MGLFillStyleLayer.h */, 35D13AC21D3D19DD00AFB4E0 /* MGLFillStyleLayer.mm */, 353933F71D3FB79F003F57D7 /* MGLLineStyleLayer.h */, + 35136D3E1D42273000C20EFD /* MGLLineStyleLayer.mm */, 353933FA1D3FB7C0003F57D7 /* MGLRasterStyleLayer.h */, + 35136D411D42274500C20EFD /* MGLRasterStyleLayer.mm */, + 35E79F1F1D41266300957B9E /* MGLStyleLayer_Private.hpp */, 35D13AB51D3D15E300AFB4E0 /* MGLStyleLayer.h */, 35D13AB61D3D15E300AFB4E0 /* MGLStyleLayer.mm */, 353933FD1D3FB7DD003F57D7 /* MGLSymbolStyleLayer.h */, - 35E79F1F1D41266300957B9E /* MGLStyleLayer_Private.hpp */, + 35136D441D42275100C20EFD /* MGLSymbolStyleLayer.mm */, ); name = Layers; sourceTree = ""; @@ -1475,17 +1495,21 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 35136D391D42271A00C20EFD /* MGLBackgroundStyleLayer.mm in Sources */, DA88485D1CBAFB9800AB86E3 /* MGLUserLocationAnnotationView.m in Sources */, DAD165701CF41981001FF4B9 /* MGLFeature.mm in Sources */, 40EDA1C11CFE0E0500D9EA68 /* MGLAnnotationContainerView.m in Sources */, DA8848541CBAFB9800AB86E3 /* MGLCompactCalloutView.m in Sources */, DA8848251CBAFA6200AB86E3 /* MGLPointAnnotation.m in Sources */, + 35136D3C1D42272500C20EFD /* MGLCircleStyleLayer.mm in Sources */, + 35136D421D42274500C20EFD /* MGLRasterStyleLayer.mm in Sources */, DA88482D1CBAFA6200AB86E3 /* NSBundle+MGLAdditions.m in Sources */, DA88485B1CBAFB9800AB86E3 /* MGLUserLocation.m in Sources */, DA88488C1CBB037E00AB86E3 /* SMCalloutView.m in Sources */, DA35A2B81CCA9A5D00E826B2 /* MGLClockDirectionFormatter.m in Sources */, DAD1657A1CF4CDFF001FF4B9 /* MGLShapeCollection.m in Sources */, DA8848901CBB048E00AB86E3 /* reachability.m in Sources */, + 35136D451D42275100C20EFD /* MGLSymbolStyleLayer.mm in Sources */, DA8848211CBAFA6200AB86E3 /* MGLOfflinePack.mm in Sources */, DA8848591CBAFB9800AB86E3 /* MGLMapView.mm in Sources */, DA8848501CBAFB9800AB86E3 /* MGLAnnotationImage.m in Sources */, @@ -1508,6 +1532,7 @@ 35D13AC51D3D19DD00AFB4E0 /* MGLFillStyleLayer.mm in Sources */, DA8848241CBAFA6200AB86E3 /* MGLOfflineStorage.mm in Sources */, DA88482A1CBAFA6200AB86E3 /* MGLTilePyramidOfflineRegion.mm in Sources */, + 35136D3F1D42273000C20EFD /* MGLLineStyleLayer.mm in Sources */, DA88481A1CBAFA6200AB86E3 /* MGLAccountManager.m in Sources */, DA8848271CBAFA6200AB86E3 /* MGLPolyline.mm in Sources */, DA8848581CBAFB9800AB86E3 /* MGLMapboxEvents.m in Sources */, @@ -1520,17 +1545,21 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 35136D3A1D42271A00C20EFD /* MGLBackgroundStyleLayer.mm in Sources */, DAA4E4221CBB730400178DFB /* MGLPointAnnotation.m in Sources */, DAD165711CF41981001FF4B9 /* MGLFeature.mm in Sources */, 40EDA1C21CFE0E0500D9EA68 /* MGLAnnotationContainerView.m in Sources */, DAA4E4291CBB730400178DFB /* NSBundle+MGLAdditions.m in Sources */, DAA4E42E1CBB730400178DFB /* MGLAPIClient.m in Sources */, + 35136D3D1D42272500C20EFD /* MGLCircleStyleLayer.mm in Sources */, + 35136D431D42274500C20EFD /* MGLRasterStyleLayer.mm in Sources */, DAA4E4201CBB730400178DFB /* MGLOfflinePack.mm in Sources */, DAA4E4331CBB730400178DFB /* MGLUserLocation.m in Sources */, DAA4E4351CBB730400178DFB /* SMCalloutView.m in Sources */, DA35A2B91CCA9A5D00E826B2 /* MGLClockDirectionFormatter.m in Sources */, DAD1657B1CF4CDFF001FF4B9 /* MGLShapeCollection.m in Sources */, DAA4E4251CBB730400178DFB /* MGLShape.m in Sources */, + 35136D461D42275100C20EFD /* MGLSymbolStyleLayer.mm in Sources */, DAA4E42B1CBB730400178DFB /* NSString+MGLAdditions.m in Sources */, DAA4E4261CBB730400178DFB /* MGLStyle.mm in Sources */, DAA4E41D1CBB730400178DFB /* MGLGeometry.mm in Sources */, @@ -1553,6 +1582,7 @@ 35D13AC61D3D19DD00AFB4E0 /* MGLFillStyleLayer.mm in Sources */, DAA4E42A1CBB730400178DFB /* NSProcessInfo+MGLAdditions.m in Sources */, DAA4E4211CBB730400178DFB /* MGLOfflineStorage.mm in Sources */, + 35136D401D42273000C20EFD /* MGLLineStyleLayer.mm in Sources */, DAA4E42F1CBB730400178DFB /* MGLCompactCalloutView.m in Sources */, DAA4E4271CBB730400178DFB /* MGLTilePyramidOfflineRegion.mm in Sources */, DAA4E41C1CBB730400178DFB /* MGLAccountManager.m in Sources */, diff --git a/platform/ios/scripts/generate-style-code.js b/platform/ios/scripts/generate-style-code.js index e638e419d98..7185f43a4cd 100644 --- a/platform/ios/scripts/generate-style-code.js +++ b/platform/ios/scripts/generate-style-code.js @@ -51,6 +51,7 @@ global.propertyType = function (property, layerType = null) { } 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 layers = spec.layer.type.values.map((type) => { const layoutProperties = Object.keys(spec[`layout_${type}`]).reduce((memo, name) => { @@ -76,4 +77,5 @@ const layers = spec.layer.type.values.map((type) => { for (const layer of layers) { fs.writeFileSync(`platform/darwin/src/${prefix}${camelize(layer.type)}${suffix}.h`, layerH(layer)); + fs.writeFileSync(`platform/darwin/src/${prefix}${camelize(layer.type)}${suffix}.mm`, layerM(layer)); } \ No newline at end of file diff --git a/platform/ios/src/UIColor+MGLAdditions.hpp b/platform/ios/src/UIColor+MGLAdditions.hpp index 936749bbb25..e60a1272a31 100644 --- a/platform/ios/src/UIColor+MGLAdditions.hpp +++ b/platform/ios/src/UIColor+MGLAdditions.hpp @@ -6,4 +6,6 @@ - (mbgl::Color)mbgl_color; ++ (UIColor *)mbgl_color:(mbgl::Color)color; + @end diff --git a/platform/ios/src/UIColor+MGLAdditions.mm b/platform/ios/src/UIColor+MGLAdditions.mm index 5feaa2fb3d5..1d08d128bdf 100644 --- a/platform/ios/src/UIColor+MGLAdditions.mm +++ b/platform/ios/src/UIColor+MGLAdditions.mm @@ -14,4 +14,9 @@ @implementation UIColor (MGLAdditions) return { (float)r, (float)g, (float)b, (float)a }; } ++ (UIColor *)mbgl_color:(mbgl::Color)color +{ + return [UIColor colorWithRed:color.r green:color.g blue:color.b alpha:color.a]; +} + @end diff --git a/platform/macos/app/MapDocument.m b/platform/macos/app/MapDocument.m index 585a204c7bd..ec82a8b7fc9 100644 --- a/platform/macos/app/MapDocument.m +++ b/platform/macos/app/MapDocument.m @@ -479,6 +479,7 @@ - (void)handlePressGesture:(NSPressGestureRecognizer *)gestureRecognizer { - (IBAction)runtimeStyling:(id)sender { MGLFillStyleLayer *fillStyleLayer = (MGLFillStyleLayer *)[self.mapView.style layerWithIdentifier:@"water"]; fillStyleLayer.fillColor = [NSColor redColor]; + [fillStyleLayer updateStyleAndClasses]; } - (IBAction)dropPin:(NSMenuItem *)sender { diff --git a/platform/macos/macos.xcodeproj/project.pbxproj b/platform/macos/macos.xcodeproj/project.pbxproj index ebce069bc00..308f00c648f 100644 --- a/platform/macos/macos.xcodeproj/project.pbxproj +++ b/platform/macos/macos.xcodeproj/project.pbxproj @@ -312,6 +312,18 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 35136D471D42295400C20EFD /* Layers */ = { + isa = PBXGroup; + children = ( + 35602BFC1D3EA9B40050646F /* MGLStyleLayer_Private.hpp */, + 35602BFD1D3EA9B40050646F /* MGLStyleLayer.h */, + 35602BFE1D3EA9B40050646F /* MGLStyleLayer.mm */, + 35602BF81D3EA99F0050646F /* MGLFillStyleLayer.h */, + 35602BF91D3EA99F0050646F /* MGLFillStyleLayer.mm */, + ); + name = Layers; + sourceTree = ""; + }; DA839E891CC2E3400062CAFB = { isa = PBXGroup; children = ( @@ -510,6 +522,7 @@ DAE6C3491CC31DF500DB3429 /* Foundation */ = { isa = PBXGroup; children = ( + 35136D471D42295400C20EFD /* Layers */, DAD1657F1CF4CF50001FF4B9 /* Categories */, DAD1657C1CF4CE6B001FF4B9 /* Formatters */, DAD1657D1CF4CECB001FF4B9 /* Geometry */, @@ -522,11 +535,6 @@ 3537CA731D3F93A600380318 /* MGLStyle_Private.hpp */, DAE6C3571CC31E0400DB3429 /* MGLStyle.h */, DAE6C37A1CC31E2A00DB3429 /* MGLStyle.mm */, - 35602BFC1D3EA9B40050646F /* MGLStyleLayer_Private.hpp */, - 35602BFD1D3EA9B40050646F /* MGLStyleLayer.h */, - 35602BFE1D3EA9B40050646F /* MGLStyleLayer.mm */, - 35602BF81D3EA99F0050646F /* MGLFillStyleLayer.h */, - 35602BF91D3EA99F0050646F /* MGLFillStyleLayer.mm */, DAE6C3591CC31E0400DB3429 /* MGLTypes.h */, DAE6C37C1CC31E2A00DB3429 /* MGLTypes.m */, ); diff --git a/platform/macos/src/NSColor+MGLAdditions.hpp b/platform/macos/src/NSColor+MGLAdditions.hpp index bfc8805a82b..75183039e9c 100644 --- a/platform/macos/src/NSColor+MGLAdditions.hpp +++ b/platform/macos/src/NSColor+MGLAdditions.hpp @@ -6,4 +6,6 @@ - (mbgl::Color)mbgl_color; ++ (NSColor *)mbgl_color:(mbgl::Color)color; + @end diff --git a/platform/macos/src/NSColor+MGLAdditions.mm b/platform/macos/src/NSColor+MGLAdditions.mm index 503357e7d91..df3abf21c1a 100644 --- a/platform/macos/src/NSColor+MGLAdditions.mm +++ b/platform/macos/src/NSColor+MGLAdditions.mm @@ -15,5 +15,9 @@ @implementation NSColor (MGLAdditions) return { (float)r, (float)g, (float)b, (float)a }; } ++ (NSColor *)mbgl_color:(mbgl::Color)color +{ + return [NSColor colorWithRed:color.r green:color.g blue:color.b alpha:color.a]; +} @end