From 3a0a3e42819c7d2954795edb6bdbc284737dc77d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Mon, 16 Apr 2018 15:29:38 -0700 Subject: [macos] Replaced UIColor with NSColor in documentation --- platform/darwin/scripts/generate-style-code.js | 10 +-- platform/darwin/src/MGLBackgroundStyleLayer.h | 25 +++++++ platform/darwin/src/MGLCircleStyleLayer.h | 40 ++++++++++ platform/darwin/src/MGLFillExtrusionStyleLayer.h | 26 +++++++ platform/darwin/src/MGLFillStyleLayer.h | 43 +++++++++++ platform/darwin/src/MGLHeatmapStyleLayer.h | 24 ++++++ platform/darwin/src/MGLHillshadeStyleLayer.h | 67 +++++++++++++++++ platform/darwin/src/MGLLight.h | 25 +++++++ platform/darwin/src/MGLLineStyleLayer.h | 23 ++++++ platform/darwin/src/MGLSymbolStyleLayer.h | 94 ++++++++++++++++++++++++ 10 files changed, 372 insertions(+), 5 deletions(-) diff --git a/platform/darwin/scripts/generate-style-code.js b/platform/darwin/scripts/generate-style-code.js index 8e82a8eb63..9ea5dd3e80 100755 --- a/platform/darwin/scripts/generate-style-code.js +++ b/platform/darwin/scripts/generate-style-code.js @@ -664,13 +664,13 @@ function duplicatePlatformDecls(src) { // Look for a documentation comment that contains “MGLColor” or “UIColor” // and the subsequent function, method, or property declaration. Try not to // match greedily. - return src.replace(/(\/\*\*(?:\*[^\/]|[^*])*?\*\/)(\s*[^;]+?\b(?:MGL|NS|UI)(?:Color|EdgeInsets(?:Zero)?)\b[^;]+?;)/g, + return src.replace(/(\/\*\*(?:\*[^\/]|[^*])*?\b(?:MGL|NS|UI)Color\b[\s\S]*?\*\/)(\s*.+?;)/g, (match, comment, decl) => { - let macosComment = comment.replace(/\b(?:MGL|UI)(Color|EdgeInsets(?:Zero)?)\b/g, 'NS$1') + let macosComment = comment.replace(/\b(?:MGL|UI)Color\b/g, 'NSColor') // Use the correct indefinite article. - .replace(/\ba(\s+`?NS(?:Color|EdgeInsets))\b/gi, 'an$1'); - let iosDecl = decl.replace(/\bMGL(Color|EdgeInsets)\b/g, 'UI$1'); - let macosDecl = decl.replace(/\b(?:MGL|UI)(Color|EdgeInsets)\b/g, 'NS$1'); + .replace(/\ba(\s+`?NSColor)\b/gi, 'an$1'); + let iosDecl = decl.replace(/\bMGLColor\b/g, 'UIColor'); + let macosDecl = decl.replace(/\b(?:MGL|UI)Color\b/g, 'NSColor'); return `\ #if TARGET_OS_IPHONE ${comment}${iosDecl} diff --git a/platform/darwin/src/MGLBackgroundStyleLayer.h b/platform/darwin/src/MGLBackgroundStyleLayer.h index 4bb8a36e04..d5c3ed5403 100644 --- a/platform/darwin/src/MGLBackgroundStyleLayer.h +++ b/platform/darwin/src/MGLBackgroundStyleLayer.h @@ -37,6 +37,7 @@ which it is added. #pragma mark - Accessing the Paint Attributes +#if TARGET_OS_IPHONE /** The color with which the background will be drawn. @@ -59,6 +60,30 @@ which it is added. feature attributes. */ @property (nonatomic, null_resettable) NSExpression *backgroundColor; +#else +/** + The color with which the background will be drawn. + + The default value of this property is an expression that evaluates to + `NSColor.blackColor`. Set this property to `nil` to reset it to the default + value. + + This property is only applied to the style if `backgroundPattern` is set to + `nil`. Otherwise, it is ignored. + + You can set this property to an expression containing any of the following: + + * Constant `NSColor` values + * Predefined functions, including mathematical and string operators + * Conditional expressions + * Variable assignments and references to assigned variables + * Interpolation and step functions applied to the `$zoomLevel` variable + + This property does not support applying interpolation or step functions to + feature attributes. + */ +@property (nonatomic, null_resettable) NSExpression *backgroundColor; +#endif /** The transition affecting any changes to this layer’s `backgroundColor` property. diff --git a/platform/darwin/src/MGLCircleStyleLayer.h b/platform/darwin/src/MGLCircleStyleLayer.h index 2a63a775f7..06b4de32f0 100644 --- a/platform/darwin/src/MGLCircleStyleLayer.h +++ b/platform/darwin/src/MGLCircleStyleLayer.h @@ -137,6 +137,7 @@ MGL_EXPORT */ @property (nonatomic) MGLTransition circleBlurTransition; +#if TARGET_OS_IPHONE /** The fill color of the circle. @@ -154,6 +155,25 @@ MGL_EXPORT feature attributes */ @property (nonatomic, null_resettable) NSExpression *circleColor; +#else +/** + The fill color of the circle. + + The default value of this property is an expression that evaluates to + `NSColor.blackColor`. Set this property to `nil` to reset it to the default + value. + + You can set this property to an expression containing any of the following: + + * Constant `NSColor` values + * Predefined functions, including mathematical and string operators + * Conditional expressions + * Variable assignments and references to assigned variables + * Interpolation and step functions applied to the `$zoomLevel` variable and/or + feature attributes + */ +@property (nonatomic, null_resettable) NSExpression *circleColor; +#endif /** The transition affecting any changes to this layer’s `circleColor` property. @@ -265,6 +285,7 @@ MGL_EXPORT @property (nonatomic, null_resettable) NSExpression *circlePitchScale __attribute__((unavailable("Use circleScaleAlignment instead."))); +#if TARGET_OS_IPHONE /** The stroke color of the circle. @@ -282,6 +303,25 @@ MGL_EXPORT feature attributes */ @property (nonatomic, null_resettable) NSExpression *circleStrokeColor; +#else +/** + The stroke color of the circle. + + The default value of this property is an expression that evaluates to + `NSColor.blackColor`. Set this property to `nil` to reset it to the default + value. + + You can set this property to an expression containing any of the following: + + * Constant `NSColor` values + * Predefined functions, including mathematical and string operators + * Conditional expressions + * Variable assignments and references to assigned variables + * Interpolation and step functions applied to the `$zoomLevel` variable and/or + feature attributes + */ +@property (nonatomic, null_resettable) NSExpression *circleStrokeColor; +#endif /** The transition affecting any changes to this layer’s `circleStrokeColor` property. diff --git a/platform/darwin/src/MGLFillExtrusionStyleLayer.h b/platform/darwin/src/MGLFillExtrusionStyleLayer.h index 9590fcfc9a..7c3a0773e4 100644 --- a/platform/darwin/src/MGLFillExtrusionStyleLayer.h +++ b/platform/darwin/src/MGLFillExtrusionStyleLayer.h @@ -101,6 +101,7 @@ MGL_EXPORT */ @property (nonatomic) MGLTransition fillExtrusionBaseTransition; +#if TARGET_OS_IPHONE /** The base color of this layer. The extrusion's surfaces will be shaded differently based on this color in combination with the `light` settings. If @@ -124,6 +125,31 @@ MGL_EXPORT feature attributes */ @property (nonatomic, null_resettable) NSExpression *fillExtrusionColor; +#else +/** + The base color of this layer. The extrusion's surfaces will be shaded + differently based on this color in combination with the `light` settings. If + this color is specified with an alpha component, the alpha component will be + ignored; use `fillExtrusionOpacity` to set layer opacityco. + + The default value of this property is an expression that evaluates to + `NSColor.blackColor`. Set this property to `nil` to reset it to the default + value. + + This property is only applied to the style if `fillExtrusionPattern` is set to + `nil`. Otherwise, it is ignored. + + You can set this property to an expression containing any of the following: + + * Constant `NSColor` values + * Predefined functions, including mathematical and string operators + * Conditional expressions + * Variable assignments and references to assigned variables + * Interpolation and step functions applied to the `$zoomLevel` variable and/or + feature attributes + */ +@property (nonatomic, null_resettable) NSExpression *fillExtrusionColor; +#endif /** The transition affecting any changes to this layer’s `fillExtrusionColor` property. diff --git a/platform/darwin/src/MGLFillStyleLayer.h b/platform/darwin/src/MGLFillStyleLayer.h index 6d1896b559..a159a924e6 100644 --- a/platform/darwin/src/MGLFillStyleLayer.h +++ b/platform/darwin/src/MGLFillStyleLayer.h @@ -95,6 +95,7 @@ MGL_EXPORT @property (nonatomic, null_resettable) NSExpression *fillAntialias __attribute__((unavailable("Use fillAntialiased instead."))); +#if TARGET_OS_IPHONE /** The color of the filled part of this layer. @@ -115,6 +116,28 @@ MGL_EXPORT feature attributes */ @property (nonatomic, null_resettable) NSExpression *fillColor; +#else +/** + The color of the filled part of this layer. + + The default value of this property is an expression that evaluates to + `NSColor.blackColor`. Set this property to `nil` to reset it to the default + value. + + This property is only applied to the style if `fillPattern` is set to `nil`. + Otherwise, it is ignored. + + You can set this property to an expression containing any of the following: + + * Constant `NSColor` values + * Predefined functions, including mathematical and string operators + * Conditional expressions + * Variable assignments and references to assigned variables + * Interpolation and step functions applied to the `$zoomLevel` variable and/or + feature attributes + */ +@property (nonatomic, null_resettable) NSExpression *fillColor; +#endif /** The transition affecting any changes to this layer’s `fillColor` property. @@ -148,6 +171,7 @@ MGL_EXPORT */ @property (nonatomic) MGLTransition fillOpacityTransition; +#if TARGET_OS_IPHONE /** The outline color of the fill. Matches the value of `fillColor` if unspecified. @@ -165,6 +189,25 @@ MGL_EXPORT feature attributes */ @property (nonatomic, null_resettable) NSExpression *fillOutlineColor; +#else +/** + The outline color of the fill. Matches the value of `fillColor` if unspecified. + + This property is only applied to the style if `fillPattern` is set to `nil`, + and `fillAntialiased` is set to an expression that evaluates to `YES`. + Otherwise, it is ignored. + + You can set this property to an expression containing any of the following: + + * Constant `NSColor` values + * Predefined functions, including mathematical and string operators + * Conditional expressions + * Variable assignments and references to assigned variables + * Interpolation and step functions applied to the `$zoomLevel` variable and/or + feature attributes + */ +@property (nonatomic, null_resettable) NSExpression *fillOutlineColor; +#endif /** The transition affecting any changes to this layer’s `fillOutlineColor` property. diff --git a/platform/darwin/src/MGLHeatmapStyleLayer.h b/platform/darwin/src/MGLHeatmapStyleLayer.h index d6abdca65f..ad7ba5de01 100644 --- a/platform/darwin/src/MGLHeatmapStyleLayer.h +++ b/platform/darwin/src/MGLHeatmapStyleLayer.h @@ -65,6 +65,7 @@ MGL_EXPORT #pragma mark - Accessing the Paint Attributes +#if TARGET_OS_IPHONE /** The color of each screen point based on its density value in a heatmap. This property is normally set to an interpolation or step expression with the @@ -86,6 +87,29 @@ MGL_EXPORT feature attributes. */ @property (nonatomic, null_resettable) NSExpression *heatmapColor; +#else +/** + The color of each screen point based on its density value in a heatmap. This + property is normally set to an interpolation or step expression with the + `$heatmapDensity` value as its input. + + The default value of this property is an expression that evaluates to a rainbow + color scale from blue to red. Set this property to `nil` to reset it to the + default value. + + You can set this property to an expression containing any of the following: + + * Constant `NSColor` values + * Predefined functions, including mathematical and string operators + * Conditional expressions + * Variable assignments and references to assigned variables + * Interpolation and step functions applied to the `$heatmapDensity` variable + + This property does not support applying interpolation or step functions to + feature attributes. + */ +@property (nonatomic, null_resettable) NSExpression *heatmapColor; +#endif /** Similar to `heatmapWeight` but controls the intensity of the heatmap globally. diff --git a/platform/darwin/src/MGLHillshadeStyleLayer.h b/platform/darwin/src/MGLHillshadeStyleLayer.h index 4c8e519572..224680160a 100644 --- a/platform/darwin/src/MGLHillshadeStyleLayer.h +++ b/platform/darwin/src/MGLHillshadeStyleLayer.h @@ -75,6 +75,7 @@ MGL_EXPORT #pragma mark - Accessing the Paint Attributes +#if TARGET_OS_IPHONE /** The shading color used to accentuate rugged terrain like sharp cliffs and gorges. @@ -95,6 +96,28 @@ MGL_EXPORT feature attributes. */ @property (nonatomic, null_resettable) NSExpression *hillshadeAccentColor; +#else +/** + The shading color used to accentuate rugged terrain like sharp cliffs and + gorges. + + The default value of this property is an expression that evaluates to + `NSColor.blackColor`. Set this property to `nil` to reset it to the default + value. + + You can set this property to an expression containing any of the following: + + * Constant `NSColor` values + * Predefined functions, including mathematical and string operators + * Conditional expressions + * Variable assignments and references to assigned variables + * Interpolation and step functions applied to the `$zoomLevel` variable + + This property does not support applying interpolation or step functions to + feature attributes. + */ +@property (nonatomic, null_resettable) NSExpression *hillshadeAccentColor; +#endif /** The transition affecting any changes to this layer’s `hillshadeAccentColor` property. @@ -129,6 +152,7 @@ MGL_EXPORT */ @property (nonatomic) MGLTransition hillshadeExaggerationTransition; +#if TARGET_OS_IPHONE /** The shading color of areas that faces towards the light source. @@ -148,6 +172,27 @@ MGL_EXPORT feature attributes. */ @property (nonatomic, null_resettable) NSExpression *hillshadeHighlightColor; +#else +/** + The shading color of areas that faces towards the light source. + + The default value of this property is an expression that evaluates to + `NSColor.whiteColor`. Set this property to `nil` to reset it to the default + value. + + You can set this property to an expression containing any of the following: + + * Constant `NSColor` values + * Predefined functions, including mathematical and string operators + * Conditional expressions + * Variable assignments and references to assigned variables + * Interpolation and step functions applied to the `$zoomLevel` variable + + This property does not support applying interpolation or step functions to + feature attributes. + */ +@property (nonatomic, null_resettable) NSExpression *hillshadeHighlightColor; +#endif /** The transition affecting any changes to this layer’s `hillshadeHighlightColor` property. @@ -202,6 +247,7 @@ MGL_EXPORT */ @property (nonatomic, null_resettable) NSExpression *hillshadeIlluminationDirection; +#if TARGET_OS_IPHONE /** The shading color of areas that face away from the light source. @@ -221,6 +267,27 @@ MGL_EXPORT feature attributes. */ @property (nonatomic, null_resettable) NSExpression *hillshadeShadowColor; +#else +/** + The shading color of areas that face away from the light source. + + The default value of this property is an expression that evaluates to + `NSColor.blackColor`. Set this property to `nil` to reset it to the default + value. + + You can set this property to an expression containing any of the following: + + * Constant `NSColor` values + * Predefined functions, including mathematical and string operators + * Conditional expressions + * Variable assignments and references to assigned variables + * Interpolation and step functions applied to the `$zoomLevel` variable + + This property does not support applying interpolation or step functions to + feature attributes. + */ +@property (nonatomic, null_resettable) NSExpression *hillshadeShadowColor; +#endif /** The transition affecting any changes to this layer’s `hillshadeShadowColor` property. diff --git a/platform/darwin/src/MGLLight.h b/platform/darwin/src/MGLLight.h index 2bdb874a37..cf4aa50112 100644 --- a/platform/darwin/src/MGLLight.h +++ b/platform/darwin/src/MGLLight.h @@ -128,6 +128,7 @@ MGL_EXPORT */ @property (nonatomic) MGLTransition positionTransition; +#if TARGET_OS_IPHONE /** Color tint for lighting extruded geometries. @@ -150,6 +151,30 @@ MGL_EXPORT light property in the Mapbox Style Specification. */ @property (nonatomic) NSExpression *color; +#else +/** + Color tint for lighting extruded geometries. + + The default value of this property is an expression that evaluates to + `NSColor.whiteColor`. + + You can set this property to an expression containing any of the following: + + * Constant `NSColor` values + * Predefined functions, including mathematical and string operators + * Conditional expressions + * Variable assignments and references to assigned variables + * Interpolation and step functions applied to the `$zoomLevel` variable + + This property does not support applying interpolation or step functions to + feature attributes. + + This property corresponds to the color + light property in the Mapbox Style Specification. + */ +@property (nonatomic) NSExpression *color; +#endif /** The transition affecting any changes to this layer’s `color` property. diff --git a/platform/darwin/src/MGLLineStyleLayer.h b/platform/darwin/src/MGLLineStyleLayer.h index 3e6c172025..a7510142fc 100644 --- a/platform/darwin/src/MGLLineStyleLayer.h +++ b/platform/darwin/src/MGLLineStyleLayer.h @@ -248,6 +248,7 @@ MGL_EXPORT */ @property (nonatomic) MGLTransition lineBlurTransition; +#if TARGET_OS_IPHONE /** The color with which the line will be drawn. @@ -268,6 +269,28 @@ MGL_EXPORT feature attributes */ @property (nonatomic, null_resettable) NSExpression *lineColor; +#else +/** + The color with which the line will be drawn. + + The default value of this property is an expression that evaluates to + `NSColor.blackColor`. Set this property to `nil` to reset it to the default + value. + + This property is only applied to the style if `linePattern` is set to `nil`. + Otherwise, it is ignored. + + You can set this property to an expression containing any of the following: + + * Constant `NSColor` values + * Predefined functions, including mathematical and string operators + * Conditional expressions + * Variable assignments and references to assigned variables + * Interpolation and step functions applied to the `$zoomLevel` variable and/or + feature attributes + */ +@property (nonatomic, null_resettable) NSExpression *lineColor; +#endif /** The transition affecting any changes to this layer’s `lineColor` property. diff --git a/platform/darwin/src/MGLSymbolStyleLayer.h b/platform/darwin/src/MGLSymbolStyleLayer.h index dc9225a074..e27f039b75 100644 --- a/platform/darwin/src/MGLSymbolStyleLayer.h +++ b/platform/darwin/src/MGLSymbolStyleLayer.h @@ -1470,6 +1470,7 @@ MGL_EXPORT #pragma mark - Accessing the Paint Attributes +#if TARGET_OS_IPHONE /** The tint color to apply to the icon. The `iconImageName` property must be set to a template image. @@ -1491,6 +1492,29 @@ MGL_EXPORT feature attributes */ @property (nonatomic, null_resettable) NSExpression *iconColor; +#else +/** + The tint color to apply to the icon. The `iconImageName` property must be set + to a template image. + + The default value of this property is an expression that evaluates to + `NSColor.blackColor`. Set this property to `nil` to reset it to the default + value. + + This property is only applied to the style if `iconImageName` is non-`nil`. + Otherwise, it is ignored. + + You can set this property to an expression containing any of the following: + + * Constant `NSColor` values + * Predefined functions, including mathematical and string operators + * Conditional expressions + * Variable assignments and references to assigned variables + * Interpolation and step functions applied to the `$zoomLevel` variable and/or + feature attributes + */ +@property (nonatomic, null_resettable) NSExpression *iconColor; +#endif /** The transition affecting any changes to this layer’s `iconColor` property. @@ -1528,6 +1552,7 @@ MGL_EXPORT */ @property (nonatomic) MGLTransition iconHaloBlurTransition; +#if TARGET_OS_IPHONE /** The color of the icon’s halo. The `iconImageName` property must be set to a template image. @@ -1549,6 +1574,29 @@ MGL_EXPORT feature attributes */ @property (nonatomic, null_resettable) NSExpression *iconHaloColor; +#else +/** + The color of the icon’s halo. The `iconImageName` property must be set to a + template image. + + The default value of this property is an expression that evaluates to + `NSColor.clearColor`. Set this property to `nil` to reset it to the default + value. + + This property is only applied to the style if `iconImageName` is non-`nil`. + Otherwise, it is ignored. + + You can set this property to an expression containing any of the following: + + * Constant `NSColor` values + * Predefined functions, including mathematical and string operators + * Conditional expressions + * Variable assignments and references to assigned variables + * Interpolation and step functions applied to the `$zoomLevel` variable and/or + feature attributes + */ +@property (nonatomic, null_resettable) NSExpression *iconHaloColor; +#endif /** The transition affecting any changes to this layer’s `iconHaloColor` property. @@ -1714,6 +1762,7 @@ MGL_EXPORT @property (nonatomic, null_resettable) NSExpression *iconTranslateAnchor __attribute__((unavailable("Use iconTranslationAnchor instead."))); +#if TARGET_OS_IPHONE /** The color with which the text will be drawn. @@ -1734,6 +1783,28 @@ MGL_EXPORT feature attributes */ @property (nonatomic, null_resettable) NSExpression *textColor; +#else +/** + The color with which the text will be drawn. + + The default value of this property is an expression that evaluates to + `NSColor.blackColor`. Set this property to `nil` to reset it to the default + value. + + This property is only applied to the style if `text` is non-`nil`. Otherwise, + it is ignored. + + You can set this property to an expression containing any of the following: + + * Constant `NSColor` values + * Predefined functions, including mathematical and string operators + * Conditional expressions + * Variable assignments and references to assigned variables + * Interpolation and step functions applied to the `$zoomLevel` variable and/or + feature attributes + */ +@property (nonatomic, null_resettable) NSExpression *textColor; +#endif /** The transition affecting any changes to this layer’s `textColor` property. @@ -1771,6 +1842,7 @@ MGL_EXPORT */ @property (nonatomic) MGLTransition textHaloBlurTransition; +#if TARGET_OS_IPHONE /** The color of the text's halo, which helps it stand out from backgrounds. @@ -1791,6 +1863,28 @@ MGL_EXPORT feature attributes */ @property (nonatomic, null_resettable) NSExpression *textHaloColor; +#else +/** + The color of the text's halo, which helps it stand out from backgrounds. + + The default value of this property is an expression that evaluates to + `NSColor.clearColor`. Set this property to `nil` to reset it to the default + value. + + This property is only applied to the style if `text` is non-`nil`. Otherwise, + it is ignored. + + You can set this property to an expression containing any of the following: + + * Constant `NSColor` values + * Predefined functions, including mathematical and string operators + * Conditional expressions + * Variable assignments and references to assigned variables + * Interpolation and step functions applied to the `$zoomLevel` variable and/or + feature attributes + */ +@property (nonatomic, null_resettable) NSExpression *textHaloColor; +#endif /** The transition affecting any changes to this layer’s `textHaloColor` property. -- cgit v1.2.1