diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2016-09-25 12:37:45 -0700 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2016-10-17 11:47:22 -0700 |
commit | 9652028915af6602626939e0b0075333c34bfbfe (patch) | |
tree | 0b299507c1339dcb1f947a496dcd375095f9bc4b /platform/darwin/src/MGLSymbolStyleLayer.mm | |
parent | 0c8a3feffa94a9594bcaa77fdc18d11a3c482ff5 (diff) | |
download | qtlocation-mapboxgl-9652028915af6602626939e0b0075333c34bfbfe.tar.gz |
[ios, macos] Expand changes to entire API
Diffstat (limited to 'platform/darwin/src/MGLSymbolStyleLayer.mm')
-rw-r--r-- | platform/darwin/src/MGLSymbolStyleLayer.mm | 482 |
1 files changed, 289 insertions, 193 deletions
diff --git a/platform/darwin/src/MGLSymbolStyleLayer.mm b/platform/darwin/src/MGLSymbolStyleLayer.mm index 01ac10f66f..a4c56fe297 100644 --- a/platform/darwin/src/MGLSymbolStyleLayer.mm +++ b/platform/darwin/src/MGLSymbolStyleLayer.mm @@ -4,7 +4,7 @@ #import "MGLSource.h" #import "NSPredicate+MGLAdditions.h" #import "MGLStyleLayer_Private.h" -#import "MGLStyleAttributeValue.h" +#import "MGLStyleValue_Private.h" #import "MGLSymbolStyleLayer.h" #include <mbgl/style/layers/symbol_layer.hpp> @@ -48,390 +48,486 @@ #pragma mark - Accessing the Layout Attributes -- (void)setSymbolPlacement:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)symbolPlacement { - MGLSetEnumProperty(symbolPlacement, SymbolPlacement, SymbolPlacementType, MGLSymbolPlacement); +- (void)setSymbolPlacement:(MGLStyleValue<NSValue *> *)symbolPlacement { + auto mbglValue = MGLStyleValueTransformer<mbgl::style::SymbolPlacementType, NSValue *>().toPropertyValue(symbolPlacement); + self.layer->setSymbolPlacement(mbglValue); } -- (id <MGLStyleAttributeValue>)symbolPlacement { - MGLGetEnumProperty(SymbolPlacement, SymbolPlacementType, MGLSymbolPlacement); +- (MGLStyleValue<NSValue *> *)symbolPlacement { + auto propertyValue = self.layer->getSymbolPlacement() ?: self.layer->getDefaultSymbolPlacement(); + return MGLStyleValueTransformer<mbgl::style::SymbolPlacementType, NSValue *>().toStyleValue(propertyValue); } -- (void)setSymbolSpacing:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)symbolSpacing { - self.layer->setSymbolSpacing(symbolSpacing.mbgl_floatPropertyValue); +- (void)setSymbolSpacing:(MGLStyleValue<NSNumber *> *)symbolSpacing { + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(symbolSpacing); + self.layer->setSymbolSpacing(mbglValue); } -- (id <MGLStyleAttributeValue>)symbolSpacing { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getSymbolSpacing() ?: self.layer->getDefaultSymbolSpacing()]; +- (MGLStyleValue<NSNumber *> *)symbolSpacing { + auto propertyValue = self.layer->getSymbolSpacing() ?: self.layer->getDefaultSymbolSpacing(); + return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue); } -- (void)setSymbolAvoidEdges:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)symbolAvoidEdges { - self.layer->setSymbolAvoidEdges(symbolAvoidEdges.mbgl_boolPropertyValue); +- (void)setSymbolAvoidEdges:(MGLStyleValue<NSNumber *> *)symbolAvoidEdges { + auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue(symbolAvoidEdges); + self.layer->setSymbolAvoidEdges(mbglValue); } -- (id <MGLStyleAttributeValue>)symbolAvoidEdges { - return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getSymbolAvoidEdges() ?: self.layer->getDefaultSymbolAvoidEdges()]; +- (MGLStyleValue<NSNumber *> *)symbolAvoidEdges { + auto propertyValue = self.layer->getSymbolAvoidEdges() ?: self.layer->getDefaultSymbolAvoidEdges(); + return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue); } -- (void)setIconAllowOverlap:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconAllowOverlap { - self.layer->setIconAllowOverlap(iconAllowOverlap.mbgl_boolPropertyValue); +- (void)setIconAllowOverlap:(MGLStyleValue<NSNumber *> *)iconAllowOverlap { + auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue(iconAllowOverlap); + self.layer->setIconAllowOverlap(mbglValue); } -- (id <MGLStyleAttributeValue>)iconAllowOverlap { - return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getIconAllowOverlap() ?: self.layer->getDefaultIconAllowOverlap()]; +- (MGLStyleValue<NSNumber *> *)iconAllowOverlap { + auto propertyValue = self.layer->getIconAllowOverlap() ?: self.layer->getDefaultIconAllowOverlap(); + return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue); } -- (void)setIconIgnorePlacement:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconIgnorePlacement { - self.layer->setIconIgnorePlacement(iconIgnorePlacement.mbgl_boolPropertyValue); +- (void)setIconIgnorePlacement:(MGLStyleValue<NSNumber *> *)iconIgnorePlacement { + auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue(iconIgnorePlacement); + self.layer->setIconIgnorePlacement(mbglValue); } -- (id <MGLStyleAttributeValue>)iconIgnorePlacement { - return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getIconIgnorePlacement() ?: self.layer->getDefaultIconIgnorePlacement()]; +- (MGLStyleValue<NSNumber *> *)iconIgnorePlacement { + auto propertyValue = self.layer->getIconIgnorePlacement() ?: self.layer->getDefaultIconIgnorePlacement(); + return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue); } -- (void)setIconOptional:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconOptional { - self.layer->setIconOptional(iconOptional.mbgl_boolPropertyValue); +- (void)setIconOptional:(MGLStyleValue<NSNumber *> *)iconOptional { + auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue(iconOptional); + self.layer->setIconOptional(mbglValue); } -- (id <MGLStyleAttributeValue>)iconOptional { - return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getIconOptional() ?: self.layer->getDefaultIconOptional()]; +- (MGLStyleValue<NSNumber *> *)iconOptional { + auto propertyValue = self.layer->getIconOptional() ?: self.layer->getDefaultIconOptional(); + return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue); } -- (void)setIconRotationAlignment:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconRotationAlignment { - MGLSetEnumProperty(iconRotationAlignment, IconRotationAlignment, AlignmentType, MGLIconRotationAlignment); +- (void)setIconRotationAlignment:(MGLStyleValue<NSValue *> *)iconRotationAlignment { + auto mbglValue = MGLStyleValueTransformer<mbgl::style::AlignmentType, NSValue *>().toPropertyValue(iconRotationAlignment); + self.layer->setIconRotationAlignment(mbglValue); } -- (id <MGLStyleAttributeValue>)iconRotationAlignment { - MGLGetEnumProperty(IconRotationAlignment, AlignmentType, MGLIconRotationAlignment); +- (MGLStyleValue<NSValue *> *)iconRotationAlignment { + auto propertyValue = self.layer->getIconRotationAlignment() ?: self.layer->getDefaultIconRotationAlignment(); + return MGLStyleValueTransformer<mbgl::style::AlignmentType, NSValue *>().toStyleValue(propertyValue); } -- (void)setIconSize:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconSize { - self.layer->setIconSize(iconSize.mbgl_floatPropertyValue); +- (void)setIconSize:(MGLStyleValue<NSNumber *> *)iconSize { + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(iconSize); + self.layer->setIconSize(mbglValue); } -- (id <MGLStyleAttributeValue>)iconSize { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getIconSize() ?: self.layer->getDefaultIconSize()]; +- (MGLStyleValue<NSNumber *> *)iconSize { + auto propertyValue = self.layer->getIconSize() ?: self.layer->getDefaultIconSize(); + return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue); } -- (void)setIconTextFit:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconTextFit { - MGLSetEnumProperty(iconTextFit, IconTextFit, IconTextFitType, MGLIconTextFit); +- (void)setIconTextFit:(MGLStyleValue<NSValue *> *)iconTextFit { + auto mbglValue = MGLStyleValueTransformer<mbgl::style::IconTextFitType, NSValue *>().toPropertyValue(iconTextFit); + self.layer->setIconTextFit(mbglValue); } -- (id <MGLStyleAttributeValue>)iconTextFit { - MGLGetEnumProperty(IconTextFit, IconTextFitType, MGLIconTextFit); +- (MGLStyleValue<NSValue *> *)iconTextFit { + auto propertyValue = self.layer->getIconTextFit() ?: self.layer->getDefaultIconTextFit(); + return MGLStyleValueTransformer<mbgl::style::IconTextFitType, NSValue *>().toStyleValue(propertyValue); } -- (void)setIconTextFitPadding:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconTextFitPadding { - self.layer->setIconTextFitPadding(iconTextFitPadding.mbgl_paddingPropertyValue); +- (void)setIconTextFitPadding:(MGLStyleValue<NSValue *> *)iconTextFitPadding { + auto mbglValue = MGLStyleValueTransformer<std::array<float, 4>, NSValue *>().toPropertyValue(iconTextFitPadding); + self.layer->setIconTextFitPadding(mbglValue); } -- (id <MGLStyleAttributeValue>)iconTextFitPadding { - return [MGLStyleAttribute mbgl_paddingWithPropertyValuePadding:self.layer->getIconTextFitPadding() ?: self.layer->getDefaultIconTextFitPadding()]; +- (MGLStyleValue<NSValue *> *)iconTextFitPadding { + auto propertyValue = self.layer->getIconTextFitPadding() ?: self.layer->getDefaultIconTextFitPadding(); + return MGLStyleValueTransformer<std::array<float, 4>, NSValue *>().toStyleValue(propertyValue); } -- (void)setIconImage:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconImage { - self.layer->setIconImage(iconImage.mbgl_stringPropertyValue); +- (void)setIconImage:(MGLStyleValue<NSString *> *)iconImage { + auto mbglValue = MGLStyleValueTransformer<std::string, NSString *>().toPropertyValue(iconImage); + self.layer->setIconImage(mbglValue); } -- (id <MGLStyleAttributeValue>)iconImage { - return [MGLStyleAttribute mbgl_stringWithPropertyValueString:self.layer->getIconImage() ?: self.layer->getDefaultIconImage()]; +- (MGLStyleValue<NSString *> *)iconImage { + auto propertyValue = self.layer->getIconImage() ?: self.layer->getDefaultIconImage(); + return MGLStyleValueTransformer<std::string, NSString *>().toStyleValue(propertyValue); } -- (void)setIconRotate:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconRotate { - self.layer->setIconRotate(iconRotate.mbgl_floatPropertyValue); +- (void)setIconRotate:(MGLStyleValue<NSNumber *> *)iconRotate { + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(iconRotate); + self.layer->setIconRotate(mbglValue); } -- (id <MGLStyleAttributeValue>)iconRotate { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getIconRotate() ?: self.layer->getDefaultIconRotate()]; +- (MGLStyleValue<NSNumber *> *)iconRotate { + auto propertyValue = self.layer->getIconRotate() ?: self.layer->getDefaultIconRotate(); + return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue); } -- (void)setIconPadding:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconPadding { - self.layer->setIconPadding(iconPadding.mbgl_floatPropertyValue); +- (void)setIconPadding:(MGLStyleValue<NSNumber *> *)iconPadding { + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(iconPadding); + self.layer->setIconPadding(mbglValue); } -- (id <MGLStyleAttributeValue>)iconPadding { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getIconPadding() ?: self.layer->getDefaultIconPadding()]; +- (MGLStyleValue<NSNumber *> *)iconPadding { + auto propertyValue = self.layer->getIconPadding() ?: self.layer->getDefaultIconPadding(); + return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue); } -- (void)setIconKeepUpright:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconKeepUpright { - self.layer->setIconKeepUpright(iconKeepUpright.mbgl_boolPropertyValue); +- (void)setIconKeepUpright:(MGLStyleValue<NSNumber *> *)iconKeepUpright { + auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue(iconKeepUpright); + self.layer->setIconKeepUpright(mbglValue); } -- (id <MGLStyleAttributeValue>)iconKeepUpright { - return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getIconKeepUpright() ?: self.layer->getDefaultIconKeepUpright()]; +- (MGLStyleValue<NSNumber *> *)iconKeepUpright { + auto propertyValue = self.layer->getIconKeepUpright() ?: self.layer->getDefaultIconKeepUpright(); + return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue); } -- (void)setIconOffset:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconOffset { - self.layer->setIconOffset(iconOffset.mbgl_offsetPropertyValue); +- (void)setIconOffset:(MGLStyleValue<NSValue *> *)iconOffset { + auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue(iconOffset); + self.layer->setIconOffset(mbglValue); } -- (id <MGLStyleAttributeValue>)iconOffset { - return [MGLStyleAttribute mbgl_offsetWithPropertyValueOffset:self.layer->getIconOffset() ?: self.layer->getDefaultIconOffset()]; +- (MGLStyleValue<NSValue *> *)iconOffset { + auto propertyValue = self.layer->getIconOffset() ?: self.layer->getDefaultIconOffset(); + return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue); } -- (void)setTextPitchAlignment:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textPitchAlignment { - MGLSetEnumProperty(textPitchAlignment, TextPitchAlignment, AlignmentType, MGLTextPitchAlignment); +- (void)setTextPitchAlignment:(MGLStyleValue<NSValue *> *)textPitchAlignment { + auto mbglValue = MGLStyleValueTransformer<mbgl::style::AlignmentType, NSValue *>().toPropertyValue(textPitchAlignment); + self.layer->setTextPitchAlignment(mbglValue); } -- (id <MGLStyleAttributeValue>)textPitchAlignment { - MGLGetEnumProperty(TextPitchAlignment, AlignmentType, MGLTextPitchAlignment); +- (MGLStyleValue<NSValue *> *)textPitchAlignment { + auto propertyValue = self.layer->getTextPitchAlignment() ?: self.layer->getDefaultTextPitchAlignment(); + return MGLStyleValueTransformer<mbgl::style::AlignmentType, NSValue *>().toStyleValue(propertyValue); } -- (void)setTextRotationAlignment:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textRotationAlignment { - MGLSetEnumProperty(textRotationAlignment, TextRotationAlignment, AlignmentType, MGLTextRotationAlignment); +- (void)setTextRotationAlignment:(MGLStyleValue<NSValue *> *)textRotationAlignment { + auto mbglValue = MGLStyleValueTransformer<mbgl::style::AlignmentType, NSValue *>().toPropertyValue(textRotationAlignment); + self.layer->setTextRotationAlignment(mbglValue); } -- (id <MGLStyleAttributeValue>)textRotationAlignment { - MGLGetEnumProperty(TextRotationAlignment, AlignmentType, MGLTextRotationAlignment); +- (MGLStyleValue<NSValue *> *)textRotationAlignment { + auto propertyValue = self.layer->getTextRotationAlignment() ?: self.layer->getDefaultTextRotationAlignment(); + return MGLStyleValueTransformer<mbgl::style::AlignmentType, NSValue *>().toStyleValue(propertyValue); } -- (void)setTextField:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textField { - self.layer->setTextField(textField.mbgl_stringPropertyValue); +- (void)setTextField:(MGLStyleValue<NSString *> *)textField { + auto mbglValue = MGLStyleValueTransformer<std::string, NSString *>().toPropertyValue(textField); + self.layer->setTextField(mbglValue); } -- (id <MGLStyleAttributeValue>)textField { - return [MGLStyleAttribute mbgl_stringWithPropertyValueString:self.layer->getTextField() ?: self.layer->getDefaultTextField()]; +- (MGLStyleValue<NSString *> *)textField { + auto propertyValue = self.layer->getTextField() ?: self.layer->getDefaultTextField(); + return MGLStyleValueTransformer<std::string, NSString *>().toStyleValue(propertyValue); } -- (void)setTextFont:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textFont { - self.layer->setTextFont(textFont.mbgl_stringArrayPropertyValue); +- (void)setTextFont:(MGLStyleValue<NSArray<NSString *> *> *)textFont { + auto mbglValue = MGLStyleValueTransformer<std::vector<std::string>, NSArray<NSString *> *, std::string>().toPropertyValue(textFont); + self.layer->setTextFont(mbglValue); } -- (id <MGLStyleAttributeValue>)textFont { - return [MGLStyleAttribute mbgl_stringArrayWithPropertyValueStringArray:self.layer->getTextFont() ?: self.layer->getDefaultTextFont()]; +- (MGLStyleValue<NSArray<NSString *> *> *)textFont { + auto propertyValue = self.layer->getTextFont() ?: self.layer->getDefaultTextFont(); + return MGLStyleValueTransformer<std::vector<std::string>, NSArray<NSString *> *, std::string>().toStyleValue(propertyValue); } -- (void)setTextSize:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textSize { - self.layer->setTextSize(textSize.mbgl_floatPropertyValue); +- (void)setTextSize:(MGLStyleValue<NSNumber *> *)textSize { + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(textSize); + self.layer->setTextSize(mbglValue); } -- (id <MGLStyleAttributeValue>)textSize { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextSize() ?: self.layer->getDefaultTextSize()]; +- (MGLStyleValue<NSNumber *> *)textSize { + auto propertyValue = self.layer->getTextSize() ?: self.layer->getDefaultTextSize(); + return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue); } -- (void)setTextMaxWidth:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textMaxWidth { - self.layer->setTextMaxWidth(textMaxWidth.mbgl_floatPropertyValue); +- (void)setTextMaxWidth:(MGLStyleValue<NSNumber *> *)textMaxWidth { + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(textMaxWidth); + self.layer->setTextMaxWidth(mbglValue); } -- (id <MGLStyleAttributeValue>)textMaxWidth { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextMaxWidth() ?: self.layer->getDefaultTextMaxWidth()]; +- (MGLStyleValue<NSNumber *> *)textMaxWidth { + auto propertyValue = self.layer->getTextMaxWidth() ?: self.layer->getDefaultTextMaxWidth(); + return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue); } -- (void)setTextLineHeight:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textLineHeight { - self.layer->setTextLineHeight(textLineHeight.mbgl_floatPropertyValue); +- (void)setTextLineHeight:(MGLStyleValue<NSNumber *> *)textLineHeight { + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(textLineHeight); + self.layer->setTextLineHeight(mbglValue); } -- (id <MGLStyleAttributeValue>)textLineHeight { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextLineHeight() ?: self.layer->getDefaultTextLineHeight()]; +- (MGLStyleValue<NSNumber *> *)textLineHeight { + auto propertyValue = self.layer->getTextLineHeight() ?: self.layer->getDefaultTextLineHeight(); + return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue); } -- (void)setTextLetterSpacing:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textLetterSpacing { - self.layer->setTextLetterSpacing(textLetterSpacing.mbgl_floatPropertyValue); +- (void)setTextLetterSpacing:(MGLStyleValue<NSNumber *> *)textLetterSpacing { + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(textLetterSpacing); + self.layer->setTextLetterSpacing(mbglValue); } -- (id <MGLStyleAttributeValue>)textLetterSpacing { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextLetterSpacing() ?: self.layer->getDefaultTextLetterSpacing()]; +- (MGLStyleValue<NSNumber *> *)textLetterSpacing { + auto propertyValue = self.layer->getTextLetterSpacing() ?: self.layer->getDefaultTextLetterSpacing(); + return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue); } -- (void)setTextJustify:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textJustify { - MGLSetEnumProperty(textJustify, TextJustify, TextJustifyType, MGLTextJustify); +- (void)setTextJustify:(MGLStyleValue<NSValue *> *)textJustify { + auto mbglValue = MGLStyleValueTransformer<mbgl::style::TextJustifyType, NSValue *>().toPropertyValue(textJustify); + self.layer->setTextJustify(mbglValue); } -- (id <MGLStyleAttributeValue>)textJustify { - MGLGetEnumProperty(TextJustify, TextJustifyType, MGLTextJustify); +- (MGLStyleValue<NSValue *> *)textJustify { + auto propertyValue = self.layer->getTextJustify() ?: self.layer->getDefaultTextJustify(); + return MGLStyleValueTransformer<mbgl::style::TextJustifyType, NSValue *>().toStyleValue(propertyValue); } -- (void)setTextAnchor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textAnchor { - MGLSetEnumProperty(textAnchor, TextAnchor, TextAnchorType, MGLTextAnchor); +- (void)setTextAnchor:(MGLStyleValue<NSValue *> *)textAnchor { + auto mbglValue = MGLStyleValueTransformer<mbgl::style::TextAnchorType, NSValue *>().toPropertyValue(textAnchor); + self.layer->setTextAnchor(mbglValue); } -- (id <MGLStyleAttributeValue>)textAnchor { - MGLGetEnumProperty(TextAnchor, TextAnchorType, MGLTextAnchor); +- (MGLStyleValue<NSValue *> *)textAnchor { + auto propertyValue = self.layer->getTextAnchor() ?: self.layer->getDefaultTextAnchor(); + return MGLStyleValueTransformer<mbgl::style::TextAnchorType, NSValue *>().toStyleValue(propertyValue); } -- (void)setTextMaxAngle:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textMaxAngle { - self.layer->setTextMaxAngle(textMaxAngle.mbgl_floatPropertyValue); +- (void)setTextMaxAngle:(MGLStyleValue<NSNumber *> *)textMaxAngle { + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(textMaxAngle); + self.layer->setTextMaxAngle(mbglValue); } -- (id <MGLStyleAttributeValue>)textMaxAngle { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextMaxAngle() ?: self.layer->getDefaultTextMaxAngle()]; +- (MGLStyleValue<NSNumber *> *)textMaxAngle { + auto propertyValue = self.layer->getTextMaxAngle() ?: self.layer->getDefaultTextMaxAngle(); + return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue); } -- (void)setTextRotate:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textRotate { - self.layer->setTextRotate(textRotate.mbgl_floatPropertyValue); +- (void)setTextRotate:(MGLStyleValue<NSNumber *> *)textRotate { + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(textRotate); + self.layer->setTextRotate(mbglValue); } -- (id <MGLStyleAttributeValue>)textRotate { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextRotate() ?: self.layer->getDefaultTextRotate()]; +- (MGLStyleValue<NSNumber *> *)textRotate { + auto propertyValue = self.layer->getTextRotate() ?: self.layer->getDefaultTextRotate(); + return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue); } -- (void)setTextPadding:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textPadding { - self.layer->setTextPadding(textPadding.mbgl_floatPropertyValue); +- (void)setTextPadding:(MGLStyleValue<NSNumber *> *)textPadding { + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(textPadding); + self.layer->setTextPadding(mbglValue); } -- (id <MGLStyleAttributeValue>)textPadding { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextPadding() ?: self.layer->getDefaultTextPadding()]; +- (MGLStyleValue<NSNumber *> *)textPadding { + auto propertyValue = self.layer->getTextPadding() ?: self.layer->getDefaultTextPadding(); + return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue); } -- (void)setTextKeepUpright:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textKeepUpright { - self.layer->setTextKeepUpright(textKeepUpright.mbgl_boolPropertyValue); +- (void)setTextKeepUpright:(MGLStyleValue<NSNumber *> *)textKeepUpright { + auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue(textKeepUpright); + self.layer->setTextKeepUpright(mbglValue); } -- (id <MGLStyleAttributeValue>)textKeepUpright { - return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getTextKeepUpright() ?: self.layer->getDefaultTextKeepUpright()]; +- (MGLStyleValue<NSNumber *> *)textKeepUpright { + auto propertyValue = self.layer->getTextKeepUpright() ?: self.layer->getDefaultTextKeepUpright(); + return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue); } -- (void)setTextTransform:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textTransform { - MGLSetEnumProperty(textTransform, TextTransform, TextTransformType, MGLTextTransform); +- (void)setTextTransform:(MGLStyleValue<NSValue *> *)textTransform { + auto mbglValue = MGLStyleValueTransformer<mbgl::style::TextTransformType, NSValue *>().toPropertyValue(textTransform); + self.layer->setTextTransform(mbglValue); } -- (id <MGLStyleAttributeValue>)textTransform { - MGLGetEnumProperty(TextTransform, TextTransformType, MGLTextTransform); +- (MGLStyleValue<NSValue *> *)textTransform { + auto propertyValue = self.layer->getTextTransform() ?: self.layer->getDefaultTextTransform(); + return MGLStyleValueTransformer<mbgl::style::TextTransformType, NSValue *>().toStyleValue(propertyValue); } -- (void)setTextOffset:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textOffset { - self.layer->setTextOffset(textOffset.mbgl_offsetPropertyValue); +- (void)setTextOffset:(MGLStyleValue<NSValue *> *)textOffset { + auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue(textOffset); + self.layer->setTextOffset(mbglValue); } -- (id <MGLStyleAttributeValue>)textOffset { - return [MGLStyleAttribute mbgl_offsetWithPropertyValueOffset:self.layer->getTextOffset() ?: self.layer->getDefaultTextOffset()]; +- (MGLStyleValue<NSValue *> *)textOffset { + auto propertyValue = self.layer->getTextOffset() ?: self.layer->getDefaultTextOffset(); + return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue); } -- (void)setTextAllowOverlap:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textAllowOverlap { - self.layer->setTextAllowOverlap(textAllowOverlap.mbgl_boolPropertyValue); +- (void)setTextAllowOverlap:(MGLStyleValue<NSNumber *> *)textAllowOverlap { + auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue(textAllowOverlap); + self.layer->setTextAllowOverlap(mbglValue); } -- (id <MGLStyleAttributeValue>)textAllowOverlap { - return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getTextAllowOverlap() ?: self.layer->getDefaultTextAllowOverlap()]; +- (MGLStyleValue<NSNumber *> *)textAllowOverlap { + auto propertyValue = self.layer->getTextAllowOverlap() ?: self.layer->getDefaultTextAllowOverlap(); + return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue); } -- (void)setTextIgnorePlacement:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textIgnorePlacement { - self.layer->setTextIgnorePlacement(textIgnorePlacement.mbgl_boolPropertyValue); +- (void)setTextIgnorePlacement:(MGLStyleValue<NSNumber *> *)textIgnorePlacement { + auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue(textIgnorePlacement); + self.layer->setTextIgnorePlacement(mbglValue); } -- (id <MGLStyleAttributeValue>)textIgnorePlacement { - return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getTextIgnorePlacement() ?: self.layer->getDefaultTextIgnorePlacement()]; +- (MGLStyleValue<NSNumber *> *)textIgnorePlacement { + auto propertyValue = self.layer->getTextIgnorePlacement() ?: self.layer->getDefaultTextIgnorePlacement(); + return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue); } -- (void)setTextOptional:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textOptional { - self.layer->setTextOptional(textOptional.mbgl_boolPropertyValue); +- (void)setTextOptional:(MGLStyleValue<NSNumber *> *)textOptional { + auto mbglValue = MGLStyleValueTransformer<bool, NSNumber *>().toPropertyValue(textOptional); + self.layer->setTextOptional(mbglValue); } -- (id <MGLStyleAttributeValue>)textOptional { - return [MGLStyleAttribute mbgl_boolWithPropertyValueBool:self.layer->getTextOptional() ?: self.layer->getDefaultTextOptional()]; +- (MGLStyleValue<NSNumber *> *)textOptional { + auto propertyValue = self.layer->getTextOptional() ?: self.layer->getDefaultTextOptional(); + return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue); } #pragma mark - Accessing the Paint Attributes -- (void)setIconOpacity:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconOpacity { - self.layer->setIconOpacity(iconOpacity.mbgl_floatPropertyValue); +- (void)setIconOpacity:(MGLStyleValue<NSNumber *> *)iconOpacity { + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(iconOpacity); + self.layer->setIconOpacity(mbglValue); } -- (id <MGLStyleAttributeValue>)iconOpacity { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getIconOpacity() ?: self.layer->getDefaultIconOpacity()]; +- (MGLStyleValue<NSNumber *> *)iconOpacity { + auto propertyValue = self.layer->getIconOpacity() ?: self.layer->getDefaultIconOpacity(); + return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue); } -- (void)setIconColor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconColor { - self.layer->setIconColor(iconColor.mbgl_colorPropertyValue); +- (void)setIconColor:(MGLStyleValue<MGLColor *> *)iconColor { + auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue(iconColor); + self.layer->setIconColor(mbglValue); } -- (id <MGLStyleAttributeValue>)iconColor { - return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getIconColor() ?: self.layer->getDefaultIconColor()]; +- (MGLStyleValue<MGLColor *> *)iconColor { + auto propertyValue = self.layer->getIconColor() ?: self.layer->getDefaultIconColor(); + return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toStyleValue(propertyValue); } -- (void)setIconHaloColor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconHaloColor { - self.layer->setIconHaloColor(iconHaloColor.mbgl_colorPropertyValue); +- (void)setIconHaloColor:(MGLStyleValue<MGLColor *> *)iconHaloColor { + auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue(iconHaloColor); + self.layer->setIconHaloColor(mbglValue); } -- (id <MGLStyleAttributeValue>)iconHaloColor { - return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getIconHaloColor() ?: self.layer->getDefaultIconHaloColor()]; +- (MGLStyleValue<MGLColor *> *)iconHaloColor { + auto propertyValue = self.layer->getIconHaloColor() ?: self.layer->getDefaultIconHaloColor(); + return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toStyleValue(propertyValue); } -- (void)setIconHaloWidth:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconHaloWidth { - self.layer->setIconHaloWidth(iconHaloWidth.mbgl_floatPropertyValue); +- (void)setIconHaloWidth:(MGLStyleValue<NSNumber *> *)iconHaloWidth { + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(iconHaloWidth); + self.layer->setIconHaloWidth(mbglValue); } -- (id <MGLStyleAttributeValue>)iconHaloWidth { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getIconHaloWidth() ?: self.layer->getDefaultIconHaloWidth()]; +- (MGLStyleValue<NSNumber *> *)iconHaloWidth { + auto propertyValue = self.layer->getIconHaloWidth() ?: self.layer->getDefaultIconHaloWidth(); + return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue); } -- (void)setIconHaloBlur:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconHaloBlur { - self.layer->setIconHaloBlur(iconHaloBlur.mbgl_floatPropertyValue); +- (void)setIconHaloBlur:(MGLStyleValue<NSNumber *> *)iconHaloBlur { + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(iconHaloBlur); + self.layer->setIconHaloBlur(mbglValue); } -- (id <MGLStyleAttributeValue>)iconHaloBlur { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getIconHaloBlur() ?: self.layer->getDefaultIconHaloBlur()]; +- (MGLStyleValue<NSNumber *> *)iconHaloBlur { + auto propertyValue = self.layer->getIconHaloBlur() ?: self.layer->getDefaultIconHaloBlur(); + return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue); } -- (void)setIconTranslate:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconTranslate { - self.layer->setIconTranslate(iconTranslate.mbgl_offsetPropertyValue); +- (void)setIconTranslate:(MGLStyleValue<NSValue *> *)iconTranslate { + auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue(iconTranslate); + self.layer->setIconTranslate(mbglValue); } -- (id <MGLStyleAttributeValue>)iconTranslate { - return [MGLStyleAttribute mbgl_offsetWithPropertyValueOffset:self.layer->getIconTranslate() ?: self.layer->getDefaultIconTranslate()]; +- (MGLStyleValue<NSValue *> *)iconTranslate { + auto propertyValue = self.layer->getIconTranslate() ?: self.layer->getDefaultIconTranslate(); + return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue); } -- (void)setIconTranslateAnchor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)iconTranslateAnchor { - MGLSetEnumProperty(iconTranslateAnchor, IconTranslateAnchor, TranslateAnchorType, MGLIconTranslateAnchor); +- (void)setIconTranslateAnchor:(MGLStyleValue<NSValue *> *)iconTranslateAnchor { + auto mbglValue = MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *>().toPropertyValue(iconTranslateAnchor); + self.layer->setIconTranslateAnchor(mbglValue); } -- (id <MGLStyleAttributeValue>)iconTranslateAnchor { - MGLGetEnumProperty(IconTranslateAnchor, TranslateAnchorType, MGLIconTranslateAnchor); +- (MGLStyleValue<NSValue *> *)iconTranslateAnchor { + auto propertyValue = self.layer->getIconTranslateAnchor() ?: self.layer->getDefaultIconTranslateAnchor(); + return MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *>().toStyleValue(propertyValue); } -- (void)setTextOpacity:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textOpacity { - self.layer->setTextOpacity(textOpacity.mbgl_floatPropertyValue); +- (void)setTextOpacity:(MGLStyleValue<NSNumber *> *)textOpacity { + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(textOpacity); + self.layer->setTextOpacity(mbglValue); } -- (id <MGLStyleAttributeValue>)textOpacity { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextOpacity() ?: self.layer->getDefaultTextOpacity()]; +- (MGLStyleValue<NSNumber *> *)textOpacity { + auto propertyValue = self.layer->getTextOpacity() ?: self.layer->getDefaultTextOpacity(); + return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue); } -- (void)setTextColor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textColor { - self.layer->setTextColor(textColor.mbgl_colorPropertyValue); +- (void)setTextColor:(MGLStyleValue<MGLColor *> *)textColor { + auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue(textColor); + self.layer->setTextColor(mbglValue); } -- (id <MGLStyleAttributeValue>)textColor { - return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getTextColor() ?: self.layer->getDefaultTextColor()]; +- (MGLStyleValue<MGLColor *> *)textColor { + auto propertyValue = self.layer->getTextColor() ?: self.layer->getDefaultTextColor(); + return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toStyleValue(propertyValue); } -- (void)setTextHaloColor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textHaloColor { - self.layer->setTextHaloColor(textHaloColor.mbgl_colorPropertyValue); +- (void)setTextHaloColor:(MGLStyleValue<MGLColor *> *)textHaloColor { + auto mbglValue = MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toPropertyValue(textHaloColor); + self.layer->setTextHaloColor(mbglValue); } -- (id <MGLStyleAttributeValue>)textHaloColor { - return [MGLStyleAttribute mbgl_colorWithPropertyValueColor:self.layer->getTextHaloColor() ?: self.layer->getDefaultTextHaloColor()]; +- (MGLStyleValue<MGLColor *> *)textHaloColor { + auto propertyValue = self.layer->getTextHaloColor() ?: self.layer->getDefaultTextHaloColor(); + return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toStyleValue(propertyValue); } -- (void)setTextHaloWidth:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textHaloWidth { - self.layer->setTextHaloWidth(textHaloWidth.mbgl_floatPropertyValue); +- (void)setTextHaloWidth:(MGLStyleValue<NSNumber *> *)textHaloWidth { + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(textHaloWidth); + self.layer->setTextHaloWidth(mbglValue); } -- (id <MGLStyleAttributeValue>)textHaloWidth { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextHaloWidth() ?: self.layer->getDefaultTextHaloWidth()]; +- (MGLStyleValue<NSNumber *> *)textHaloWidth { + auto propertyValue = self.layer->getTextHaloWidth() ?: self.layer->getDefaultTextHaloWidth(); + return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue); } -- (void)setTextHaloBlur:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textHaloBlur { - self.layer->setTextHaloBlur(textHaloBlur.mbgl_floatPropertyValue); +- (void)setTextHaloBlur:(MGLStyleValue<NSNumber *> *)textHaloBlur { + auto mbglValue = MGLStyleValueTransformer<float, NSNumber *>().toPropertyValue(textHaloBlur); + self.layer->setTextHaloBlur(mbglValue); } -- (id <MGLStyleAttributeValue>)textHaloBlur { - return [MGLStyleAttribute mbgl_numberWithPropertyValueNumber:self.layer->getTextHaloBlur() ?: self.layer->getDefaultTextHaloBlur()]; +- (MGLStyleValue<NSNumber *> *)textHaloBlur { + auto propertyValue = self.layer->getTextHaloBlur() ?: self.layer->getDefaultTextHaloBlur(); + return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue); } -- (void)setTextTranslate:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textTranslate { - self.layer->setTextTranslate(textTranslate.mbgl_offsetPropertyValue); +- (void)setTextTranslate:(MGLStyleValue<NSValue *> *)textTranslate { + auto mbglValue = MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toPropertyValue(textTranslate); + self.layer->setTextTranslate(mbglValue); } -- (id <MGLStyleAttributeValue>)textTranslate { - return [MGLStyleAttribute mbgl_offsetWithPropertyValueOffset:self.layer->getTextTranslate() ?: self.layer->getDefaultTextTranslate()]; +- (MGLStyleValue<NSValue *> *)textTranslate { + auto propertyValue = self.layer->getTextTranslate() ?: self.layer->getDefaultTextTranslate(); + return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue); } -- (void)setTextTranslateAnchor:(id <MGLStyleAttributeValue, MGLStyleAttributeValue_Private>)textTranslateAnchor { - MGLSetEnumProperty(textTranslateAnchor, TextTranslateAnchor, TranslateAnchorType, MGLTextTranslateAnchor); +- (void)setTextTranslateAnchor:(MGLStyleValue<NSValue *> *)textTranslateAnchor { + auto mbglValue = MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *>().toPropertyValue(textTranslateAnchor); + self.layer->setTextTranslateAnchor(mbglValue); } -- (id <MGLStyleAttributeValue>)textTranslateAnchor { - MGLGetEnumProperty(TextTranslateAnchor, TranslateAnchorType, MGLTextTranslateAnchor); +- (MGLStyleValue<NSValue *> *)textTranslateAnchor { + auto propertyValue = self.layer->getTextTranslateAnchor() ?: self.layer->getDefaultTextTranslateAnchor(); + return MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *>().toStyleValue(propertyValue); } @end |