summaryrefslogtreecommitdiff
path: root/platform/darwin
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-03-21 11:55:02 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-03-21 12:04:20 -0700
commite488ca702e8f822ba6297a2f3c933ee22ca6ce42 (patch)
tree2efe93d84722f37a61b83155510a3da444fc171b /platform/darwin
parent1f8910de186f35216791a17a683a55f01031ec81 (diff)
parente0fe42d8321d19a4a9cb46edac9fbdb035e70a0c (diff)
downloadqtlocation-mapboxgl-e488ca702e8f822ba6297a2f3c933ee22ca6ce42.tar.gz
Merge branch 'release-ios-v3.5.0-android-v5.0.0'
Diffstat (limited to 'platform/darwin')
-rw-r--r--platform/darwin/docs/guides/Data-Driven Styling.md.ejs160
-rw-r--r--platform/darwin/docs/guides/For Style Authors.md.ejs31
-rw-r--r--platform/darwin/resources/ca.lproj/Foundation.strings291
-rw-r--r--platform/darwin/resources/ca.lproj/Foundation.stringsdict54
-rw-r--r--platform/darwin/resources/lt.lproj/Foundation.strings291
-rw-r--r--platform/darwin/resources/lt.lproj/Foundation.stringsdict66
-rw-r--r--platform/darwin/resources/pl.lproj/Foundation.stringsdict6
-rw-r--r--platform/darwin/resources/ru.lproj/Foundation.stringsdict6
-rw-r--r--platform/darwin/resources/uk.lproj/Foundation.stringsdict12
-rw-r--r--platform/darwin/scripts/generate-style-code.js11
-rw-r--r--platform/darwin/src/MGLAttributionInfo_Private.h1
-rw-r--r--platform/darwin/src/MGLBackgroundStyleLayer.h31
-rw-r--r--platform/darwin/src/MGLBackgroundStyleLayer.mm54
-rw-r--r--platform/darwin/src/MGLCircleStyleLayer.h84
-rw-r--r--platform/darwin/src/MGLCircleStyleLayer.mm146
-rw-r--r--platform/darwin/src/MGLFeature.h6
-rw-r--r--platform/darwin/src/MGLFillStyleLayer.h57
-rw-r--r--platform/darwin/src/MGLFillStyleLayer.mm92
-rw-r--r--platform/darwin/src/MGLLineStyleLayer.h97
-rw-r--r--platform/darwin/src/MGLLineStyleLayer.mm162
-rw-r--r--platform/darwin/src/MGLOfflineStorage.mm9
-rw-r--r--platform/darwin/src/MGLPolyline.mm4
-rw-r--r--platform/darwin/src/MGLRasterStyleLayer.h65
-rw-r--r--platform/darwin/src/MGLRasterStyleLayer.mm126
-rw-r--r--platform/darwin/src/MGLShapeSource.h26
-rw-r--r--platform/darwin/src/MGLStyle.h22
-rw-r--r--platform/darwin/src/MGLStyle.mm32
-rw-r--r--platform/darwin/src/MGLStyleLayer.h3
-rw-r--r--platform/darwin/src/MGLStyleLayer.h.ejs11
-rw-r--r--platform/darwin/src/MGLStyleLayer.mm.ejs24
-rw-r--r--platform/darwin/src/MGLStyleValue.h60
-rw-r--r--platform/darwin/src/MGLStyleValue.mm6
-rw-r--r--platform/darwin/src/MGLStyleValue_Private.h48
-rw-r--r--platform/darwin/src/MGLSymbolStyleLayer.h203
-rw-r--r--platform/darwin/src/MGLSymbolStyleLayer.mm218
-rw-r--r--platform/darwin/src/MGLTileSource.h4
-rw-r--r--platform/darwin/src/MGLTypes.h48
-rw-r--r--platform/darwin/src/MGLVectorSource.h54
-rw-r--r--platform/darwin/src/NSDate+MGLAdditions.h12
-rw-r--r--platform/darwin/src/NSDate+MGLAdditions.mm10
-rw-r--r--platform/darwin/src/NSString+MGLAdditions.h5
-rw-r--r--platform/darwin/src/NSValue+MGLAdditions.h17
-rw-r--r--platform/darwin/src/NSValue+MGLAdditions.m12
-rw-r--r--platform/darwin/test/MGLBackgroundStyleLayerTests.mm32
-rw-r--r--platform/darwin/test/MGLCircleStyleLayerTests.mm68
-rw-r--r--platform/darwin/test/MGLFillStyleLayerTests.mm41
-rw-r--r--platform/darwin/test/MGLLineStyleLayerTests.mm68
-rw-r--r--platform/darwin/test/MGLNSDateAdditionsTests.mm40
-rw-r--r--platform/darwin/test/MGLRasterStyleLayerTests.mm41
-rw-r--r--platform/darwin/test/MGLStyleLayerTests.mm.ejs16
-rw-r--r--platform/darwin/test/MGLStyleValueTests.swift24
-rw-r--r--platform/darwin/test/MGLSymbolStyleLayerTests.mm95
52 files changed, 2824 insertions, 278 deletions
diff --git a/platform/darwin/docs/guides/Data-Driven Styling.md.ejs b/platform/darwin/docs/guides/Data-Driven Styling.md.ejs
new file mode 100644
index 0000000000..820f71f594
--- /dev/null
+++ b/platform/darwin/docs/guides/Data-Driven Styling.md.ejs
@@ -0,0 +1,160 @@
+
+<%
+ const os = locals.os;
+ const iOS = os === 'iOS';
+ const macOS = os === 'macOS';
+ const cocoaPrefix = iOS ? 'UI' : 'NS';
+-%>
+<!--
+ This file is generated.
+ Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
+-->
+
+# Data-Driven Styling
+
+Mapbox’s data-driven styling features allow you to use data properties to style your maps. You can style map features automatically based on their individual attributes.
+
+Vary POI icons, transit route line colors, city polygon opacity, and more based on any attribute in your data. Need to visualize hotel data by price? You can have your map’s point radii and colors change automatically with your data.
+
+![available bikes](img/data-driven-styling/citibikes.png) ![subway lines](img/data-driven-styling/polylineExample.png)
+
+# How to use Data-Driven Styling
+This guide uses earthquake data from the [U.S. Geological Survey](https://earthquake.usgs.gov/earthquakes/feed/v1.0/geojson.php) to style a map based on attributes. For more information about how to work with GeoJSON data in our iOS SDK, please see our [working with GeoJSON data](working-with-geojson-data.html) guide.
+
+`MGLStyleFunction`
+
+There are three subclasses of `MGLStyleFunction`:
+
+* `MGLCameraStyleFunction` - For a style value that changes with zoom level. For example, you can make the radius of a circle increase according to zoom level.
+* `MGLSourceStyleFunction` - For a style value that changes with the attributes of a feature. For example, you can adjust the radius of a circle based on the magnitude of an earthquake.
+* `MGLCompositeStyleFunction` - For a style value that changes with both zoom level and attribute values. For example, you can add a circle layer where each circle has a radius based on both zoom level and the magnitude of an earthquake.
+
+The documentation for individual style properties will note which style functions are enabled for that property.
+
+## Stops
+
+Stops are key-value pairs that that determine a style value. With a `MGLCameraSourceFunction` stop, you can use a dictionary with a zoom level for a key and a `MGLStyleValue` for the value. For example, you can use a stops dictionary with zoom levels 0, 10, and 20 as keys, and yellow, orange, and red as the values. A `MGLSourceStyleFunction` uses the relevant attribute value as the key.
+
+```swift
+let stops = [0: MGLStyleValue(rawValue: UIColor.yellow),
+ 2.5: MGLStyleValue(rawValue: UIColor.orange),
+ 5: MGLStyleValue(rawValue: UIColor.red),
+ 7.5: MGLStyleValue(rawValue: UIColor.blue),
+ 10: MGLStyleValue(rawValue: UIColor.white)]
+```
+
+## Interpolation Mode
+
+The effect a key has on the style value is determined by the interpolation mode. There are four interpolation modes that can be used with a source style function: exponential, interval, categorical, and identity. You can also use exponential and interval interpolation modes with a camera style function.
+
+### Linear
+
+`MGLInterpolationModelExponential` interpolates linearly or exponentially between style function stop values. By default, the `MGLStyleFunction` options parameter `MGLStyleFunctionOptionInterpolationBase` equals `1`, which represents linear interpolation, and doesn’t need to be included in the options dictionary.
+
+The stops dictionary below, for example, shows colors that continuously shift from yellow to orange to red to blue to white based on the attribute value.
+
+``` swift
+let url = URL(string: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_week.geojson")
+let symbolSource = MGLSource(identifier: "source")
+let symbolLayer = MGLSymbolStyleLayer(identifier: "place-city-sm", source: symbolSource)
+
+let source = MGLShapeSource(identifier: "earthquakes", url: url, options: nil)
+style.addSource(source)
+
+let stops = [0: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.yellow),
+ 2.5: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.orange),
+ 5: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.red),
+ 7.5: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.blue),
+ 10: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.white)]
+
+let layer = MGLCircleStyleLayer(identifier: "circles", source: source)
+layer.circleColor = MGLStyleValue(interpolationMode: .exponential,
+ sourceStops: stops,
+ attributeName: "mag",
+ options: [.defaultValue: MGLStyleValue<<%- cocoaPrefix %>Color>(rawValue: .green)])
+layer.circleRadius = MGLStyleValue(rawValue: 10)
+style.insertLayer(layer, below: symbolLayer)
+```
+
+![exponential mode](img/data-driven-styling/exponential.png)
+
+### Exponential
+
+`MGLInterpolationModelExponential` combined with any `MGLStyleFunctionOptionInterpolationBase` greater than `0`, you can interpolate between values exponentially, create an accelerated ramp effect.
+
+Here’s a visualization from Mapbox Studio (see [Working with Mapbox Studio](working-with-mapbox-studio.html)) comparing interpolation base values of `1.5` and `0.5` based on zoom.
+
+<img src="img/data-driven-styling/exponential-function.png" height=344/>
+<img src="img/data-driven-styling/exponential-function-1.png" height=344/>
+
+The example below increases a layer’s `circleRadius` exponentially based on a map’s zoom level. The `MGLStyleFunctionOptionInterpolationBase` is `1.5`.
+
+```swift
+let stops = [12: MGLStyleValue(rawValue: 0.5),
+ 14: MGLStyleValue(rawValue: 2),
+ 18: MGLStyleValue(rawValue: 18)]
+
+layer.circleRadius = MGLStyleValue(interpolationMode: .exponential,
+ cameraStops: stops,
+ options: [.interpolationBase: 1.5])
+```
+
+### Interval
+
+`MGLInterpolationModeInterval` creates a range using the keys from the stops dictionary. The range is from the given key to just less than the next key. The attribute values that fall into that range are then styled using the style value assigned to that key.
+
+When we use the stops dictionary given above with an interval interpolation mode, we create ranges where earthquakes with a magnitude of 0 to just less than 2.5 would be yellow, 2.5 to just less than 5 would be orange, and so on.
+
+``` swift
+let stops = [0: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.yellow),
+ 2.5: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.orange),
+ 5: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.red),
+ 7.5: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.blue),
+ 10: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.white)]
+
+layer.circleColor = MGLStyleValue(interpolationMode: .interval,
+ sourceStops: stops,
+ attributeName: "mag",
+ options: [.defaultValue: MGLStyleValue<<%- cocoaPrefix %>Color>(rawValue: .green)])
+```
+
+![interval mode](img/data-driven-styling/interval.png)
+
+### Categorical
+
+Returns the output value that is equal to the stop for the function input. We’re going to use a different stops dictionary than we did for the previous two modes.
+
+There are three main types of events in the dataset: earthquakes, explosions, and quarry blasts. In this case, the color of the circle layer will be determined by the type of event, with a default value of green to catch any events that do not fall into any of those categories.
+
+``` swift
+let categoricalStops = ["earthquake": MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.orange),
+ "explosion": MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.red),
+ "quarry blast": MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.yellow)]
+
+layer.circleColor = MGLStyleValue(interpolationMode: .categorical,
+ sourceStops: categoricalStops,
+ attributeName: "type",
+ options: [.defaultValue: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.blue)])
+
+```
+
+![categorical mode](img/data-driven-styling/categorical1.png) ![categorical mode](img/data-driven-styling/categorical2.png)
+
+### Identity
+
+`MGLInterpolationModeIdentity` uses the attribute’s value as the style value. For example, you can set the `circleRadius` to the earthquake’s magnitude. Since the attribute value itself will be used as the style value, `sourceStops` should be set to `nil`.
+
+``` swift
+layer.circleRadius = MGLStyleValue(interpolationMode: .identity,
+ sourceStops: nil,
+ attributeName: "mag",
+ options: [.defaultValue: MGLStyleValue<NSNumber>(rawValue: 0)])
+
+```
+
+![identity mode](img/data-driven-styling/identity.png)
+
+##Resources
+
+* [USGS](https://earthquake.usgs.gov/earthquakes/feed/v1.0/geojson.php)
+* [For Style Authors](for-style-authors.html)
diff --git a/platform/darwin/docs/guides/For Style Authors.md.ejs b/platform/darwin/docs/guides/For Style Authors.md.ejs
index 254a7cf219..92ce4c1594 100644
--- a/platform/darwin/docs/guides/For Style Authors.md.ejs
+++ b/platform/darwin/docs/guides/For Style Authors.md.ejs
@@ -8,7 +8,7 @@
-%>
<!--
This file is generated.
- Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+ Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
-->
# Information for Style Authors
@@ -41,7 +41,7 @@ underneath.
<% if (iOS) { -%>
The user location annotation view, the attribution button, any buttons in
callout views, and any items in the navigation bar are influenced by your
-application’s tint color, so choose a tint color that constrasts well with your
+application’s tint color, so choose a tint color that contrasts well with your
map style.
<% } -%>
If you intend your style to be used in the dark, consider the impact that Night
@@ -160,6 +160,7 @@ In the style specification | In the SDK
---------------------------|---------
class | style class
filter | predicate
+function type | interpolation mode
id | identifier
image | style image
layer | style layer
@@ -239,6 +240,30 @@ whose names differ from the style specification are listed below:
<% for (const type in renamedProperties) { -%>
<% if (renamedProperties.hasOwnProperty(type)) { -%>
+### <%- camelize(type) %> style functions
+
+The runtime styling API introduces `MGLStyleFunction` to the <%- os %> SDK.
+[Data-driven styling](data-driven-styling.html) expands `MGLStyleFunction`.
+Individual style property documentation includes which subclasses of
+`MGLStyleFunction` are enabled for that property. You can use `MGLStyleValue`
+methods to create a `MGLStyleFunction`.
+
+In style specification | In the SDK | [MGLStyleValue valueWithInterpolationMode:...]
+-----------------------|-------------------------------|-------------
+`zoom function` | `MGLCameraStyleFunction` | `cameraStops:options:`
+`property function` | `MGLSourceStyleFunction` | `sourceStops:attributeName:options:`
+`zoom-and-property functions`| `MGLCompositeStyleFunction` | `compositeStops:attributeName:options:`
+
+Data-driven styling also introduces interpolation mode, which defines the
+relationship between style values and attributes or zoom levels.
+
+In style specification | In the SDK
+-----------------------------|-----------
+`exponential` | `MGLInterpolationModeExponential`
+`interval` | `MGLInterpolationModeInterval`
+`categorical` | `MGLInterpolationModeCategorical`
+`identity` | `MGLInterpolationModeIdentity`
+
### <%- camelize(type) %> style layers
In style JSON | In Objective-C | In Swift
@@ -254,7 +279,7 @@ In style JSON | In Objective-C | In Swift
## Setting attribute values
Each property representing a layout or paint attribute is set to an
-`MGLStyleValue` object, which is either an `MGLStyleConstantValue` object (for
+`MGLStyleValue` object, which is either an `MGLConstantStyleValue` object (for
constant values) or an `MGLStyleFunction` object (for zoom level functions). The
style value object is a container for the raw value or function parameters that
you want the attribute to be set to.
diff --git a/platform/darwin/resources/ca.lproj/Foundation.strings b/platform/darwin/resources/ca.lproj/Foundation.strings
new file mode 100644
index 0000000000..e36ea9ed8a
--- /dev/null
+++ b/platform/darwin/resources/ca.lproj/Foundation.strings
@@ -0,0 +1,291 @@
+/* Clock position format, long: {hours} o’clock */
+"CLOCK_FMT_LONG" = "%@ en punt";
+
+/* Clock position format, medium: {hours} o’clock */
+"CLOCK_FMT_MEDIUM" = "%@ en punt";
+
+/* Clock position format, short: {hours}:00 */
+"CLOCK_FMT_SHORT" = "%@:00";
+
+/* East, long */
+"COMPASS_E_LONG" = "est";
+
+/* East, short */
+"COMPASS_E_SHORT" = "E";
+
+/* East by north, long */
+"COMPASS_EbN_LONG" = "est per nord";
+
+/* East by north, short */
+"COMPASS_EbN_SHORT" = "EpN";
+
+/* East by south, long */
+"COMPASS_EbS_LONG" = "est per sud";
+
+/* East by south, short */
+"COMPASS_EbS_SHORT" = "EpS";
+
+/* East-northeast, long */
+"COMPASS_ENE_LONG" = "est-nord-est";
+
+/* East-northeast, short */
+"COMPASS_ENE_SHORT" = "ENE";
+
+/* East-southeast, long */
+"COMPASS_ESE_LONG" = "est-sud-est";
+
+/* East-southeast, short */
+"COMPASS_ESE_SHORT" = "ESE";
+
+/* North, long */
+"COMPASS_N_LONG" = "nord";
+
+/* North, short */
+"COMPASS_N_SHORT" = "N";
+
+/* North by east, long */
+"COMPASS_NbE_LONG" = "nord per est";
+
+/* North by east, short */
+"COMPASS_NbE_SHORT" = "NpE";
+
+/* North by west, long */
+"COMPASS_NbW_LONG" = "nord per oest";
+
+/* North by west, short */
+"COMPASS_NbW_SHORT" = "NpO";
+
+/* Northeast, long */
+"COMPASS_NE_LONG" = "nord-est";
+
+/* Northeast, short */
+"COMPASS_NE_SHORT" = "NE";
+
+/* Northeast by east, long */
+"COMPASS_NEbE_LONG" = "nord-est per est";
+
+/* Northeast by east, short */
+"COMPASS_NEbE_SHORT" = "NEpE";
+
+/* Northeast by north, long */
+"COMPASS_NEbN_LONG" = "nord-est per nord";
+
+/* Northeast by north, short */
+"COMPASS_NEbN_SHORT" = "NEpN";
+
+/* North-northeast, long */
+"COMPASS_NNE_LONG" = "nord-nord-est";
+
+/* North-northeast, short */
+"COMPASS_NNE_SHORT" = "NNE";
+
+/* North-northwest, long */
+"COMPASS_NNW_LONG" = "nord-nord-oest";
+
+/* North-northwest, short */
+"COMPASS_NNW_SHORT" = "NNO";
+
+/* Northwest, long */
+"COMPASS_NW_LONG" = "nord-oest";
+
+/* Northwest, short */
+"COMPASS_NW_SHORT" = "NO";
+
+/* Northwest by north, long */
+"COMPASS_NWbN_LONG" = "nord-oest per nord";
+
+/* Northwest by north, short */
+"COMPASS_NWbN_SHORT" = "NOpN";
+
+/* Northwest by west, long */
+"COMPASS_NWbW_LONG" = "nord-oest per oest";
+
+/* Northwest by west, short */
+"COMPASS_NWbW_SHORT" = "NOpO";
+
+/* South, long */
+"COMPASS_S_LONG" = "sud";
+
+/* South, short */
+"COMPASS_S_SHORT" = "S";
+
+/* South by east, long */
+"COMPASS_SbE_LONG" = "sud per est";
+
+/* South by east, short */
+"COMPASS_SbE_SHORT" = "SpE";
+
+/* South by west, long */
+"COMPASS_SbW_LONG" = "sud per oest";
+
+/* South by west, short */
+"COMPASS_SbW_SHORT" = "SpO";
+
+/* Southeast, long */
+"COMPASS_SE_LONG" = "sud-est";
+
+/* Southeast, short */
+"COMPASS_SE_SHORT" = "SE";
+
+/* Southeast by east, long */
+"COMPASS_SEbE_LONG" = "sud-est per est";
+
+/* Southeast by east, short */
+"COMPASS_SEbE_SHORT" = "SEpE";
+
+/* Southeast by south, long */
+"COMPASS_SEbS_LONG" = "sud-est per sud";
+
+/* Southeast by south, short */
+"COMPASS_SEbS_SHORT" = "SEpS";
+
+/* South-southeast, long */
+"COMPASS_SSE_LONG" = "sud-sud-est";
+
+/* South-southeast, short */
+"COMPASS_SSE_SHORT" = "SSE";
+
+/* South-southwest, long */
+"COMPASS_SSW_LONG" = "sud-sud-oest";
+
+/* South-southwest, short */
+"COMPASS_SSW_SHORT" = "SSO";
+
+/* Southwest, long */
+"COMPASS_SW_LONG" = "sud-oest";
+
+/* Southwest, short */
+"COMPASS_SW_SHORT" = "SO";
+
+/* Southwest by south, long */
+"COMPASS_SWbS_LONG" = "sud-oest per sud";
+
+/* Southwest by south, short */
+"COMPASS_SWbS_SHORT" = "SOpS";
+
+/* Southwest by west, long */
+"COMPASS_SWbW_LONG" = "sud-oest per oest";
+
+/* Southwest by west, short */
+"COMPASS_SWbW_SHORT" = "SOpO";
+
+/* West, long */
+"COMPASS_W_LONG" = "oest";
+
+/* West, short */
+"COMPASS_W_SHORT" = "O";
+
+/* West by north, long */
+"COMPASS_WbN_LONG" = "oest per nord";
+
+/* West by north, short */
+"COMPASS_WbN_SHORT" = "OpN";
+
+/* West by south, long */
+"COMPASS_WbS_LONG" = "oest per sud";
+
+/* West by south, short */
+"COMPASS_WbS_SHORT" = "OpS";
+
+/* West-northwest, long */
+"COMPASS_WNW_LONG" = "oest-nord-oest";
+
+/* West-northwest, short */
+"COMPASS_WNW_SHORT" = "ONO";
+
+/* West-southwest, long */
+"COMPASS_WSW_LONG" = "oest-sud-oest";
+
+/* West-southwest, short */
+"COMPASS_WSW_SHORT" = "OSO";
+
+/* Degrees format, long */
+"COORD_DEG_LONG" = "%d grau(s)";
+
+/* Degrees format, medium: {degrees} */
+"COORD_DEG_MEDIUM" = "%d°";
+
+/* Degrees format, short: {degrees} */
+"COORD_DEG_SHORT" = "%d°";
+
+/* Coordinate format, long: {degrees}{minutes} */
+"COORD_DM_LONG" = "%1$@ i %2$@";
+
+/* Coordinate format, medium: {degrees}{minutes} */
+"COORD_DM_MEDIUM" = "%1$@%2$@";
+
+/* Coordinate format, short: {degrees}{minutes} */
+"COORD_DM_SHORT" = "%1$@%2$@";
+
+/* Coordinate format, long: {degrees}{minutes}{seconds} */
+"COORD_DMS_LONG" = "%1$@, %2$@, i %3$@";
+
+/* Coordinate format, medium: {degrees}{minutes}{seconds} */
+"COORD_DMS_MEDIUM" = "%1$@%2$@%3$@";
+
+/* Coordinate format, short: {degrees}{minutes}{seconds} */
+"COORD_DMS_SHORT" = "%1$@%2$@%3$@";
+
+/* East longitude format, long: {longitude} */
+"COORD_E_LONG" = "%@ est";
+
+/* East longitude format, medium: {longitude} */
+"COORD_E_MEDIUM" = "%@ est";
+
+/* East longitude format, short: {longitude} */
+"COORD_E_SHORT" = "%@E";
+
+/* Coordinate pair format, long: {latitude}, {longitude} */
+"COORD_FMT_LONG" = "%1$@ per %2$@";
+
+/* Coordinate pair format, medium: {latitude}, {longitude} */
+"COORD_FMT_MEDIUM" = "%1$@, %2$@";
+
+/* Coordinate pair format, short: {latitude}, {longitude} */
+"COORD_FMT_SHORT" = "%1$@, %2$@";
+
+/* Minutes format, long */
+"COORD_MIN_LONG" = "%d minut(s)";
+
+/* Minutes format, medium: {minutes} */
+"COORD_MIN_MEDIUM" = "%d′";
+
+/* Minutes format, short: {minutes} */
+"COORD_MIN_SHORT" = "%d′";
+
+/* North latitude format, long: {latitude} */
+"COORD_N_LONG" = "%@ nord";
+
+/* North latitude format, medium: {latitude} */
+"COORD_N_MEDIUM" = "%@ nord";
+
+/* North latitude format, short: {latitude} */
+"COORD_N_SHORT" = "%@N";
+
+/* South latitude format, long: {latitude} */
+"COORD_S_LONG" = "%@ sud";
+
+/* South latitude format, medium: {latitude} */
+"COORD_S_MEDIUM" = "%@ sud";
+
+/* South latitude format, short: {latitude} */
+"COORD_S_SHORT" = "%@S";
+
+/* Seconds format, long */
+"COORD_SEC_LONG" = "%d segon(s)";
+
+/* Seconds format, medium: {seconds} */
+"COORD_SEC_MEDIUM" = "%d″";
+
+/* Seconds format, short: {seconds} */
+"COORD_SEC_SHORT" = "%d″";
+
+/* West longitude format, long: {longitude} */
+"COORD_W_LONG" = "%@ oest";
+
+/* West longitude format, medium: {longitude} */
+"COORD_W_MEDIUM" = "%@ oest";
+
+/* West longitude format, short: {longitude} */
+"COORD_W_SHORT" = "%@O";
+
diff --git a/platform/darwin/resources/ca.lproj/Foundation.stringsdict b/platform/darwin/resources/ca.lproj/Foundation.stringsdict
new file mode 100644
index 0000000000..8bacec946f
--- /dev/null
+++ b/platform/darwin/resources/ca.lproj/Foundation.stringsdict
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>COORD_DEG_LONG</key>
+ <dict>
+ <key>NSStringLocalizedFormatKey</key>
+ <string>%#@degrees@</string>
+ <key>degrees</key>
+ <dict>
+ <key>NSStringFormatSpecTypeKey</key>
+ <string>NSStringPluralRuleType</string>
+ <key>NSStringFormatValueTypeKey</key>
+ <string>d</string>
+ <key>one</key>
+ <string>%d grau</string>
+ <key>other</key>
+ <string>%d graus</string>
+ </dict>
+ </dict>
+ <key>COORD_MIN_LONG</key>
+ <dict>
+ <key>NSStringLocalizedFormatKey</key>
+ <string>%#@minutes@</string>
+ <key>minutes</key>
+ <dict>
+ <key>NSStringFormatSpecTypeKey</key>
+ <string>NSStringPluralRuleType</string>
+ <key>NSStringFormatValueTypeKey</key>
+ <string>d</string>
+ <key>one</key>
+ <string>%d minut</string>
+ <key>other</key>
+ <string>%d minuts</string>
+ </dict>
+ </dict>
+ <key>COORD_SEC_LONG</key>
+ <dict>
+ <key>NSStringLocalizedFormatKey</key>
+ <string>%#@seconds@</string>
+ <key>seconds</key>
+ <dict>
+ <key>NSStringFormatSpecTypeKey</key>
+ <string>NSStringPluralRuleType</string>
+ <key>NSStringFormatValueTypeKey</key>
+ <string>d</string>
+ <key>one</key>
+ <string>%d segon</string>
+ <key>other</key>
+ <string>%d segons</string>
+ </dict>
+ </dict>
+</dict>
+</plist>
diff --git a/platform/darwin/resources/lt.lproj/Foundation.strings b/platform/darwin/resources/lt.lproj/Foundation.strings
new file mode 100644
index 0000000000..68e7e14bda
--- /dev/null
+++ b/platform/darwin/resources/lt.lproj/Foundation.strings
@@ -0,0 +1,291 @@
+/* Clock position format, long: {hours} o’clock */
+"CLOCK_FMT_LONG" = "Laikas: %@";
+
+/* Clock position format, medium: {hours} o’clock */
+"CLOCK_FMT_MEDIUM" = "Laikas: %@";
+
+/* Clock position format, short: {hours}:00 */
+"CLOCK_FMT_SHORT" = "%@:00";
+
+/* East, long */
+"COMPASS_E_LONG" = "rytai";
+
+/* East, short */
+"COMPASS_E_SHORT" = "R";
+
+/* East by north, long */
+"COMPASS_EbN_LONG" = "rytai į šiaurę";
+
+/* East by north, short */
+"COMPASS_EbN_SHORT" = "RįŠ";
+
+/* East by south, long */
+"COMPASS_EbS_LONG" = "rytai į pietus";
+
+/* East by south, short */
+"COMPASS_EbS_SHORT" = "RįP";
+
+/* East-northeast, long */
+"COMPASS_ENE_LONG" = "rytai - šiaurės rytai";
+
+/* East-northeast, short */
+"COMPASS_ENE_SHORT" = "R-ŠR";
+
+/* East-southeast, long */
+"COMPASS_ESE_LONG" = "rytai - pietryčiai";
+
+/* East-southeast, short */
+"COMPASS_ESE_SHORT" = "R-PR";
+
+/* North, long */
+"COMPASS_N_LONG" = "šiaurė";
+
+/* North, short */
+"COMPASS_N_SHORT" = "Š";
+
+/* North by east, long */
+"COMPASS_NbE_LONG" = "šiaurė į rytus";
+
+/* North by east, short */
+"COMPASS_NbE_SHORT" = "ŠįR";
+
+/* North by west, long */
+"COMPASS_NbW_LONG" = "šiaurė į vakarus";
+
+/* North by west, short */
+"COMPASS_NbW_SHORT" = "ŠįV";
+
+/* Northeast, long */
+"COMPASS_NE_LONG" = "šiaurės rytai";
+
+/* Northeast, short */
+"COMPASS_NE_SHORT" = "ŠR";
+
+/* Northeast by east, long */
+"COMPASS_NEbE_LONG" = "šiaurės rytai į rytus";
+
+/* Northeast by east, short */
+"COMPASS_NEbE_SHORT" = "ŠRįR";
+
+/* Northeast by north, long */
+"COMPASS_NEbN_LONG" = "šiaurės rytai į šiaurę";
+
+/* Northeast by north, short */
+"COMPASS_NEbN_SHORT" = "ŠRįŠ";
+
+/* North-northeast, long */
+"COMPASS_NNE_LONG" = "šiaurė - šiaurės rytai";
+
+/* North-northeast, short */
+"COMPASS_NNE_SHORT" = "ŠŠR";
+
+/* North-northwest, long */
+"COMPASS_NNW_LONG" = "šiaurė - šiaurės vakarai";
+
+/* North-northwest, short */
+"COMPASS_NNW_SHORT" = "ŠŠV";
+
+/* Northwest, long */
+"COMPASS_NW_LONG" = "šiaurės vakarai";
+
+/* Northwest, short */
+"COMPASS_NW_SHORT" = "ŠV";
+
+/* Northwest by north, long */
+"COMPASS_NWbN_LONG" = "šiaurės vakarai į šiaurę";
+
+/* Northwest by north, short */
+"COMPASS_NWbN_SHORT" = "ŠVįŠ";
+
+/* Northwest by west, long */
+"COMPASS_NWbW_LONG" = "šiaurės vakarai į vakarus";
+
+/* Northwest by west, short */
+"COMPASS_NWbW_SHORT" = "ŠVįV";
+
+/* South, long */
+"COMPASS_S_LONG" = "pietūs";
+
+/* South, short */
+"COMPASS_S_SHORT" = "P";
+
+/* South by east, long */
+"COMPASS_SbE_LONG" = "pietūs į rytus";
+
+/* South by east, short */
+"COMPASS_SbE_SHORT" = "PįR";
+
+/* South by west, long */
+"COMPASS_SbW_LONG" = "pietūs į vakarus";
+
+/* South by west, short */
+"COMPASS_SbW_SHORT" = "PįV";
+
+/* Southeast, long */
+"COMPASS_SE_LONG" = "pietryčiai";
+
+/* Southeast, short */
+"COMPASS_SE_SHORT" = "PR";
+
+/* Southeast by east, long */
+"COMPASS_SEbE_LONG" = "pietryčiai į rytus";
+
+/* Southeast by east, short */
+"COMPASS_SEbE_SHORT" = "PRįR";
+
+/* Southeast by south, long */
+"COMPASS_SEbS_LONG" = "pietryčiai į pietus";
+
+/* Southeast by south, short */
+"COMPASS_SEbS_SHORT" = "PRįP";
+
+/* South-southeast, long */
+"COMPASS_SSE_LONG" = "pietūs - pietryčiai";
+
+/* South-southeast, short */
+"COMPASS_SSE_SHORT" = "PPR";
+
+/* South-southwest, long */
+"COMPASS_SSW_LONG" = "pietūs - pietvakariai";
+
+/* South-southwest, short */
+"COMPASS_SSW_SHORT" = "PPV";
+
+/* Southwest, long */
+"COMPASS_SW_LONG" = "pietvakariai";
+
+/* Southwest, short */
+"COMPASS_SW_SHORT" = "PV";
+
+/* Southwest by south, long */
+"COMPASS_SWbS_LONG" = "pietvakariai į pietus";
+
+/* Southwest by south, short */
+"COMPASS_SWbS_SHORT" = "PVįP";
+
+/* Southwest by west, long */
+"COMPASS_SWbW_LONG" = "pietvakariai į vakarus";
+
+/* Southwest by west, short */
+"COMPASS_SWbW_SHORT" = "PVįV";
+
+/* West, long */
+"COMPASS_W_LONG" = "vakarai";
+
+/* West, short */
+"COMPASS_W_SHORT" = "V";
+
+/* West by north, long */
+"COMPASS_WbN_LONG" = "vakarai į šiaurę";
+
+/* West by north, short */
+"COMPASS_WbN_SHORT" = "VįŠ";
+
+/* West by south, long */
+"COMPASS_WbS_LONG" = "vakarai į pietus";
+
+/* West by south, short */
+"COMPASS_WbS_SHORT" = "VįP";
+
+/* West-northwest, long */
+"COMPASS_WNW_LONG" = "vakarai - šiaurės vakarai";
+
+/* West-northwest, short */
+"COMPASS_WNW_SHORT" = "VŠV";
+
+/* West-southwest, long */
+"COMPASS_WSW_LONG" = "vakarai - pietvakariai";
+
+/* West-southwest, short */
+"COMPASS_WSW_SHORT" = "VPV";
+
+/* Degrees format, long */
+"COORD_DEG_LONG" = "%d laipsniai(-ių)";
+
+/* Degrees format, medium: {degrees} */
+"COORD_DEG_MEDIUM" = "%d°";
+
+/* Degrees format, short: {degrees} */
+"COORD_DEG_SHORT" = "%d°";
+
+/* Coordinate format, long: {degrees}{minutes} */
+"COORD_DM_LONG" = "%1$@ ir %2$@";
+
+/* Coordinate format, medium: {degrees}{minutes} */
+"COORD_DM_MEDIUM" = "%1$@%2$@";
+
+/* Coordinate format, short: {degrees}{minutes} */
+"COORD_DM_SHORT" = "%1$@%2$@";
+
+/* Coordinate format, long: {degrees}{minutes}{seconds} */
+"COORD_DMS_LONG" = "%1$@, %2$@ ir %3$@";
+
+/* Coordinate format, medium: {degrees}{minutes}{seconds} */
+"COORD_DMS_MEDIUM" = "%1$@%2$@%3$@";
+
+/* Coordinate format, short: {degrees}{minutes}{seconds} */
+"COORD_DMS_SHORT" = "%1$@%2$@%3$@";
+
+/* East longitude format, long: {longitude} */
+"COORD_E_LONG" = "%@ ritų ilgumos";
+
+/* East longitude format, medium: {longitude} */
+"COORD_E_MEDIUM" = "%@ į rytus";
+
+/* East longitude format, short: {longitude} */
+"COORD_E_SHORT" = "%@R";
+
+/* Coordinate pair format, long: {latitude}, {longitude} */
+"COORD_FMT_LONG" = "%1$@, %2$@";
+
+/* Coordinate pair format, medium: {latitude}, {longitude} */
+"COORD_FMT_MEDIUM" = "%1$@, %2$@";
+
+/* Coordinate pair format, short: {latitude}, {longitude} */
+"COORD_FMT_SHORT" = "%1$@, %2$@";
+
+/* Minutes format, long */
+"COORD_MIN_LONG" = "%d minutė(s)";
+
+/* Minutes format, medium: {minutes} */
+"COORD_MIN_MEDIUM" = "%d′";
+
+/* Minutes format, short: {minutes} */
+"COORD_MIN_SHORT" = "%d′";
+
+/* North latitude format, long: {latitude} */
+"COORD_N_LONG" = "%@ šiaurės platumos";
+
+/* North latitude format, medium: {latitude} */
+"COORD_N_MEDIUM" = "%@ į šiaurę";
+
+/* North latitude format, short: {latitude} */
+"COORD_N_SHORT" = "%@Š";
+
+/* South latitude format, long: {latitude} */
+"COORD_S_LONG" = "%@ pietų platumos";
+
+/* South latitude format, medium: {latitude} */
+"COORD_S_MEDIUM" = "%@ į pietus";
+
+/* South latitude format, short: {latitude} */
+"COORD_S_SHORT" = "%@P";
+
+/* Seconds format, long */
+"COORD_SEC_LONG" = "%d sekundės(-ių)";
+
+/* Seconds format, medium: {seconds} */
+"COORD_SEC_MEDIUM" = "%d″";
+
+/* Seconds format, short: {seconds} */
+"COORD_SEC_SHORT" = "%d″";
+
+/* West longitude format, long: {longitude} */
+"COORD_W_LONG" = "%@ vakarų ilgumos";
+
+/* West longitude format, medium: {longitude} */
+"COORD_W_MEDIUM" = "%@ į vakarus";
+
+/* West longitude format, short: {longitude} */
+"COORD_W_SHORT" = "%@V";
+
diff --git a/platform/darwin/resources/lt.lproj/Foundation.stringsdict b/platform/darwin/resources/lt.lproj/Foundation.stringsdict
new file mode 100644
index 0000000000..e3bb31838a
--- /dev/null
+++ b/platform/darwin/resources/lt.lproj/Foundation.stringsdict
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>COORD_DEG_LONG</key>
+ <dict>
+ <key>NSStringLocalizedFormatKey</key>
+ <string>%#@degrees@</string>
+ <key>degrees</key>
+ <dict>
+ <key>NSStringFormatSpecTypeKey</key>
+ <string>NSStringPluralRuleType</string>
+ <key>NSStringFormatValueTypeKey</key>
+ <string>d</string>
+ <key>one</key>
+ <string>%d laipsniai</string>
+ <key>few</key>
+ <string>%d laipsniai</string>
+ <key>many</key>
+ <string>%d laipsniai</string>
+ <key>other</key>
+ <string>%d laipsnių</string>
+ </dict>
+ </dict>
+ <key>COORD_MIN_LONG</key>
+ <dict>
+ <key>NSStringLocalizedFormatKey</key>
+ <string>%#@minutes@</string>
+ <key>minutes</key>
+ <dict>
+ <key>NSStringFormatSpecTypeKey</key>
+ <string>NSStringPluralRuleType</string>
+ <key>NSStringFormatValueTypeKey</key>
+ <string>d</string>
+ <key>one</key>
+ <string>%d minutė</string>
+ <key>few</key>
+ <string>%d minutės</string>
+ <key>many</key>
+ <string>%d minutės</string>
+ <key>other</key>
+ <string>%d minučių</string>
+ </dict>
+ </dict>
+ <key>COORD_SEC_LONG</key>
+ <dict>
+ <key>NSStringLocalizedFormatKey</key>
+ <string>%#@seconds@</string>
+ <key>seconds</key>
+ <dict>
+ <key>NSStringFormatSpecTypeKey</key>
+ <string>NSStringPluralRuleType</string>
+ <key>NSStringFormatValueTypeKey</key>
+ <string>d</string>
+ <key>one</key>
+ <string>%d sekundė</string>
+ <key>few</key>
+ <string>%d sekundės</string>
+ <key>many</key>
+ <string>%d sekundės</string>
+ <key>other</key>
+ <string>%d sekundžių</string>
+ </dict>
+ </dict>
+</dict>
+</plist>
diff --git a/platform/darwin/resources/pl.lproj/Foundation.stringsdict b/platform/darwin/resources/pl.lproj/Foundation.stringsdict
index 016ba06b81..5a4f208562 100644
--- a/platform/darwin/resources/pl.lproj/Foundation.stringsdict
+++ b/platform/darwin/resources/pl.lproj/Foundation.stringsdict
@@ -18,6 +18,8 @@
<string>%d stopnie</string>
<key>many</key>
<string>%d stopni</string>
+ <key>other</key>
+ <string>%d stopnia</string>
</dict>
</dict>
<key>COORD_MIN_LONG</key>
@@ -36,6 +38,8 @@
<string>%d minuty</string>
<key>many</key>
<string>%d minut</string>
+ <key>other</key>
+ <string>%d minuty</string>
</dict>
</dict>
<key>COORD_SEC_LONG</key>
@@ -54,6 +58,8 @@
<string>%d sekundy</string>
<key>many</key>
<string>%d sekund</string>
+ <key>other</key>
+ <string>%d sekundy</string>
</dict>
</dict>
</dict>
diff --git a/platform/darwin/resources/ru.lproj/Foundation.stringsdict b/platform/darwin/resources/ru.lproj/Foundation.stringsdict
index b2d7467fd4..337cea0164 100644
--- a/platform/darwin/resources/ru.lproj/Foundation.stringsdict
+++ b/platform/darwin/resources/ru.lproj/Foundation.stringsdict
@@ -18,6 +18,8 @@
<string>%d градуса</string>
<key>many</key>
<string>%d градусов</string>
+ <key>other</key>
+ <string>%d градуса</string>
</dict>
</dict>
<key>COORD_MIN_LONG</key>
@@ -36,6 +38,8 @@
<string>%d минуты</string>
<key>many</key>
<string>%d минут</string>
+ <key>other</key>
+ <string>%d минуты</string>
</dict>
</dict>
<key>COORD_SEC_LONG</key>
@@ -54,6 +58,8 @@
<string>%d секунды</string>
<key>many</key>
<string>%d секунд</string>
+ <key>other</key>
+ <string>%d секунды</string>
</dict>
</dict>
</dict>
diff --git a/platform/darwin/resources/uk.lproj/Foundation.stringsdict b/platform/darwin/resources/uk.lproj/Foundation.stringsdict
index 76dbbfc5e9..f35f0516e1 100644
--- a/platform/darwin/resources/uk.lproj/Foundation.stringsdict
+++ b/platform/darwin/resources/uk.lproj/Foundation.stringsdict
@@ -18,6 +18,8 @@
<string>%d градуси</string>
<key>many</key>
<string>%d градусів</string>
+ <key>other</key>
+ <string>%d градуса</string>
</dict>
</dict>
<key>COORD_MIN_LONG</key>
@@ -31,11 +33,13 @@
<key>NSStringFormatValueTypeKey</key>
<string>d</string>
<key>one</key>
- <string>%d хвилина</string>
+ <string>%d мінута</string>
<key>few</key>
- <string>%d хвилини</string>
+ <string>%d мінути</string>
<key>many</key>
- <string>%d хвилин</string>
+ <string>%d мінут</string>
+ <key>other</key>
+ <string>%d мінути</string>
</dict>
</dict>
<key>COORD_SEC_LONG</key>
@@ -54,6 +58,8 @@
<string>%d секунди</string>
<key>many</key>
<string>%d секунд</string>
+ <key>other</key>
+ <string>%d секунди</string>
</dict>
</dict>
</dict>
diff --git a/platform/darwin/scripts/generate-style-code.js b/platform/darwin/scripts/generate-style-code.js
index cacca57700..9c4569709d 100644
--- a/platform/darwin/scripts/generate-style-code.js
+++ b/platform/darwin/scripts/generate-style-code.js
@@ -184,7 +184,7 @@ global.testGetterImplementation = function (property, layerType, isFunction) {
if (isFunction) {
return `XCTAssertEqualObjects(gLayer.${objCName(property)}, ${value});`;
}
- return `XCTAssert([gLayer.${objCName(property)} isKindOfClass:[MGLStyleConstantValue class]]);
+ return `XCTAssert([gLayer.${objCName(property)} isKindOfClass:[MGLConstantStyleValue class]]);
XCTAssertEqualObjects(gLayer.${objCName(property)}, ${value});`;
}
return `XCTAssertEqualObjects(gLayer.${objCName(property)}, ${value});`;
@@ -281,7 +281,7 @@ global.propertyDoc = function (propertyName, property, layerType, kind) {
doc += `\n\nThis attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#${anchor}"><code>${property.original}</code></a> layout property in the Mapbox Style Specification.`;
}
doc += '\n\nYou can set this property to an instance of:\n\n' +
- '* `MGLStyleConstantValue`\n';
+ '* `MGLConstantStyleValue`\n';
if (property["property-function"]) {
doc += '* `MGLCameraStyleFunction` with an interpolation mode of:\n' +
' * `MGLInterpolationModeExponential`\n' +
@@ -528,6 +528,7 @@ const layerH = ejs.compile(fs.readFileSync('platform/darwin/src/MGLStyleLayer.h.
const layerM = ejs.compile(fs.readFileSync('platform/darwin/src/MGLStyleLayer.mm.ejs', 'utf8'), { strict: true});
const testLayers = ejs.compile(fs.readFileSync('platform/darwin/test/MGLStyleLayerTests.mm.ejs', 'utf8'), { strict: true});
const guideMD = ejs.compile(fs.readFileSync('platform/darwin/docs/guides/For Style Authors.md.ejs', 'utf8'), { strict: true });
+const ddsGuideMD = ejs.compile(fs.readFileSync('platform/darwin/docs/guides/Data-Driven Styling.md.ejs', 'utf8'), { strict: true });
const layers = _(spec.layer.type.values).map((value, layerType) => {
const layoutProperties = Object.keys(spec[`layout_${layerType}`]).reduce((memo, name) => {
@@ -614,3 +615,9 @@ fs.writeFileSync(`platform/macos/docs/guides/For Style Authors.md`, guideMD({
renamedProperties: renamedPropertiesByLayerType,
layers: layers,
}));
+fs.writeFileSync(`platform/ios/docs/guides/Data-Driven Styling.md`, ddsGuideMD({
+ os: 'iOS',
+}));
+fs.writeFileSync(`platform/macos/docs/guides/Data-Driven Styling.md`, ddsGuideMD({
+ os: 'macOS',
+}));
diff --git a/platform/darwin/src/MGLAttributionInfo_Private.h b/platform/darwin/src/MGLAttributionInfo_Private.h
index 4b28fa5266..08bc6bfc4d 100644
--- a/platform/darwin/src/MGLAttributionInfo_Private.h
+++ b/platform/darwin/src/MGLAttributionInfo_Private.h
@@ -30,7 +30,6 @@ NS_ASSUME_NONNULL_BEGIN
redundant to the given object is replaced by the given object.
@param info The info object to add to the receiver.
- @return True if the given info object was added to the receiver.
*/
- (void)growArrayByAddingAttributionInfo:(MGLAttributionInfo *)info;
diff --git a/platform/darwin/src/MGLBackgroundStyleLayer.h b/platform/darwin/src/MGLBackgroundStyleLayer.h
index c6fd6113cb..cd218d9fb4 100644
--- a/platform/darwin/src/MGLBackgroundStyleLayer.h
+++ b/platform/darwin/src/MGLBackgroundStyleLayer.h
@@ -1,5 +1,5 @@
// This file is generated.
-// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLFoundation.h"
#import "MGLStyleValue.h"
@@ -41,7 +41,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -60,7 +60,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -69,6 +69,13 @@ MGL_EXPORT
#endif
/**
+ The transition affecting any changes to this layer’s `backgroundColor` property.
+
+ This property corresponds to the `background-color-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition backgroundColorTransition;
+
+/**
The opacity at which the background will be drawn.
The default value of this property is an `MGLStyleValue` object containing an
@@ -77,7 +84,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -85,18 +92,32 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *backgroundOpacity;
/**
+ The transition affecting any changes to this layer’s `backgroundOpacity` property.
+
+ This property corresponds to the `background-opacity-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition backgroundOpacityTransition;
+
+/**
Name of image in style images to use for drawing an image background. For
seamless patterns, image width and height must be a factor of two (2, 4, 8,
..., 512).
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSString *> *backgroundPattern;
+/**
+ The transition affecting any changes to this layer’s `backgroundPattern` property.
+
+ This property corresponds to the `background-pattern-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition backgroundPatternTransition;
+
@end
NS_ASSUME_NONNULL_END
diff --git a/platform/darwin/src/MGLBackgroundStyleLayer.mm b/platform/darwin/src/MGLBackgroundStyleLayer.mm
index bcad0aa11b..8f416a0ea2 100644
--- a/platform/darwin/src/MGLBackgroundStyleLayer.mm
+++ b/platform/darwin/src/MGLBackgroundStyleLayer.mm
@@ -4,6 +4,7 @@
#import "MGLSource.h"
#import "MGLMapView_Private.h"
#import "NSPredicate+MGLAdditions.h"
+#import "NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#import "MGLStyleValue_Private.h"
#import "MGLBackgroundStyleLayer.h"
@@ -101,6 +102,24 @@
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toStyleValue(propertyValue);
}
+- (void)setBackgroundColorTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setBackgroundColorTransition(options);
+}
+
+- (MGLTransition)backgroundColorTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getBackgroundColorTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setBackgroundOpacity:(MGLStyleValue<NSNumber *> *)backgroundOpacity {
MGLAssertStyleLayerIsValid();
@@ -118,6 +137,24 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
+- (void)setBackgroundOpacityTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setBackgroundOpacityTransition(options);
+}
+
+- (MGLTransition)backgroundOpacityTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getBackgroundOpacityTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setBackgroundPattern:(MGLStyleValue<NSString *> *)backgroundPattern {
MGLAssertStyleLayerIsValid();
@@ -135,5 +172,22 @@
return MGLStyleValueTransformer<std::string, NSString *>().toStyleValue(propertyValue);
}
+- (void)setBackgroundPatternTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setBackgroundPatternTransition(options);
+}
+
+- (MGLTransition)backgroundPatternTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getBackgroundPatternTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
@end
diff --git a/platform/darwin/src/MGLCircleStyleLayer.h b/platform/darwin/src/MGLCircleStyleLayer.h
index b3e9ee7161..69c823a868 100644
--- a/platform/darwin/src/MGLCircleStyleLayer.h
+++ b/platform/darwin/src/MGLCircleStyleLayer.h
@@ -1,5 +1,5 @@
// This file is generated.
-// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLFoundation.h"
#import "MGLStyleValue.h"
@@ -91,7 +91,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -107,6 +107,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *circleBlur;
+/**
+ The transition affecting any changes to this layer’s `circleBlur` property.
+
+ This property corresponds to the `circle-blur-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition circleBlurTransition;
+
#if TARGET_OS_IPHONE
/**
The fill color of the circle.
@@ -117,7 +124,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -142,7 +149,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -160,6 +167,13 @@ MGL_EXPORT
#endif
/**
+ The transition affecting any changes to this layer’s `circleColor` property.
+
+ This property corresponds to the `circle-color-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition circleColorTransition;
+
+/**
The opacity at which the circle will be drawn.
The default value of this property is an `MGLStyleValue` object containing an
@@ -168,7 +182,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -185,6 +199,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *circleOpacity;
/**
+ The transition affecting any changes to this layer’s `circleOpacity` property.
+
+ This property corresponds to the `circle-opacity-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition circleOpacityTransition;
+
+/**
Circle radius.
This property is measured in points.
@@ -195,7 +216,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -212,6 +233,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *circleRadius;
/**
+ The transition affecting any changes to this layer’s `circleRadius` property.
+
+ This property corresponds to the `circle-radius-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition circleRadiusTransition;
+
+/**
Controls the scaling behavior of the circle when the map is pitched.
The default value of this property is an `MGLStyleValue` object containing an
@@ -224,7 +252,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -242,7 +270,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -267,7 +295,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -285,6 +313,13 @@ MGL_EXPORT
#endif
/**
+ The transition affecting any changes to this layer’s `circleStrokeColor` property.
+
+ This property corresponds to the `circle-stroke-color-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition circleStrokeColorTransition;
+
+/**
The opacity of the circle's stroke.
The default value of this property is an `MGLStyleValue` object containing an
@@ -293,7 +328,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -310,6 +345,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *circleStrokeOpacity;
/**
+ The transition affecting any changes to this layer’s `circleStrokeOpacity` property.
+
+ This property corresponds to the `circle-stroke-opacity-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition circleStrokeOpacityTransition;
+
+/**
The width of the circle's stroke. Strokes are placed outside of the
`circleRadius`.
@@ -321,7 +363,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -337,6 +379,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *circleStrokeWidth;
+/**
+ The transition affecting any changes to this layer’s `circleStrokeWidth` property.
+
+ This property corresponds to the `circle-stroke-width-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition circleStrokeWidthTransition;
+
#if TARGET_OS_IPHONE
/**
The geometry's offset.
@@ -353,7 +402,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -375,7 +424,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -383,6 +432,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *circleTranslation;
#endif
+/**
+ The transition affecting any changes to this layer’s `circleTranslation` property.
+
+ This property corresponds to the `circle-translate-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition circleTranslationTransition;
+
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *circleTranslate __attribute__((unavailable("Use circleTranslation instead.")));
/**
@@ -401,7 +457,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
diff --git a/platform/darwin/src/MGLCircleStyleLayer.mm b/platform/darwin/src/MGLCircleStyleLayer.mm
index 808e00bc38..330b9cdac0 100644
--- a/platform/darwin/src/MGLCircleStyleLayer.mm
+++ b/platform/darwin/src/MGLCircleStyleLayer.mm
@@ -4,6 +4,7 @@
#import "MGLSource.h"
#import "MGLMapView_Private.h"
#import "NSPredicate+MGLAdditions.h"
+#import "NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#import "MGLStyleValue_Private.h"
#import "MGLCircleStyleLayer.h"
@@ -151,6 +152,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setCircleBlurTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setCircleBlurTransition(options);
+}
+
+- (MGLTransition)circleBlurTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getCircleBlurTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setCircleColor:(MGLStyleValue<MGLColor *> *)circleColor {
MGLAssertStyleLayerIsValid();
@@ -168,6 +187,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setCircleColorTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setCircleColorTransition(options);
+}
+
+- (MGLTransition)circleColorTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getCircleColorTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setCircleOpacity:(MGLStyleValue<NSNumber *> *)circleOpacity {
MGLAssertStyleLayerIsValid();
@@ -185,6 +222,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setCircleOpacityTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setCircleOpacityTransition(options);
+}
+
+- (MGLTransition)circleOpacityTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getCircleOpacityTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setCircleRadius:(MGLStyleValue<NSNumber *> *)circleRadius {
MGLAssertStyleLayerIsValid();
@@ -202,6 +257,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setCircleRadiusTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setCircleRadiusTransition(options);
+}
+
+- (MGLTransition)circleRadiusTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getCircleRadiusTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setCircleScaleAlignment:(MGLStyleValue<NSValue *> *)circleScaleAlignment {
MGLAssertStyleLayerIsValid();
@@ -243,6 +316,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setCircleStrokeColorTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setCircleStrokeColorTransition(options);
+}
+
+- (MGLTransition)circleStrokeColorTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getCircleStrokeColorTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setCircleStrokeOpacity:(MGLStyleValue<NSNumber *> *)circleStrokeOpacity {
MGLAssertStyleLayerIsValid();
@@ -260,6 +351,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setCircleStrokeOpacityTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setCircleStrokeOpacityTransition(options);
+}
+
+- (MGLTransition)circleStrokeOpacityTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getCircleStrokeOpacityTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setCircleStrokeWidth:(MGLStyleValue<NSNumber *> *)circleStrokeWidth {
MGLAssertStyleLayerIsValid();
@@ -277,6 +386,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setCircleStrokeWidthTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setCircleStrokeWidthTransition(options);
+}
+
+- (MGLTransition)circleStrokeWidthTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getCircleStrokeWidthTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setCircleTranslation:(MGLStyleValue<NSValue *> *)circleTranslation {
MGLAssertStyleLayerIsValid();
@@ -294,6 +421,24 @@ namespace mbgl {
return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
+- (void)setCircleTranslationTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setCircleTranslateTransition(options);
+}
+
+- (MGLTransition)circleTranslationTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getCircleTranslateTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setCircleTranslate:(MGLStyleValue<NSValue *> *)circleTranslate {
}
@@ -325,7 +470,6 @@ namespace mbgl {
return self.circleTranslationAnchor;
}
-
@end
@implementation NSValue (MGLCircleStyleLayerAdditions)
diff --git a/platform/darwin/src/MGLFeature.h b/platform/darwin/src/MGLFeature.h
index 2380a817e3..491c89b608 100644
--- a/platform/darwin/src/MGLFeature.h
+++ b/platform/darwin/src/MGLFeature.h
@@ -229,6 +229,12 @@ MGL_EXPORT
/**
An `MGLShapeCollectionFeature` object associates a shape collection with an
optional identifier and attributes.
+
+ `MGLShapeCollectionFeature` is most commonly used to add multiple shapes to a single
+ `MGLShapeSource`. Configure the appearance of an `MGLSource`’s shape collection
+ collectively using an `MGLSymbolStyleLayer` object, or use multiple instances of
+ `MGLCircleStyleLayer`, `MGLFillStyleLayer`, and `MGLLineStyleLayer` to
+ configure the appearance of each kind of shape inside the collection.
A shape collection feature is known as a
<a href="https://tools.ietf.org/html/rfc7946#section-3.3">feature collection</a>
diff --git a/platform/darwin/src/MGLFillStyleLayer.h b/platform/darwin/src/MGLFillStyleLayer.h
index a5baf2308c..1f3cfc8af5 100644
--- a/platform/darwin/src/MGLFillStyleLayer.h
+++ b/platform/darwin/src/MGLFillStyleLayer.h
@@ -1,5 +1,5 @@
// This file is generated.
-// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLFoundation.h"
#import "MGLStyleValue.h"
@@ -67,7 +67,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -88,7 +88,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -116,7 +116,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -134,6 +134,13 @@ MGL_EXPORT
#endif
/**
+ The transition affecting any changes to this layer’s `fillColor` property.
+
+ This property corresponds to the `fill-color-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition fillColorTransition;
+
+/**
The opacity of the entire fill layer. In contrast to the `fillColor`, this
value will also affect the 1pt stroke around the fill, if the stroke is used.
@@ -143,7 +150,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -159,6 +166,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *fillOpacity;
+/**
+ The transition affecting any changes to this layer’s `fillOpacity` property.
+
+ This property corresponds to the `fill-opacity-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition fillOpacityTransition;
+
#if TARGET_OS_IPHONE
/**
The outline color of the fill. Matches the value of `fillColor` if unspecified.
@@ -169,7 +183,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -194,7 +208,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -212,17 +226,31 @@ MGL_EXPORT
#endif
/**
+ The transition affecting any changes to this layer’s `fillOutlineColor` property.
+
+ This property corresponds to the `fill-outline-color-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition fillOutlineColorTransition;
+
+/**
Name of image in sprite to use for drawing image fills. For seamless patterns,
image width and height must be a factor of two (2, 4, 8, ..., 512).
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSString *> *fillPattern;
+/**
+ The transition affecting any changes to this layer’s `fillPattern` property.
+
+ This property corresponds to the `fill-pattern-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition fillPatternTransition;
+
#if TARGET_OS_IPHONE
/**
The geometry's offset.
@@ -239,7 +267,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -261,7 +289,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -269,6 +297,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *fillTranslation;
#endif
+/**
+ The transition affecting any changes to this layer’s `fillTranslation` property.
+
+ This property corresponds to the `fill-translate-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition fillTranslationTransition;
+
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *fillTranslate __attribute__((unavailable("Use fillTranslation instead.")));
/**
@@ -287,7 +322,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
diff --git a/platform/darwin/src/MGLFillStyleLayer.mm b/platform/darwin/src/MGLFillStyleLayer.mm
index 6716e0efb1..1322a7a0b6 100644
--- a/platform/darwin/src/MGLFillStyleLayer.mm
+++ b/platform/darwin/src/MGLFillStyleLayer.mm
@@ -4,6 +4,7 @@
#import "MGLSource.h"
#import "MGLMapView_Private.h"
#import "NSPredicate+MGLAdditions.h"
+#import "NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#import "MGLStyleValue_Private.h"
#import "MGLFillStyleLayer.h"
@@ -170,6 +171,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setFillColorTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setFillColorTransition(options);
+}
+
+- (MGLTransition)fillColorTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getFillColorTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setFillOpacity:(MGLStyleValue<NSNumber *> *)fillOpacity {
MGLAssertStyleLayerIsValid();
@@ -187,6 +206,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setFillOpacityTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setFillOpacityTransition(options);
+}
+
+- (MGLTransition)fillOpacityTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getFillOpacityTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setFillOutlineColor:(MGLStyleValue<MGLColor *> *)fillOutlineColor {
MGLAssertStyleLayerIsValid();
@@ -204,6 +241,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setFillOutlineColorTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setFillOutlineColorTransition(options);
+}
+
+- (MGLTransition)fillOutlineColorTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getFillOutlineColorTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setFillPattern:(MGLStyleValue<NSString *> *)fillPattern {
MGLAssertStyleLayerIsValid();
@@ -221,6 +276,24 @@ namespace mbgl {
return MGLStyleValueTransformer<std::string, NSString *>().toStyleValue(propertyValue);
}
+- (void)setFillPatternTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setFillPatternTransition(options);
+}
+
+- (MGLTransition)fillPatternTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getFillPatternTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setFillTranslation:(MGLStyleValue<NSValue *> *)fillTranslation {
MGLAssertStyleLayerIsValid();
@@ -238,6 +311,24 @@ namespace mbgl {
return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
+- (void)setFillTranslationTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setFillTranslateTransition(options);
+}
+
+- (MGLTransition)fillTranslationTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getFillTranslateTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setFillTranslate:(MGLStyleValue<NSValue *> *)fillTranslate {
}
@@ -269,7 +360,6 @@ namespace mbgl {
return self.fillTranslationAnchor;
}
-
@end
@implementation NSValue (MGLFillStyleLayerAdditions)
diff --git a/platform/darwin/src/MGLLineStyleLayer.h b/platform/darwin/src/MGLLineStyleLayer.h
index 23a1f8f131..e03f3e347e 100644
--- a/platform/darwin/src/MGLLineStyleLayer.h
+++ b/platform/darwin/src/MGLLineStyleLayer.h
@@ -1,5 +1,5 @@
// This file is generated.
-// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLFoundation.h"
#import "MGLStyleValue.h"
@@ -118,7 +118,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -133,7 +133,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -152,7 +152,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -172,7 +172,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -192,7 +192,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -208,6 +208,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *lineBlur;
+/**
+ The transition affecting any changes to this layer’s `lineBlur` property.
+
+ This property corresponds to the `line-blur-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition lineBlurTransition;
+
#if TARGET_OS_IPHONE
/**
The color with which the line will be drawn.
@@ -221,7 +228,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -249,7 +256,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -267,6 +274,13 @@ MGL_EXPORT
#endif
/**
+ The transition affecting any changes to this layer’s `lineColor` property.
+
+ This property corresponds to the `line-color-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition lineColorTransition;
+
+/**
Specifies the lengths of the alternating dashes and gaps that form the dash
pattern. The lengths are later scaled by the line width. To convert a dash
length to points, multiply the length by the current line width.
@@ -282,12 +296,19 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSArray<NSNumber *> *> *lineDashPattern;
+/**
+ The transition affecting any changes to this layer’s `lineDashPattern` property.
+
+ This property corresponds to the `line-dasharray-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition lineDashPatternTransition;
+
@property (nonatomic, null_resettable) MGLStyleValue<NSArray<NSNumber *> *> *lineDasharray __attribute__((unavailable("Use lineDashPattern instead.")));
/**
@@ -302,7 +323,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -319,6 +340,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *lineGapWidth;
/**
+ The transition affecting any changes to this layer’s `lineGapWidth` property.
+
+ This property corresponds to the `line-gap-width-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition lineGapWidthTransition;
+
+/**
The line's offset. For linear features, a positive value offsets the line to
the right, relative to the direction of the line, and a negative value to the
left. For polygon features, a positive value results in an inset, and a
@@ -332,7 +360,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -349,6 +377,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *lineOffset;
/**
+ The transition affecting any changes to this layer’s `lineOffset` property.
+
+ This property corresponds to the `line-offset-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition lineOffsetTransition;
+
+/**
The opacity at which the line will be drawn.
The default value of this property is an `MGLStyleValue` object containing an
@@ -357,7 +392,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -374,17 +409,31 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *lineOpacity;
/**
+ The transition affecting any changes to this layer’s `lineOpacity` property.
+
+ This property corresponds to the `line-opacity-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition lineOpacityTransition;
+
+/**
Name of image in style images to use for drawing image lines. For seamless
patterns, image width must be a factor of two (2, 4, 8, ..., 512).
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSString *> *linePattern;
+/**
+ The transition affecting any changes to this layer’s `linePattern` property.
+
+ This property corresponds to the `line-pattern-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition linePatternTransition;
+
#if TARGET_OS_IPHONE
/**
The geometry's offset.
@@ -401,7 +450,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -423,7 +472,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -431,6 +480,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *lineTranslation;
#endif
+/**
+ The transition affecting any changes to this layer’s `lineTranslation` property.
+
+ This property corresponds to the `line-translate-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition lineTranslationTransition;
+
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *lineTranslate __attribute__((unavailable("Use lineTranslation instead.")));
/**
@@ -449,7 +505,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -468,13 +524,20 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *lineWidth;
+/**
+ The transition affecting any changes to this layer’s `lineWidth` property.
+
+ This property corresponds to the `line-width-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition lineWidthTransition;
+
@end
/**
diff --git a/platform/darwin/src/MGLLineStyleLayer.mm b/platform/darwin/src/MGLLineStyleLayer.mm
index 80b1e907e6..e37489cf0b 100644
--- a/platform/darwin/src/MGLLineStyleLayer.mm
+++ b/platform/darwin/src/MGLLineStyleLayer.mm
@@ -4,6 +4,7 @@
#import "MGLSource.h"
#import "MGLMapView_Private.h"
#import "NSPredicate+MGLAdditions.h"
+#import "NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#import "MGLStyleValue_Private.h"
#import "MGLLineStyleLayer.h"
@@ -228,6 +229,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setLineBlurTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setLineBlurTransition(options);
+}
+
+- (MGLTransition)lineBlurTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLineBlurTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setLineColor:(MGLStyleValue<MGLColor *> *)lineColor {
MGLAssertStyleLayerIsValid();
@@ -245,6 +264,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setLineColorTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setLineColorTransition(options);
+}
+
+- (MGLTransition)lineColorTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLineColorTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setLineDashPattern:(MGLStyleValue<NSArray<NSNumber *> *> *)lineDashPattern {
MGLAssertStyleLayerIsValid();
@@ -262,6 +299,24 @@ namespace mbgl {
return MGLStyleValueTransformer<std::vector<float>, NSArray<NSNumber *> *, float>().toStyleValue(propertyValue);
}
+- (void)setLineDashPatternTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setLineDasharrayTransition(options);
+}
+
+- (MGLTransition)lineDashPatternTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLineDasharrayTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setLineDasharray:(MGLStyleValue<NSArray<NSNumber *> *> *)lineDasharray {
}
@@ -286,6 +341,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setLineGapWidthTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setLineGapWidthTransition(options);
+}
+
+- (MGLTransition)lineGapWidthTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLineGapWidthTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setLineOffset:(MGLStyleValue<NSNumber *> *)lineOffset {
MGLAssertStyleLayerIsValid();
@@ -303,6 +376,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setLineOffsetTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setLineOffsetTransition(options);
+}
+
+- (MGLTransition)lineOffsetTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLineOffsetTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setLineOpacity:(MGLStyleValue<NSNumber *> *)lineOpacity {
MGLAssertStyleLayerIsValid();
@@ -320,6 +411,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setLineOpacityTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setLineOpacityTransition(options);
+}
+
+- (MGLTransition)lineOpacityTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLineOpacityTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setLinePattern:(MGLStyleValue<NSString *> *)linePattern {
MGLAssertStyleLayerIsValid();
@@ -337,6 +446,24 @@ namespace mbgl {
return MGLStyleValueTransformer<std::string, NSString *>().toStyleValue(propertyValue);
}
+- (void)setLinePatternTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setLinePatternTransition(options);
+}
+
+- (MGLTransition)linePatternTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLinePatternTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setLineTranslation:(MGLStyleValue<NSValue *> *)lineTranslation {
MGLAssertStyleLayerIsValid();
@@ -354,6 +481,24 @@ namespace mbgl {
return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
+- (void)setLineTranslationTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setLineTranslateTransition(options);
+}
+
+- (MGLTransition)lineTranslationTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLineTranslateTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setLineTranslate:(MGLStyleValue<NSValue *> *)lineTranslate {
}
@@ -402,6 +547,23 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
+- (void)setLineWidthTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setLineWidthTransition(options);
+}
+
+- (MGLTransition)lineWidthTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLineWidthTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
@end
diff --git a/platform/darwin/src/MGLOfflineStorage.mm b/platform/darwin/src/MGLOfflineStorage.mm
index b65932c6e8..195ef3c36a 100644
--- a/platform/darwin/src/MGLOfflineStorage.mm
+++ b/platform/darwin/src/MGLOfflineStorage.mm
@@ -31,6 +31,7 @@ NSString * const MGLOfflinePackMaximumCountUserInfoKey = MGLOfflinePackUserInfoK
@property (nonatomic, strong, readwrite) NS_MUTABLE_ARRAY_OF(MGLOfflinePack *) *packs;
@property (nonatomic) mbgl::DefaultFileSource *mbglFileSource;
+@property (nonatomic, getter=isPaused) BOOL paused;
@end
@@ -53,11 +54,19 @@ NSString * const MGLOfflinePackMaximumCountUserInfoKey = MGLOfflinePackUserInfoK
#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
- (void)pauseFileSource:(__unused NSNotification *)notification {
+ if (self.isPaused) {
+ return;
+ }
_mbglFileSource->pause();
+ self.paused = YES;
}
- (void)unpauseFileSource:(__unused NSNotification *)notification {
+ if (!self.isPaused) {
+ return;
+ }
_mbglFileSource->resume();
+ self.paused = NO;
}
#endif
diff --git a/platform/darwin/src/MGLPolyline.mm b/platform/darwin/src/MGLPolyline.mm
index 454a1b964b..ae4fbe61de 100644
--- a/platform/darwin/src/MGLPolyline.mm
+++ b/platform/darwin/src/MGLPolyline.mm
@@ -48,6 +48,10 @@
@"coordinates": self.mgl_coordinates};
}
+- (BOOL)isEqual:(id)other {
+ return self == other || ([other isKindOfClass:[MGLPolyline class]] && [super isEqual:other]);
+}
+
@end
@interface MGLMultiPolyline ()
diff --git a/platform/darwin/src/MGLRasterStyleLayer.h b/platform/darwin/src/MGLRasterStyleLayer.h
index 9e876a6e3c..377b7f45cd 100644
--- a/platform/darwin/src/MGLRasterStyleLayer.h
+++ b/platform/darwin/src/MGLRasterStyleLayer.h
@@ -1,5 +1,5 @@
// This file is generated.
-// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLFoundation.h"
#import "MGLStyleValue.h"
@@ -52,13 +52,20 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *maximumRasterBrightness;
+/**
+ The transition affecting any changes to this layer’s `maximumRasterBrightness` property.
+
+ This property corresponds to the `raster-brightness-max-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition maximumRasterBrightnessTransition;
+
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterBrightnessMax __attribute__((unavailable("Use maximumRasterBrightness instead.")));
/**
@@ -75,13 +82,20 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *minimumRasterBrightness;
+/**
+ The transition affecting any changes to this layer’s `minimumRasterBrightness` property.
+
+ This property corresponds to the `raster-brightness-min-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition minimumRasterBrightnessTransition;
+
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterBrightnessMin __attribute__((unavailable("Use minimumRasterBrightness instead.")));
/**
@@ -93,7 +107,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -101,6 +115,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterContrast;
/**
+ The transition affecting any changes to this layer’s `rasterContrast` property.
+
+ This property corresponds to the `raster-contrast-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition rasterContrastTransition;
+
+/**
Fade duration when a new tile is added.
This property is measured in milliseconds.
@@ -111,7 +132,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -119,6 +140,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterFadeDuration;
/**
+ The transition affecting any changes to this layer’s `rasterFadeDuration` property.
+
+ This property corresponds to the `raster-fade-duration-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition rasterFadeDurationTransition;
+
+/**
Rotates hues around the color wheel.
This property is measured in degrees.
@@ -133,13 +161,20 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterHueRotation;
+/**
+ The transition affecting any changes to this layer’s `rasterHueRotation` property.
+
+ This property corresponds to the `raster-hue-rotate-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition rasterHueRotationTransition;
+
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterHueRotate __attribute__((unavailable("Use rasterHueRotation instead.")));
/**
@@ -151,7 +186,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -159,6 +194,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterOpacity;
/**
+ The transition affecting any changes to this layer’s `rasterOpacity` property.
+
+ This property corresponds to the `raster-opacity-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition rasterOpacityTransition;
+
+/**
Increase or reduce the saturation of the image.
The default value of this property is an `MGLStyleValue` object containing an
@@ -167,13 +209,20 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterSaturation;
+/**
+ The transition affecting any changes to this layer’s `rasterSaturation` property.
+
+ This property corresponds to the `raster-saturation-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition rasterSaturationTransition;
+
@end
NS_ASSUME_NONNULL_END
diff --git a/platform/darwin/src/MGLRasterStyleLayer.mm b/platform/darwin/src/MGLRasterStyleLayer.mm
index 2108a5a0c8..80508e4e70 100644
--- a/platform/darwin/src/MGLRasterStyleLayer.mm
+++ b/platform/darwin/src/MGLRasterStyleLayer.mm
@@ -4,6 +4,7 @@
#import "MGLSource.h"
#import "MGLMapView_Private.h"
#import "NSPredicate+MGLAdditions.h"
+#import "NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#import "MGLStyleValue_Private.h"
#import "MGLRasterStyleLayer.h"
@@ -108,6 +109,24 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
+- (void)setMaximumRasterBrightnessTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setRasterBrightnessMaxTransition(options);
+}
+
+- (MGLTransition)maximumRasterBrightnessTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getRasterBrightnessMaxTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setRasterBrightnessMax:(MGLStyleValue<NSNumber *> *)rasterBrightnessMax {
}
@@ -132,6 +151,24 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
+- (void)setMinimumRasterBrightnessTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setRasterBrightnessMinTransition(options);
+}
+
+- (MGLTransition)minimumRasterBrightnessTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getRasterBrightnessMinTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setRasterBrightnessMin:(MGLStyleValue<NSNumber *> *)rasterBrightnessMin {
}
@@ -156,6 +193,24 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
+- (void)setRasterContrastTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setRasterContrastTransition(options);
+}
+
+- (MGLTransition)rasterContrastTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getRasterContrastTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setRasterFadeDuration:(MGLStyleValue<NSNumber *> *)rasterFadeDuration {
MGLAssertStyleLayerIsValid();
@@ -173,6 +228,24 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
+- (void)setRasterFadeDurationTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setRasterFadeDurationTransition(options);
+}
+
+- (MGLTransition)rasterFadeDurationTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getRasterFadeDurationTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setRasterHueRotation:(MGLStyleValue<NSNumber *> *)rasterHueRotation {
MGLAssertStyleLayerIsValid();
@@ -190,6 +263,24 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
+- (void)setRasterHueRotationTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setRasterHueRotateTransition(options);
+}
+
+- (MGLTransition)rasterHueRotationTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getRasterHueRotateTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setRasterHueRotate:(MGLStyleValue<NSNumber *> *)rasterHueRotate {
}
@@ -214,6 +305,24 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
+- (void)setRasterOpacityTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setRasterOpacityTransition(options);
+}
+
+- (MGLTransition)rasterOpacityTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getRasterOpacityTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setRasterSaturation:(MGLStyleValue<NSNumber *> *)rasterSaturation {
MGLAssertStyleLayerIsValid();
@@ -231,5 +340,22 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
+- (void)setRasterSaturationTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setRasterSaturationTransition(options);
+}
+
+- (MGLTransition)rasterSaturationTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getRasterSaturationTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
@end
diff --git a/platform/darwin/src/MGLShapeSource.h b/platform/darwin/src/MGLShapeSource.h
index 07045490bd..d0097f748e 100644
--- a/platform/darwin/src/MGLShapeSource.h
+++ b/platform/darwin/src/MGLShapeSource.h
@@ -211,18 +211,32 @@ MGL_EXPORT
@property (nonatomic, copy, nullable) NSURL *URL;
/**
- Returns an array of map features for this source, filtered by the given predicate.
+ Returns an array of map features for this source, filtered by the given
+ predicate.
Each object in the returned array represents a feature for the current style
- and provides access to attributes specified by the source
+ and provides access to attributes specified via the `shape` property.
Features come from tiled GeoJSON data that is converted to tiles internally,
so feature geometries are clipped at tile boundaries and features
- may appear duplicated across tiles.
-
- @param predicate A predicate to filter the returned features.
+ may appear duplicated across tiles. For example, suppose this source contains a
+ long polyline representing a road. The resulting array includes those parts of
+ the road that lie within the map tiles that the source has loaded, even if the
+ road extends into other tiles. The portion of the road within each map tile is
+ included individually.
+
+ Returned features may not necessarily be visible to the user at the time they
+ are loaded: the style may lack a layer that draws the features in question. To
+ obtain only _visible_ features, use the
+ `-[MGLMapView visibleFeaturesAtPoint:inStyleLayersWithIdentifiers:predicate:]`
+ or
+ `-[MGLMapView visibleFeaturesInRect:inStyleLayersWithIdentifiers:predicate:]`
+ method.
+
+ @param predicate A predicate to filter the returned features. Use `nil` to
+ include all features in the source.
@return An array of objects conforming to the `MGLFeature` protocol that
- represent features in the sources used by the current style.
+ represent features in the source that match the predicate.
*/
- (NS_ARRAY_OF(id <MGLFeature>) *)featuresMatchingPredicate:(nullable NSPredicate *)predicate;
diff --git a/platform/darwin/src/MGLStyle.h b/platform/darwin/src/MGLStyle.h
index 689faf78cf..bd17fdec44 100644
--- a/platform/darwin/src/MGLStyle.h
+++ b/platform/darwin/src/MGLStyle.h
@@ -194,6 +194,12 @@ MGL_EXPORT
@property (nonatomic, strong) NS_SET_OF(__kindof MGLSource *) *sources;
/**
+ Values describing animated transitions to changes on a style's individual
+ paint properties.
+ */
+@property (nonatomic) MGLTransition transition;
+
+/**
Returns a source with the given identifier in the current style.
@note Source identifiers are not guaranteed to exist across styles or different
@@ -442,22 +448,6 @@ MGL_EXPORT
*/
- (void)removeImageForName:(NSString *)name;
-#pragma mark Managing a Style’s Transition Options
-
-/**
- The duration in seconds to animate any changes to the style URL or to layout and paint attributes.
-
- By default, this property is set to zero seconds, so any changes take effect without animation.
- */
-@property (nonatomic) NSTimeInterval transitionDuration;
-
-/**
- The delay in seconds to before applying any changes to the style URL or to layout and paint attributes.
-
- By default, this property is set to zero seconds, so any changes begin to animate immediately.
- */
-@property (nonatomic) NSTimeInterval transitionDelay;
-
@end
NS_ASSUME_NONNULL_END
diff --git a/platform/darwin/src/MGLStyle.mm b/platform/darwin/src/MGLStyle.mm
index bcb8100800..aa493d9ef7 100644
--- a/platform/darwin/src/MGLStyle.mm
+++ b/platform/darwin/src/MGLStyle.mm
@@ -341,10 +341,10 @@ static NSURL *MGLStyleURL_emerald;
styleLayer = [[MGLCircleStyleLayer alloc] initWithIdentifier:identifier source:source];
} else if (mbglLayer->is<mbgl::style::BackgroundLayer>()) {
styleLayer = [[MGLBackgroundStyleLayer alloc] initWithIdentifier:identifier];
- } else if (auto customLayer = mbglLayer->as<mbgl::style::CustomLayer>()) {
+ } else if (mbglLayer->is<mbgl::style::CustomLayer>()) {
styleLayer = self.openGLLayers[identifier];
if (styleLayer) {
- NSAssert(styleLayer.rawLayer == customLayer, @"%@ wraps a CustomLayer that differs from the one associated with the underlying style.", styleLayer);
+ NSAssert(styleLayer.rawLayer == mbglLayer->as<mbgl::style::CustomLayer>(), @"%@ wraps a CustomLayer that differs from the one associated with the underlying style.", styleLayer);
return styleLayer;
}
styleLayer = [[MGLOpenGLStyleLayer alloc] initWithIdentifier:identifier];
@@ -502,7 +502,7 @@ static NSURL *MGLStyleURL_emerald;
newAppliedClasses.push_back([appliedClass UTF8String]);
}
- mbgl::style::TransitionOptions transition { { MGLDurationInSecondsFromTimeInterval(transitionDuration) } };
+ mbgl::style::TransitionOptions transition { { MGLDurationFromTimeInterval(transitionDuration) } };
self.mapView.mbglMap->setTransitionOptions(transition);
self.mapView.mbglMap->setClasses(newAppliedClasses);
}
@@ -572,30 +572,24 @@ static NSURL *MGLStyleURL_emerald;
#pragma mark Style transitions
-- (void)setTransitionDuration:(NSTimeInterval)duration
+- (void)setTransition:(MGLTransition)transition
{
auto transitionOptions = self.mapView.mbglMap->getTransitionOptions();
- transitionOptions.duration = MGLDurationInSecondsFromTimeInterval(duration);
+ transitionOptions.duration = MGLDurationFromTimeInterval(transition.duration);
+ transitionOptions.delay = MGLDurationFromTimeInterval(transition.delay);
+
self.mapView.mbglMap->setTransitionOptions(transitionOptions);
}
-- (NSTimeInterval)transitionDuration
+- (MGLTransition)transition
{
+ MGLTransition transition;
const mbgl::style::TransitionOptions transitionOptions = self.mapView.mbglMap->getTransitionOptions();
- return MGLTimeIntervalFromDurationInSeconds(transitionOptions.duration.value_or(mbgl::Duration::zero()));
-}
-
-- (void)setTransitionDelay:(NSTimeInterval)delay
-{
- auto transitionOptions = self.mapView.mbglMap->getTransitionOptions();
- transitionOptions.delay = MGLDurationInSecondsFromTimeInterval(delay);
- self.mapView.mbglMap->setTransitionOptions(transitionOptions);
-}
-- (NSTimeInterval)transitionDelay
-{
- const mbgl::style::TransitionOptions transitionOptions = self.mapView.mbglMap->getTransitionOptions();
- return MGLTimeIntervalFromDurationInSeconds(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+
+ return transition;
}
- (NSString *)description
diff --git a/platform/darwin/src/MGLStyleLayer.h b/platform/darwin/src/MGLStyleLayer.h
index 55f1a56490..f81643edd7 100644
--- a/platform/darwin/src/MGLStyleLayer.h
+++ b/platform/darwin/src/MGLStyleLayer.h
@@ -18,6 +18,9 @@ NS_ASSUME_NONNULL_BEGIN
subclasses of this class. Instead, create instances of
`MGLBackgroundStyleLayer` and the concrete subclasses of
`MGLForegroundStyleLayer`.
+
+ Do not add `MGLStyleLayer` objects to the `style` property of a `MGLMapView` before
+ `-mapView:didFinishLoadingStyle:` is called.
*/
MGL_EXPORT
@interface MGLStyleLayer : NSObject
diff --git a/platform/darwin/src/MGLStyleLayer.h.ejs b/platform/darwin/src/MGLStyleLayer.h.ejs
index f0a4ba64a3..e6c60a76db 100644
--- a/platform/darwin/src/MGLStyleLayer.h.ejs
+++ b/platform/darwin/src/MGLStyleLayer.h.ejs
@@ -6,7 +6,7 @@
const enumProperties = locals.enumProperties;
-%>
// This file is generated.
-// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLFoundation.h"
#import "MGLStyleValue.h"
@@ -111,6 +111,15 @@ MGL_EXPORT
*/
@property (nonatomic<% if (!property.required) { %>, null_resettable<% } if (property.getter) { %>, getter=<%- objCGetter(property) -%><% } %>) MGLStyleValue<<%- propertyType(property, true) %>> *<%- camelizeWithLeadingLowercase(property.name) %>;
+<% if (property["transition"]) { -%>
+/**
+ The transition affecting any changes to this layer’s `<%- camelizeWithLeadingLowercase(property.name) %>` property.
+
+ This property corresponds to the `<%- originalPropertyName(property) %>-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition <%- camelizeWithLeadingLowercase(property.name) %>Transition;
+
+<% } -%>
<% if (property.original) { -%>
@property (nonatomic<% if (!property.required) { %>, null_resettable<% } %>) MGLStyleValue<<%- propertyType(property, true) %>> *<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %> __attribute__((unavailable("Use <%- camelizeWithLeadingLowercase(property.name) %> instead.")));
diff --git a/platform/darwin/src/MGLStyleLayer.mm.ejs b/platform/darwin/src/MGLStyleLayer.mm.ejs
index 24aff7fca8..1e5f3df160 100644
--- a/platform/darwin/src/MGLStyleLayer.mm.ejs
+++ b/platform/darwin/src/MGLStyleLayer.mm.ejs
@@ -10,6 +10,7 @@
#import "MGLSource.h"
#import "MGLMapView_Private.h"
#import "NSPredicate+MGLAdditions.h"
+#import "NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#import "MGLStyleValue_Private.h"
#import "MGL<%- camelize(type) %>StyleLayer.h"
@@ -228,8 +229,8 @@ namespace mbgl {
<% } -%>
<% if (paintProperties.length) { -%>
#pragma mark - Accessing the Paint Attributes
-
<% for (const property of paintProperties) { -%>
+
- (void)set<%- camelize(property.name) %>:(MGLStyleValue<<%- propertyType(property, true) %>> *)<%- objCName(property) %> {
MGLAssertStyleLayerIsValid();
@@ -270,15 +271,34 @@ namespace mbgl {
<% } -%>
<% } -%>
}
+<% if (property["transition"]) { -%>
+
+- (void)set<%- camelize(property.name) %>Transition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->set<%- camelize(originalPropertyName(property)) %>Transition(options);
+}
+
+- (MGLTransition)<%- objCGetter(property) %>Transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->get<%- camelize(originalPropertyName(property)) %>Transition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+<% } -%>
<% if (property.original) { -%>
+
- (void)set<%- camelize(originalPropertyName(property)) %>:(MGLStyleValue<<%- propertyType(property, true) %>> *)<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %> {
}
- (MGLStyleValue<<%- propertyType(property, true) %>> *)<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %> {
return self.<%- objCGetter(property) %>;
}
-
<% } -%>
<% } -%>
<% } -%>
diff --git a/platform/darwin/src/MGLStyleValue.h b/platform/darwin/src/MGLStyleValue.h
index 2ce2eae89a..70074c8a13 100644
--- a/platform/darwin/src/MGLStyleValue.h
+++ b/platform/darwin/src/MGLStyleValue.h
@@ -17,10 +17,10 @@ typedef NSString *MGLStyleFunctionOption NS_STRING_ENUM;
The exponential interpolation base controls the rate at which the function’s
output values increase. A value of 1 causes the function to increase linearly
- by zoom level. A higher exponential interpolation base causes the function’s
- output values to vary exponentially, increasing more rapidly towards the high
- end of the function’s range. The default value of this property is 1, for a
- linear curve.
+ based on zoom level or attribute value. A higher exponential interpolation base
+ causes the function’s output values to vary exponentially, increasing more rapidly
+ towards the high end of the function’s range. The default value of this property
+ is 1, for a linear curve.
This attribute corresponds to the
<a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#function-base"><code>base</code></a>
@@ -33,7 +33,7 @@ typedef NSString *MGLStyleFunctionOption NS_STRING_ENUM;
extern MGL_EXPORT const MGLStyleFunctionOption MGLStyleFunctionOptionInterpolationBase;
/**
- An `MGLStyleConstantValue` object that specifies a default value that a style
+ An `MGLConstantStyleValue` object that specifies a default value that a style
function can use when it can't otherwise determine a value.
A default value can be used to set the value of a style layer property that
@@ -54,23 +54,30 @@ extern MGL_EXPORT const MGLStyleFunctionOption MGLStyleFunctionOptionDefaultValu
*/
typedef NS_ENUM(NSUInteger, MGLInterpolationMode) {
/**
- Values between two stops are interpolated exponentially or linearly if the
- `MGLStyleFunctionOptionInterpolationBase` is 1.
+ Values between two stops are interpolated linearly, or exponentially based on
+ the `MGLStyleFunctionOptionInterpolationBase`. A higher interpolation base
+ causes the function’s output values to vary exponentially, increasing more rapidly
+ towards the high end of the function’s range. The default interpolation base of 1
+ creates a linear interpolation. Use exponential interpolation mode to show values
+ relative to stop keys.
*/
MGLInterpolationModeExponential = 0,
/**
Values between two stops are not interpolated. Instead, properties are set
- to the value of the stop just less than the function input.
+ to the value of the stop just less than the function input. Use interval
+ interpolation mode to show values that fall within a range.
*/
MGLInterpolationModeInterval,
/**
Values between two stops are not interpolated. Instead, properties are set
- to the value of the stop equal to the function input's key value.
+ to the value of the stop equal to the function input's key value. Use
+ categorical interpolation mode to show values that fit into categories.
*/
MGLInterpolationModeCategorical,
/**
- Values between two stops are not interpolated. Instead, values are set
- to their input value.
+ Values between two stops are not interpolated. Instead, values are set to their
+ input value. Use identity interpolation mode to show attribute values that can be
+ used as style values.
*/
MGLInterpolationModeIdentity
};
@@ -81,7 +88,7 @@ typedef NS_ENUM(NSUInteger, MGLInterpolationMode) {
`MGLStyleValue` objects.
The `MGLStyleValue` class itself represents a class cluster. Under the hood, a
- particular `MGLStyleValue` object may be either an `MGLStyleConstantValue` to
+ particular `MGLStyleValue` object may be either an `MGLConstantStyleValue` to
represent a constant value or one of the concrete subclasses of
`MGLStyleFunction` to represent a value function. Do not initialize an
`MGLStyleValue` object directly; instead, use one of the class factory methods
@@ -104,10 +111,10 @@ MGL_EXPORT
#pragma mark Creating a Style Value
/**
- Creates and returns an `MGLStyleConstantValue` object containing a raw value.
+ Creates and returns an `MGLConstantStyleValue` object containing a raw value.
@param rawValue The constant value contained by the object.
- @return An `MGLStyleConstantValue` object containing `rawValue`, which is
+ @return An `MGLConstantStyleValue` object containing `rawValue`, which is
treated as a constant value.
*/
+ (instancetype)valueWithRawValue:(T)rawValue;
@@ -168,7 +175,8 @@ MGL_EXPORT
@param interpolationMode The mode used to interpolate property values over a
range of feature attribute values for each outer zoom level.
- @param sourceStops A dictionary associating feature attributes with style values.
+ @param compositeStops A dictionary associating feature attributes with style
+ values.
@param attributeName Specifies the feature attribute to take as the function
input.
@param options A dictionary containing `MGLStyleFunctionOption` values that
@@ -181,24 +189,24 @@ MGL_EXPORT
@end
/**
- An `MGLStyleConstantValue` object is a generic container for a style attribute
+ An `MGLConstantStyleValue` object is a generic container for a style attribute
value that remains constant as the zoom level changes. The layout and paint
attribute properties of `MGLStyleLayer` objects can be set to
- `MGLStyleConstantValue` objects.
+ `MGLConstantStyleValue` objects.
- The `MGLStyleConstantValue` class takes a generic parameter `T` that indicates
+ The `MGLConstantStyleValue` class takes a generic parameter `T` that indicates
the Foundation class being wrapped by this class.
*/
MGL_EXPORT
-@interface MGLStyleConstantValue<T> : MGLStyleValue<T>
+@interface MGLConstantStyleValue<T> : MGLStyleValue<T>
#pragma mark Creating a Style Constant Value
/**
- Creates and returns an `MGLStyleConstantValue` object containing a raw value.
+ Creates and returns an `MGLConstantStyleValue` object containing a raw value.
@param rawValue The constant value contained by the object.
- @return An `MGLStyleConstantValue` object containing `rawValue`, which is
+ @return An `MGLConstantStyleValue` object containing `rawValue`, which is
treated as a constant value.
*/
+ (instancetype)valueWithRawValue:(T)rawValue;
@@ -208,10 +216,10 @@ MGL_EXPORT
- (instancetype)init NS_UNAVAILABLE;
/**
- Returns an `MGLStyleConstantValue` object containing a raw value.
+ Returns an `MGLConstantStyleValue` object containing a raw value.
@param rawValue The value contained by the receiver.
- @return An `MGLStyleConstantValue` object containing `rawValue`.
+ @return An `MGLConstantStyleValue` object containing `rawValue`.
*/
- (instancetype)initWithRawValue:(T)rawValue NS_DESIGNATED_INITIALIZER;
@@ -224,6 +232,8 @@ MGL_EXPORT
@end
+@compatibility_alias MGLStyleConstantValue MGLConstantStyleValue;
+
/**
An `MGLStyleFunction` is a is an abstract superclass for functions that are
defined by an `MGLCameraStyleFunction`, `MGLSourceStyleFunction`, or
@@ -378,7 +388,7 @@ MGL_EXPORT
@param interpolationMode The mode used to interpolate property values over a
range of feature attribute values.
- @param sourceStops A dictionary associating feature attributes with style values.
+ @param stops A dictionary associating feature attributes with style values.
@param attributeName Specifies the feature attribute to take as the function
input.
@param options A dictionary containing `MGLStyleFunctionOption` values that
@@ -438,7 +448,7 @@ MGL_EXPORT
@param interpolationMode The mode used to interpolate property values over a
range of feature attribute values for each outer zoom level.
- @param sourceStops A dictionary associating feature attributes with style values.
+ @param stops A dictionary associating feature attributes with style values.
@param attributeName Specifies the feature attribute to take as the function
input.
@param options A dictionary containing `MGLStyleFunctionOption` values that
diff --git a/platform/darwin/src/MGLStyleValue.mm b/platform/darwin/src/MGLStyleValue.mm
index 020dc27d6a..33b6babadf 100644
--- a/platform/darwin/src/MGLStyleValue.mm
+++ b/platform/darwin/src/MGLStyleValue.mm
@@ -6,7 +6,7 @@ const MGLStyleFunctionOption MGLStyleFunctionOptionDefaultValue = @"MGLStyleFunc
@implementation MGLStyleValue
+ (instancetype)valueWithRawValue:(id)rawValue {
- return [MGLStyleConstantValue valueWithRawValue:rawValue];
+ return [MGLConstantStyleValue valueWithRawValue:rawValue];
}
+ (instancetype)valueWithInterpolationBase:(CGFloat)interpolationBase stops:(NSDictionary *)stops {
@@ -31,7 +31,7 @@ const MGLStyleFunctionOption MGLStyleFunctionOptionDefaultValue = @"MGLStyleFunc
@end
-@implementation MGLStyleConstantValue
+@implementation MGLConstantStyleValue
+ (instancetype)valueWithRawValue:(id)rawValue {
return [[self alloc] initWithRawValue:rawValue];
@@ -52,7 +52,7 @@ const MGLStyleFunctionOption MGLStyleFunctionOptionDefaultValue = @"MGLStyleFunc
return [self.rawValue debugDescription];
}
-- (BOOL)isEqual:(MGLStyleConstantValue *)other {
+- (BOOL)isEqual:(MGLConstantStyleValue *)other {
return [other isKindOfClass:[self class]] && [other.rawValue isEqual:self.rawValue];
}
diff --git a/platform/darwin/src/MGLStyleValue_Private.h b/platform/darwin/src/MGLStyleValue_Private.h
index 3a5ce8d474..90d6622c93 100644
--- a/platform/darwin/src/MGLStyleValue_Private.h
+++ b/platform/darwin/src/MGLStyleValue_Private.h
@@ -51,12 +51,12 @@ public:
mbgl::style::PropertyValue<MBGLType> toPropertyValue(MGLStyleValue<ObjCType> *value) {
if ([value isKindOfClass:[MGLSourceStyleFunction class]] || [value isKindOfClass:[MGLCompositeStyleFunction class]]) {
[NSException raise:NSInvalidArgumentException
- format:@"This property can only be set to camera functions. Use +[MGLStyleValue cameraFunctionValueWithinterpolationMode:stops:options:] instead."];
+ format:@"This property can only be set to camera functions. Use +[MGLStyleValue valueWithInterpolationMode:cameraStops:options:] instead."];
return {};
}
- if ([value isKindOfClass:[MGLStyleConstantValue class]]) {
- return toMBGLConstantValue((MGLStyleConstantValue<ObjCType> *)value);
+ if ([value isKindOfClass:[MGLConstantStyleValue class]]) {
+ return toMBGLConstantValue((MGLConstantStyleValue<ObjCType> *)value);
} else if ([value isKindOfClass:[MGLCameraStyleFunction class]]) {
MGLCameraStyleFunction<ObjCType> *cameraStyleFunction = (MGLCameraStyleFunction<ObjCType> *)value;
// Intentionally ignore the stop type set by the developer becuase non interpolatable property values
@@ -82,12 +82,12 @@ public:
mbgl::style::PropertyValue<MBGLType> toInterpolatablePropertyValue(MGLStyleValue<ObjCType> *value) {
if ([value isKindOfClass:[MGLSourceStyleFunction class]] || [value isKindOfClass:[MGLCompositeStyleFunction class]]) {
[NSException raise:NSInvalidArgumentException
- format:@"This property can only be set to camera functions. Use +[MGLStyleValue cameraFunctionValueWithinterpolationMode:stops:options:] instead."];
+ format:@"This property can only be set to camera functions. Use +[MGLStyleValue valueWithInterpolationMode:cameraStops:options:] instead."];
return {};
}
- if ([value isKindOfClass:[MGLStyleConstantValue class]]) {
- return toMBGLConstantValue((MGLStyleConstantValue<ObjCType> *)value);
+ if ([value isKindOfClass:[MGLConstantStyleValue class]]) {
+ return toMBGLConstantValue((MGLConstantStyleValue<ObjCType> *)value);
} else if ([value isMemberOfClass:[MGLStyleFunction class]]) {
MGLStyleFunction<ObjCType> *styleFunction = (MGLStyleFunction<ObjCType> *)value;
return toMBGLExponentialCameraFunction(styleFunction);
@@ -119,8 +119,8 @@ public:
// Convert an mgl style value into a mbgl data driven property value
mbgl::style::DataDrivenPropertyValue<MBGLType> toDataDrivenPropertyValue(MGLStyleValue<ObjCType> *value) {
- if ([value isKindOfClass:[MGLStyleConstantValue class]]) {
- return toMBGLConstantValue((MGLStyleConstantValue<ObjCType> *)value);
+ if ([value isKindOfClass:[MGLConstantStyleValue class]]) {
+ return toMBGLConstantValue((MGLConstantStyleValue<ObjCType> *)value);
} else if ([value isKindOfClass:[MGLStyleFunction class]]) {
auto rawValue = toRawStyleSpecValue((MGLStyleFunction<ObjCType> *) value);
auto result = mbgl::style::conversion::convert<mbgl::style::DataDrivenPropertyValue<MBGLType>>(rawValue);
@@ -139,13 +139,13 @@ public:
mbgl::style::PropertyValue<MBGLEnum> toEnumPropertyValue(MGLStyleValue<ObjCType> *value) {
if ([value isKindOfClass:[MGLSourceStyleFunction class]] || [value isKindOfClass:[MGLCompositeStyleFunction class]]) {
[NSException raise:NSInvalidArgumentException
- format:@"This property can only be set to camera functions. Use +[MGLStyleValue cameraFunctionValueWithinterpolationMode:stops:options:] instead."];
+ format:@"This property can only be set to camera functions. Use +[MGLStyleValue valueWithInterpolationMode:cameraStops:options:] instead."];
return {};
}
- if ([value isKindOfClass:[MGLStyleConstantValue class]]) {
+ if ([value isKindOfClass:[MGLConstantStyleValue class]]) {
MBGLEnum mbglValue;
- getMBGLValue([(MGLStyleConstantValue<ObjCType> *)value rawValue], mbglValue);
+ getMBGLValue([(MGLConstantStyleValue<ObjCType> *)value rawValue], mbglValue);
return mbglValue;
} else if ([value isKindOfClass:[MGLCameraStyleFunction class]]) {
MGLCameraStyleFunction<NSValue *> *cameraStyleFunction = (MGLCameraStyleFunction<NSValue *> *)value;
@@ -175,7 +175,7 @@ public:
private: // Private utilities for converting from mgl to mbgl values
- MBGLType toMBGLConstantValue(MGLStyleConstantValue<ObjCType> *value) {
+ MBGLType toMBGLConstantValue(MGLConstantStyleValue<ObjCType> *value) {
MBGLType mbglValue;
getMBGLValue(value.rawValue, mbglValue);
return mbglValue;
@@ -245,7 +245,7 @@ private: // Private utilities for converting from mgl to mbgl values
if ([styleFunction isKindOfClass:[MGLCameraStyleFunction class]]) {
// zoom-only function (no default value)
__block NSMutableArray *stops = [[NSMutableArray alloc] init];
- [styleFunction.stops enumerateKeysAndObjectsUsingBlock:^(NSNumber * _Nonnull zoomKey, MGLStyleConstantValue<ObjCType> * _Nonnull outputValue, BOOL * _Nonnull stop) {
+ [styleFunction.stops enumerateKeysAndObjectsUsingBlock:^(NSNumber * _Nonnull zoomKey, MGLConstantStyleValue<ObjCType> * _Nonnull outputValue, BOOL * _Nonnull stop) {
MBGLType dummyMbglValue;
NSArray *rawStop = @[zoomKey, toRawStyleSpecValue([outputValue rawValue], dummyMbglValue)];
[stops addObject:rawStop];
@@ -257,7 +257,7 @@ private: // Private utilities for converting from mgl to mbgl values
rawFunction[@"property"] = sourceStyleFunction.attributeName;
// property-only function
__block NSMutableArray *stops = [[NSMutableArray alloc] init];
- [styleFunction.stops enumerateKeysAndObjectsUsingBlock:^(NSObject * _Nonnull propertyKey, MGLStyleConstantValue<ObjCType> * _Nonnull outputValue, BOOL * _Nonnull stop) {
+ [styleFunction.stops enumerateKeysAndObjectsUsingBlock:^(NSObject * _Nonnull propertyKey, MGLConstantStyleValue<ObjCType> * _Nonnull outputValue, BOOL * _Nonnull stop) {
MBGLType dummyMbglValue;
NSArray *rawStop = @[propertyKey, toRawStyleSpecValue([outputValue rawValue], dummyMbglValue)];
[stops addObject:rawStop];
@@ -266,9 +266,9 @@ private: // Private utilities for converting from mgl to mbgl values
// defaultValue => default
if (sourceStyleFunction.defaultValue) {
- NSCAssert([sourceStyleFunction.defaultValue isKindOfClass:[MGLStyleConstantValue class]], @"Default value must be constant");
+ NSCAssert([sourceStyleFunction.defaultValue isKindOfClass:[MGLConstantStyleValue class]], @"Default value must be constant");
MBGLType dummyMbglValue;
- rawFunction[@"default"] = toRawStyleSpecValue([(MGLStyleConstantValue<ObjCType> *)sourceStyleFunction.defaultValue rawValue], dummyMbglValue);
+ rawFunction[@"default"] = toRawStyleSpecValue([(MGLConstantStyleValue<ObjCType> *)sourceStyleFunction.defaultValue rawValue], dummyMbglValue);
}
} else if ([styleFunction isKindOfClass:[MGLCompositeStyleFunction class]]) {
// zoom-and-property function
@@ -282,8 +282,8 @@ private: // Private utilities for converting from mgl to mbgl values
@"zoom": zoomKey,
@"value": valueKey
};
- MGLStyleConstantValue<ObjCType> *outputValue = stopValue[valueKey];
- NSCAssert([outputValue isKindOfClass:[MGLStyleConstantValue<ObjCType> class]], @"Stop outputs should be MGLStyleConstantValues");
+ MGLConstantStyleValue<ObjCType> *outputValue = stopValue[valueKey];
+ NSCAssert([outputValue isKindOfClass:[MGLConstantStyleValue<ObjCType> class]], @"Stop outputs should be MGLConstantStyleValues");
MBGLType dummyMbglValue;
NSArray *rawStop = @[stopKey, toRawStyleSpecValue([outputValue rawValue], dummyMbglValue)];
[stops addObject:rawStop];
@@ -293,9 +293,9 @@ private: // Private utilities for converting from mgl to mbgl values
// defaultValue => default
if (compositeStyleFunction.defaultValue) {
- NSCAssert([compositeStyleFunction.defaultValue isKindOfClass:[MGLStyleConstantValue class]], @"Default value must be constant");
+ NSCAssert([compositeStyleFunction.defaultValue isKindOfClass:[MGLConstantStyleValue class]], @"Default value must be constant");
MBGLType dummyMbglValue;
- rawFunction[@"default"] = toRawStyleSpecValue([(MGLStyleConstantValue<ObjCType> *)compositeStyleFunction.defaultValue rawValue], dummyMbglValue);
+ rawFunction[@"default"] = toRawStyleSpecValue([(MGLConstantStyleValue<ObjCType> *)compositeStyleFunction.defaultValue rawValue], dummyMbglValue);
}
}
@@ -367,9 +367,9 @@ private: // Private utilities for converting from mgl to mbgl values
void setDefaultMBGLValue(MGLSourceStyleFunction<ObjCType> *sourceStyleFunction, mbgl::style::SourceFunction<MBGLType> &sourceFunction) {
if (sourceStyleFunction.defaultValue) {
- NSCAssert([sourceStyleFunction.defaultValue isKindOfClass:[MGLStyleConstantValue class]], @"Default value must be constant");
+ NSCAssert([sourceStyleFunction.defaultValue isKindOfClass:[MGLConstantStyleValue class]], @"Default value must be constant");
MBGLType mbglValue;
- id mglValue = [(MGLStyleConstantValue<ObjCType> *)sourceStyleFunction.defaultValue rawValue];
+ id mglValue = [(MGLConstantStyleValue<ObjCType> *)sourceStyleFunction.defaultValue rawValue];
getMBGLValue(mglValue, mbglValue);
sourceFunction.defaultValue = mbglValue;
}
@@ -518,7 +518,7 @@ private: // Private utilities for converting from mbgl to mgl values
id operator()(const MBGLEnum &value) const {
auto str = mbgl::Enum<MBGLEnum>::toString(value);
MGLEnum mglType = *mbgl::Enum<MGLEnum>::toEnum(str);
- return [MGLStyleConstantValue<ObjCType> valueWithRawValue:[NSValue value:&mglType withObjCType:@encode(MGLEnum)]];
+ return [MGLConstantStyleValue<ObjCType> valueWithRawValue:[NSValue value:&mglType withObjCType:@encode(MGLEnum)]];
}
id operator()(const mbgl::style::CameraFunction<MBGLEnum> &mbglValue) const {
@@ -671,7 +671,7 @@ private: // Private utilities for converting from mbgl to mgl values
id operator()(const MBGLType &value) const {
auto rawValue = toMGLRawStyleValue(value);
- return [MGLStyleConstantValue<ObjCType> valueWithRawValue:rawValue];
+ return [MGLConstantStyleValue<ObjCType> valueWithRawValue:rawValue];
}
id operator()(const mbgl::style::CameraFunction<MBGLType> &mbglValue) const {
diff --git a/platform/darwin/src/MGLSymbolStyleLayer.h b/platform/darwin/src/MGLSymbolStyleLayer.h
index a4850a4e18..c76efe2de7 100644
--- a/platform/darwin/src/MGLSymbolStyleLayer.h
+++ b/platform/darwin/src/MGLSymbolStyleLayer.h
@@ -1,5 +1,5 @@
// This file is generated.
-// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLFoundation.h"
#import "MGLStyleValue.h"
@@ -299,7 +299,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -324,7 +324,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -334,7 +334,8 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *iconIgnorePlacement __attribute__((unavailable("Use iconIgnoresPlacement instead.")));
/**
- A string with {tokens} replaced, referencing the data property to pull from.
+ Name of image in sprite to use for drawing an image background. A string with
+ {tokens} replaced, referencing the data property to pull from.
This attribute corresponds to the <a
href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-icon-image"><code>icon-image</code></a>
@@ -342,7 +343,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -364,7 +365,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -392,7 +393,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -422,7 +423,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -443,7 +444,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -468,7 +469,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -500,7 +501,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -522,7 +523,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -544,7 +545,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -567,7 +568,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -590,7 +591,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -617,7 +618,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -646,7 +647,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -674,7 +675,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -702,7 +703,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -728,7 +729,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -746,7 +747,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -767,7 +768,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -788,7 +789,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -824,7 +825,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -845,7 +846,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -877,7 +878,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -904,7 +905,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -930,7 +931,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -955,7 +956,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -978,7 +979,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -999,7 +1000,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1021,7 +1022,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1042,7 +1043,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1063,7 +1064,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -1084,7 +1085,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1103,7 +1104,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -1127,7 +1128,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1150,7 +1151,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -1168,7 +1169,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1200,7 +1201,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1229,7 +1230,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1247,6 +1248,13 @@ MGL_EXPORT
#endif
/**
+ The transition affecting any changes to this layer’s `iconColor` property.
+
+ This property corresponds to the `icon-color-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition iconColorTransition;
+
+/**
Fade out the halo towards the outside.
This property is measured in points.
@@ -1260,7 +1268,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1276,6 +1284,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *iconHaloBlur;
+/**
+ The transition affecting any changes to this layer’s `iconHaloBlur` property.
+
+ This property corresponds to the `icon-halo-blur-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition iconHaloBlurTransition;
+
#if TARGET_OS_IPHONE
/**
The color of the icon’s halo. The `iconImageName` property must be set to a
@@ -1290,7 +1305,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1319,7 +1334,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1337,6 +1352,13 @@ MGL_EXPORT
#endif
/**
+ The transition affecting any changes to this layer’s `iconHaloColor` property.
+
+ This property corresponds to the `icon-halo-color-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition iconHaloColorTransition;
+
+/**
Distance of halo to the icon outline.
This property is measured in points.
@@ -1350,7 +1372,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1367,6 +1389,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *iconHaloWidth;
/**
+ The transition affecting any changes to this layer’s `iconHaloWidth` property.
+
+ This property corresponds to the `icon-halo-width-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition iconHaloWidthTransition;
+
+/**
The opacity at which the icon will be drawn.
The default value of this property is an `MGLStyleValue` object containing an
@@ -1378,7 +1407,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1394,6 +1423,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *iconOpacity;
+/**
+ The transition affecting any changes to this layer’s `iconOpacity` property.
+
+ This property corresponds to the `icon-opacity-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition iconOpacityTransition;
+
#if TARGET_OS_IPHONE
/**
Distance that the icon's anchor is moved from its original placement.
@@ -1413,7 +1449,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1438,7 +1474,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1446,6 +1482,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *iconTranslation;
#endif
+/**
+ The transition affecting any changes to this layer’s `iconTranslation` property.
+
+ This property corresponds to the `icon-translate-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition iconTranslationTransition;
+
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *iconTranslate __attribute__((unavailable("Use iconTranslation instead.")));
/**
@@ -1464,7 +1507,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -1485,7 +1528,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1513,7 +1556,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1531,6 +1574,13 @@ MGL_EXPORT
#endif
/**
+ The transition affecting any changes to this layer’s `textColor` property.
+
+ This property corresponds to the `text-color-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition textColorTransition;
+
+/**
The halo's fadeout distance towards the outside.
This property is measured in points.
@@ -1544,7 +1594,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1560,6 +1610,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *textHaloBlur;
+/**
+ The transition affecting any changes to this layer’s `textHaloBlur` property.
+
+ This property corresponds to the `text-halo-blur-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition textHaloBlurTransition;
+
#if TARGET_OS_IPHONE
/**
The color of the text's halo, which helps it stand out from backgrounds.
@@ -1573,7 +1630,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1601,7 +1658,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1619,6 +1676,13 @@ MGL_EXPORT
#endif
/**
+ The transition affecting any changes to this layer’s `textHaloColor` property.
+
+ This property corresponds to the `text-halo-color-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition textHaloColorTransition;
+
+/**
Distance of halo to the font outline. Max text halo width is 1/4 of the
font-size.
@@ -1633,7 +1697,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1650,6 +1714,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *textHaloWidth;
/**
+ The transition affecting any changes to this layer’s `textHaloWidth` property.
+
+ This property corresponds to the `text-halo-width-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition textHaloWidthTransition;
+
+/**
The opacity at which the text will be drawn.
The default value of this property is an `MGLStyleValue` object containing an
@@ -1661,7 +1732,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1677,6 +1748,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *textOpacity;
+/**
+ The transition affecting any changes to this layer’s `textOpacity` property.
+
+ This property corresponds to the `text-opacity-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition textOpacityTransition;
+
#if TARGET_OS_IPHONE
/**
Distance that the text's anchor is moved from its original placement.
@@ -1696,7 +1774,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1721,7 +1799,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1729,6 +1807,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *textTranslation;
#endif
+/**
+ The transition affecting any changes to this layer’s `textTranslation` property.
+
+ This property corresponds to the `text-translate-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition textTranslationTransition;
+
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *textTranslate __attribute__((unavailable("Use textTranslation instead.")));
/**
@@ -1747,7 +1832,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
diff --git a/platform/darwin/src/MGLSymbolStyleLayer.mm b/platform/darwin/src/MGLSymbolStyleLayer.mm
index 52648e7a05..8441931685 100644
--- a/platform/darwin/src/MGLSymbolStyleLayer.mm
+++ b/platform/darwin/src/MGLSymbolStyleLayer.mm
@@ -4,6 +4,7 @@
#import "MGLSource.h"
#import "MGLMapView_Private.h"
#import "NSPredicate+MGLAdditions.h"
+#import "NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#import "MGLStyleValue_Private.h"
#import "MGLSymbolStyleLayer.h"
@@ -904,6 +905,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setIconColorTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setIconColorTransition(options);
+}
+
+- (MGLTransition)iconColorTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getIconColorTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setIconHaloBlur:(MGLStyleValue<NSNumber *> *)iconHaloBlur {
MGLAssertStyleLayerIsValid();
@@ -921,6 +940,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setIconHaloBlurTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setIconHaloBlurTransition(options);
+}
+
+- (MGLTransition)iconHaloBlurTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getIconHaloBlurTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setIconHaloColor:(MGLStyleValue<MGLColor *> *)iconHaloColor {
MGLAssertStyleLayerIsValid();
@@ -938,6 +975,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setIconHaloColorTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setIconHaloColorTransition(options);
+}
+
+- (MGLTransition)iconHaloColorTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getIconHaloColorTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setIconHaloWidth:(MGLStyleValue<NSNumber *> *)iconHaloWidth {
MGLAssertStyleLayerIsValid();
@@ -955,6 +1010,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setIconHaloWidthTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setIconHaloWidthTransition(options);
+}
+
+- (MGLTransition)iconHaloWidthTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getIconHaloWidthTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setIconOpacity:(MGLStyleValue<NSNumber *> *)iconOpacity {
MGLAssertStyleLayerIsValid();
@@ -972,6 +1045,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setIconOpacityTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setIconOpacityTransition(options);
+}
+
+- (MGLTransition)iconOpacityTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getIconOpacityTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setIconTranslation:(MGLStyleValue<NSValue *> *)iconTranslation {
MGLAssertStyleLayerIsValid();
@@ -989,6 +1080,24 @@ namespace mbgl {
return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
+- (void)setIconTranslationTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setIconTranslateTransition(options);
+}
+
+- (MGLTransition)iconTranslationTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getIconTranslateTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setIconTranslate:(MGLStyleValue<NSValue *> *)iconTranslate {
}
@@ -1037,6 +1146,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setTextColorTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setTextColorTransition(options);
+}
+
+- (MGLTransition)textColorTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getTextColorTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setTextHaloBlur:(MGLStyleValue<NSNumber *> *)textHaloBlur {
MGLAssertStyleLayerIsValid();
@@ -1054,6 +1181,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setTextHaloBlurTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setTextHaloBlurTransition(options);
+}
+
+- (MGLTransition)textHaloBlurTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getTextHaloBlurTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setTextHaloColor:(MGLStyleValue<MGLColor *> *)textHaloColor {
MGLAssertStyleLayerIsValid();
@@ -1071,6 +1216,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setTextHaloColorTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setTextHaloColorTransition(options);
+}
+
+- (MGLTransition)textHaloColorTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getTextHaloColorTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setTextHaloWidth:(MGLStyleValue<NSNumber *> *)textHaloWidth {
MGLAssertStyleLayerIsValid();
@@ -1088,6 +1251,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setTextHaloWidthTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setTextHaloWidthTransition(options);
+}
+
+- (MGLTransition)textHaloWidthTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getTextHaloWidthTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setTextOpacity:(MGLStyleValue<NSNumber *> *)textOpacity {
MGLAssertStyleLayerIsValid();
@@ -1105,6 +1286,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setTextOpacityTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setTextOpacityTransition(options);
+}
+
+- (MGLTransition)textOpacityTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getTextOpacityTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setTextTranslation:(MGLStyleValue<NSValue *> *)textTranslation {
MGLAssertStyleLayerIsValid();
@@ -1122,6 +1321,24 @@ namespace mbgl {
return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
+- (void)setTextTranslationTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setTextTranslateTransition(options);
+}
+
+- (MGLTransition)textTranslationTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getTextTranslateTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setTextTranslate:(MGLStyleValue<NSValue *> *)textTranslate {
}
@@ -1153,7 +1370,6 @@ namespace mbgl {
return self.textTranslationAnchor;
}
-
@end
@implementation NSValue (MGLSymbolStyleLayerAdditions)
diff --git a/platform/darwin/src/MGLTileSource.h b/platform/darwin/src/MGLTileSource.h
index bc29b0f95c..54c756332d 100644
--- a/platform/darwin/src/MGLTileSource.h
+++ b/platform/darwin/src/MGLTileSource.h
@@ -135,6 +135,10 @@ typedef NS_ENUM(NSUInteger, MGLTileCoordinateSystem) {
A tile source is added to an `MGLStyle` object along with one or more
`MGLRasterStyleLayer` or `MGLVectorStyleLayer` objects. Use a style layer to
control the appearance of content supplied by the tile source.
+
+ A tile source is also known as a tile set. To learn about the structure of a
+ Mapbox-hosted tile set, view it in
+ <a href="https://www.mapbox.com/studio/tilesets/">Mapbox Studio’s Tilesets editor</a>.
Do not create instances of this class directly, and do not create your own
subclasses of this class. Instead, create instances of `MGLRasterSource` and
diff --git a/platform/darwin/src/MGLTypes.h b/platform/darwin/src/MGLTypes.h
index e4573c285e..c06fd8b0e7 100644
--- a/platform/darwin/src/MGLTypes.h
+++ b/platform/darwin/src/MGLTypes.h
@@ -48,21 +48,6 @@ typedef NS_ENUM(NSInteger, MGLErrorCode) {
MGLErrorCodeLoadStyleFailed = 5,
};
-/**
- The mode used to track the user location on the map. Used with
- `MGLMapView.userTrackingMode`.
- */
-typedef NS_ENUM(NSUInteger, MGLUserTrackingMode) {
- /** The map does not follow the user location. */
- MGLUserTrackingModeNone = 0,
- /** The map follows the user location. */
- MGLUserTrackingModeFollow,
- /** The map follows the user location and rotates when the heading changes. */
- MGLUserTrackingModeFollowWithHeading,
- /** The map follows the user location and rotates when the course changes. */
- MGLUserTrackingModeFollowWithCourse,
-};
-
/** Options for enabling debugging features in an `MGLMapView` instance. */
typedef NS_OPTIONS(NSUInteger, MGLMapDebugMaskOptions) {
/** Edges of tile boundaries are shown as thick, red lines to help diagnose
@@ -89,6 +74,39 @@ typedef NS_OPTIONS(NSUInteger, MGLMapDebugMaskOptions) {
#endif
};
+/**
+ A structure containing information about a transition.
+ */
+typedef struct MGLTransition {
+ /**
+ The amount of time the animation should take, not including the delay.
+ */
+ NSTimeInterval duration;
+
+ /**
+ The amount of time in seconds to wait before beginning the animation.
+ */
+ NSTimeInterval delay;
+} MGLTransition;
+
+/**
+ Creates a new `MGLTransition` from the given duration and delay.
+
+ @param duration The amount of time the animation should take, not including
+ the delay.
+ @param delay The amount of time in seconds to wait before beginning the
+ animation.
+
+ @return Returns a `MGLTransition` struct containing the transition attributes.
+ */
+NS_INLINE MGLTransition MGLTransitionMake(NSTimeInterval duration, NSTimeInterval delay) {
+ MGLTransition transition;
+ transition.duration = duration;
+ transition.delay = delay;
+
+ return transition;
+}
+
NS_ASSUME_NONNULL_END
#ifndef NS_ARRAY_OF
diff --git a/platform/darwin/src/MGLVectorSource.h b/platform/darwin/src/MGLVectorSource.h
index 8634316809..83926fd287 100644
--- a/platform/darwin/src/MGLVectorSource.h
+++ b/platform/darwin/src/MGLVectorSource.h
@@ -26,6 +26,12 @@ NS_ASSUME_NONNULL_BEGIN
(<var>extent</var>&nbsp;×&nbsp;2)&nbsp;−&nbsp;1, inclusive. Any vector style
layer initialized with a vector source must have a non-`nil` value in its
`sourceLayerIdentifier` property.
+
+ Commonly used vector sources include
+ <a href="https://www.mapbox.com/vector-tiles/mapbox-streets/">Mapbox Streets</a>,
+ <a href="https://www.mapbox.com/vector-tiles/mapbox-terrain/">Mapbox Terrain</a>,
+ and
+ <a href="https://www.mapbox.com/vector-tiles/mapbox-traffic-v1/">Mapbox Traffic</a>.
### Example
@@ -52,23 +58,39 @@ MGL_EXPORT
#pragma mark Accessing a Source’s Content
/**
- Returns an array of map features loaded by this source, restricted to the
- given source layers and filtered by the given predicate.
-
- Each object in the returned array represents a feature for the
- current style and provides access to attributes specified by the
- <a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources">source</a>.
-
- Features come from tiled vector data that is converted to tiles internally,
- so feature geometries are clipped at tile boundaries and features
- may appear duplicated across tiles.
-
- @param sourceLayerIdentifiers The source layers to include in the query. Only the
- features contained in these source layers are included in the returned array. At
- least one source layer is required.
- @param predicate A predicate to filter the returned features.
+ Returns an array of map features loaded by this source, restricted to the given
+ source layers and filtered by the given predicate.
+
+ Each object in the returned array represents a feature loaded by the source and
+ provides access to attributes specified as part of the loaded feature. The
+ source loads a feature if the source is added to an `MGLMapView`’s style; that
+ style has a layer that uses the source; and the map view has recently scrolled
+ to the region containing the feature.
+
+ Features come from tiled vector data that is converted to tiles internally, so
+ feature geometries are clipped at tile boundaries and features may appear
+ duplicated across tiles. For example, suppose part of a lengthy polyline
+ representing a road has recently scrolled into view. The resulting array
+ includes those parts of the road that lie within the map tiles that the source
+ has loaded, even if the road extends into other tiles. The portion of the road
+ within each map tile is included individually.
+
+ Returned features may not necessarily be visible to the user at the time they
+ are loaded: the style may contain a layer that forces the source’s tiles to
+ load but filters out the features in question, preventing them from being
+ drawn. To obtain only _visible_ features, use the
+ `-[MGLMapView visibleFeaturesAtPoint:inStyleLayersWithIdentifiers:predicate:]`
+ or
+ `-[MGLMapView visibleFeaturesInRect:inStyleLayersWithIdentifiers:predicate:]`
+ method.
+
+ @param sourceLayerIdentifiers The source layers to include in the query. Only
+ the features contained in these source layers are included in the returned
+ array. This array may not be empty.
+ @param predicate A predicate to filter the returned features. Use `nil` to
+ include all loaded features.
@return An array of objects conforming to the `MGLFeature` protocol that
- represent features in the sources used by the current style.
+ represent features loaded by the source that match the predicate.
*/
- (NS_ARRAY_OF(id <MGLFeature>) *)featuresInSourceLayersWithIdentifiers:(NS_SET_OF(NSString *) *)sourceLayerIdentifiers predicate:(nullable NSPredicate *)predicate NS_SWIFT_NAME(features(sourceLayerIdentifiers:predicate:));
diff --git a/platform/darwin/src/NSDate+MGLAdditions.h b/platform/darwin/src/NSDate+MGLAdditions.h
index 820d1bd9e2..1da03fda62 100644
--- a/platform/darwin/src/NSDate+MGLAdditions.h
+++ b/platform/darwin/src/NSDate+MGLAdditions.h
@@ -1,13 +1,17 @@
#import <Foundation/Foundation.h>
+#import "MGLFoundation.h"
#include <mbgl/util/chrono.hpp>
-@interface NSDate (MGLAdditions)
+NS_ASSUME_NONNULL_BEGIN
+
/// Converts from a duration in seconds to a duration object usable in mbgl.
-mbgl::Duration MGLDurationInSecondsFromTimeInterval(NSTimeInterval duration);
+MGL_EXPORT
+mbgl::Duration MGLDurationFromTimeInterval(NSTimeInterval duration);
/// Converts from an mbgl duration object to a duration in seconds.
-NSTimeInterval MGLTimeIntervalFromDurationInSeconds(mbgl::Duration duration);
+MGL_EXPORT
+NSTimeInterval MGLTimeIntervalFromDuration(mbgl::Duration duration);
-@end
+NS_ASSUME_NONNULL_END
diff --git a/platform/darwin/src/NSDate+MGLAdditions.mm b/platform/darwin/src/NSDate+MGLAdditions.mm
index deac3c4881..b45b41f836 100644
--- a/platform/darwin/src/NSDate+MGLAdditions.mm
+++ b/platform/darwin/src/NSDate+MGLAdditions.mm
@@ -1,15 +1,11 @@
#import "NSDate+MGLAdditions.h"
-@implementation NSDate (MGLAdditions)
-
-mbgl::Duration MGLDurationInSecondsFromTimeInterval(NSTimeInterval duration)
+mbgl::Duration MGLDurationFromTimeInterval(NSTimeInterval duration)
{
return std::chrono::duration_cast<mbgl::Duration>(std::chrono::duration<NSTimeInterval>(duration));
}
-NSTimeInterval MGLTimeIntervalFromDurationInSeconds(mbgl::Duration duration)
+NSTimeInterval MGLTimeIntervalFromDuration(mbgl::Duration duration)
{
- return duration.count();
+ return std::chrono::duration<NSTimeInterval, std::ratio<1>>(duration).count();
}
-
-@end
diff --git a/platform/darwin/src/NSString+MGLAdditions.h b/platform/darwin/src/NSString+MGLAdditions.h
index ff72e9d3af..d82ecaa671 100644
--- a/platform/darwin/src/NSString+MGLAdditions.h
+++ b/platform/darwin/src/NSString+MGLAdditions.h
@@ -14,8 +14,9 @@ NS_ASSUME_NONNULL_BEGIN
Returns a title-cased representation of the receiver using the specified
locale.
- @param The locale. For strings presented to users, pass in the current locale
- (`+[NSLocale currentLocale]`). To use the system locale, pass in `nil`.
+ @param locale The locale. For strings presented to users, pass in the current
+ locale (`+[NSLocale currentLocale]`). To use the system locale, pass in
+ `nil`.
*/
- (NSString *)mgl_titleCasedStringWithLocale:(NSLocale *)locale;
diff --git a/platform/darwin/src/NSValue+MGLAdditions.h b/platform/darwin/src/NSValue+MGLAdditions.h
index 76388cf2bb..e6755021d0 100644
--- a/platform/darwin/src/NSValue+MGLAdditions.h
+++ b/platform/darwin/src/NSValue+MGLAdditions.h
@@ -2,6 +2,7 @@
#import "MGLGeometry.h"
#import "MGLOfflinePack.h"
+#import "MGLTypes.h"
NS_ASSUME_NONNULL_BEGIN
@@ -70,6 +71,22 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property (readonly) MGLOfflinePackProgress MGLOfflinePackProgressValue;
+#pragma mark Working with Transition Values
+
+/**
+ Creates a new value object containing the given `MGLTransition`
+ structure.
+
+ @param transition The value for the new object.
+ @return A new value object that contains the transition information.
+ */
++ (NSValue *)valueWithMGLTransition:(MGLTransition)transition;
+
+/**
+ The `MGLTransition` structure representation of the value.
+ */
+@property (readonly) MGLTransition MGLTransitionValue;
+
@end
NS_ASSUME_NONNULL_END
diff --git a/platform/darwin/src/NSValue+MGLAdditions.m b/platform/darwin/src/NSValue+MGLAdditions.m
index 0d2128bea8..a95ef23941 100644
--- a/platform/darwin/src/NSValue+MGLAdditions.m
+++ b/platform/darwin/src/NSValue+MGLAdditions.m
@@ -46,4 +46,16 @@
return progress;
}
+#pragma mark Working with Transition Values
+
++ (NSValue *)valueWithMGLTransition:(MGLTransition)transition; {
+ return [NSValue value:&transition withObjCType:@encode(MGLTransition)];
+}
+
+- (MGLTransition)MGLTransitionValue {
+ MGLTransition transition;
+ [self getValue:&transition];
+ return transition;
+}
+
@end
diff --git a/platform/darwin/test/MGLBackgroundStyleLayerTests.mm b/platform/darwin/test/MGLBackgroundStyleLayerTests.mm
index 92c0ac7cbc..c96a4fe7fa 100644
--- a/platform/darwin/test/MGLBackgroundStyleLayerTests.mm
+++ b/platform/darwin/test/MGLBackgroundStyleLayerTests.mm
@@ -2,10 +2,12 @@
// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLStyleLayerTests.h"
+#import "../../darwin/src/NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/background_layer.hpp>
+#include <mbgl/style/transition_options.hpp>
@interface MGLBackgroundLayerTests : MGLStyleLayerTests
@end
@@ -22,6 +24,9 @@
XCTAssertTrue(layer.rawLayer->is<mbgl::style::BackgroundLayer>());
auto rawLayer = layer.rawLayer->as<mbgl::style::BackgroundLayer>();
+ MGLTransition transitionTest = MGLTransitionMake(5, 4);
+
+
// background-color
{
XCTAssertTrue(rawLayer->getBackgroundColor().isUndefined(),
@@ -59,6 +64,15 @@
XCTAssertThrowsSpecificNamed(layer.backgroundColor = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<MGLColor *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.backgroundColor = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
+ // Transition property test
+ layer.backgroundColorTransition = transitionTest;
+ auto toptions = rawLayer->getBackgroundColorTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition backgroundColorTransition = layer.backgroundColorTransition;
+ XCTAssertEqual(backgroundColorTransition.delay, transitionTest.delay);
+ XCTAssertEqual(backgroundColorTransition.duration, transitionTest.duration);
}
// background-opacity
@@ -98,6 +112,15 @@
XCTAssertThrowsSpecificNamed(layer.backgroundOpacity = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<NSNumber *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.backgroundOpacity = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
+ // Transition property test
+ layer.backgroundOpacityTransition = transitionTest;
+ auto toptions = rawLayer->getBackgroundOpacityTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition backgroundOpacityTransition = layer.backgroundOpacityTransition;
+ XCTAssertEqual(backgroundOpacityTransition.delay, transitionTest.delay);
+ XCTAssertEqual(backgroundOpacityTransition.duration, transitionTest.duration);
}
// background-pattern
@@ -137,6 +160,15 @@
XCTAssertThrowsSpecificNamed(layer.backgroundPattern = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<NSString *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.backgroundPattern = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
+ // Transition property test
+ layer.backgroundPatternTransition = transitionTest;
+ auto toptions = rawLayer->getBackgroundPatternTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition backgroundPatternTransition = layer.backgroundPatternTransition;
+ XCTAssertEqual(backgroundPatternTransition.delay, transitionTest.delay);
+ XCTAssertEqual(backgroundPatternTransition.duration, transitionTest.duration);
}
}
diff --git a/platform/darwin/test/MGLCircleStyleLayerTests.mm b/platform/darwin/test/MGLCircleStyleLayerTests.mm
index d7515e8e4e..2a2e9f2d4a 100644
--- a/platform/darwin/test/MGLCircleStyleLayerTests.mm
+++ b/platform/darwin/test/MGLCircleStyleLayerTests.mm
@@ -2,10 +2,12 @@
// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLStyleLayerTests.h"
+#import "../../darwin/src/NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/circle_layer.hpp>
+#include <mbgl/style/transition_options.hpp>
@interface MGLCircleLayerTests : MGLStyleLayerTests
@end
@@ -43,6 +45,9 @@
XCTAssertTrue(layer.rawLayer->is<mbgl::style::CircleLayer>());
auto rawLayer = layer.rawLayer->as<mbgl::style::CircleLayer>();
+ MGLTransition transitionTest = MGLTransitionMake(5, 4);
+
+
// circle-blur
{
XCTAssertTrue(rawLayer->getCircleBlur().isUndefined(),
@@ -98,6 +103,15 @@
@"Unsetting circleBlur should return circle-blur to the default value.");
XCTAssertEqualObjects(layer.circleBlur, defaultStyleValue,
@"circleBlur should return the default value after being unset.");
+ // Transition property test
+ layer.circleBlurTransition = transitionTest;
+ auto toptions = rawLayer->getCircleBlurTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition circleBlurTransition = layer.circleBlurTransition;
+ XCTAssertEqual(circleBlurTransition.delay, transitionTest.delay);
+ XCTAssertEqual(circleBlurTransition.duration, transitionTest.duration);
}
// circle-color
@@ -155,6 +169,15 @@
@"Unsetting circleColor should return circle-color to the default value.");
XCTAssertEqualObjects(layer.circleColor, defaultStyleValue,
@"circleColor should return the default value after being unset.");
+ // Transition property test
+ layer.circleColorTransition = transitionTest;
+ auto toptions = rawLayer->getCircleColorTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition circleColorTransition = layer.circleColorTransition;
+ XCTAssertEqual(circleColorTransition.delay, transitionTest.delay);
+ XCTAssertEqual(circleColorTransition.duration, transitionTest.duration);
}
// circle-opacity
@@ -212,6 +235,15 @@
@"Unsetting circleOpacity should return circle-opacity to the default value.");
XCTAssertEqualObjects(layer.circleOpacity, defaultStyleValue,
@"circleOpacity should return the default value after being unset.");
+ // Transition property test
+ layer.circleOpacityTransition = transitionTest;
+ auto toptions = rawLayer->getCircleOpacityTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition circleOpacityTransition = layer.circleOpacityTransition;
+ XCTAssertEqual(circleOpacityTransition.delay, transitionTest.delay);
+ XCTAssertEqual(circleOpacityTransition.duration, transitionTest.duration);
}
// circle-radius
@@ -269,6 +301,15 @@
@"Unsetting circleRadius should return circle-radius to the default value.");
XCTAssertEqualObjects(layer.circleRadius, defaultStyleValue,
@"circleRadius should return the default value after being unset.");
+ // Transition property test
+ layer.circleRadiusTransition = transitionTest;
+ auto toptions = rawLayer->getCircleRadiusTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition circleRadiusTransition = layer.circleRadiusTransition;
+ XCTAssertEqual(circleRadiusTransition.delay, transitionTest.delay);
+ XCTAssertEqual(circleRadiusTransition.duration, transitionTest.duration);
}
// circle-pitch-scale
@@ -365,6 +406,15 @@
@"Unsetting circleStrokeColor should return circle-stroke-color to the default value.");
XCTAssertEqualObjects(layer.circleStrokeColor, defaultStyleValue,
@"circleStrokeColor should return the default value after being unset.");
+ // Transition property test
+ layer.circleStrokeColorTransition = transitionTest;
+ auto toptions = rawLayer->getCircleStrokeColorTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition circleStrokeColorTransition = layer.circleStrokeColorTransition;
+ XCTAssertEqual(circleStrokeColorTransition.delay, transitionTest.delay);
+ XCTAssertEqual(circleStrokeColorTransition.duration, transitionTest.duration);
}
// circle-stroke-opacity
@@ -422,6 +472,15 @@
@"Unsetting circleStrokeOpacity should return circle-stroke-opacity to the default value.");
XCTAssertEqualObjects(layer.circleStrokeOpacity, defaultStyleValue,
@"circleStrokeOpacity should return the default value after being unset.");
+ // Transition property test
+ layer.circleStrokeOpacityTransition = transitionTest;
+ auto toptions = rawLayer->getCircleStrokeOpacityTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition circleStrokeOpacityTransition = layer.circleStrokeOpacityTransition;
+ XCTAssertEqual(circleStrokeOpacityTransition.delay, transitionTest.delay);
+ XCTAssertEqual(circleStrokeOpacityTransition.duration, transitionTest.duration);
}
// circle-stroke-width
@@ -479,6 +538,15 @@
@"Unsetting circleStrokeWidth should return circle-stroke-width to the default value.");
XCTAssertEqualObjects(layer.circleStrokeWidth, defaultStyleValue,
@"circleStrokeWidth should return the default value after being unset.");
+ // Transition property test
+ layer.circleStrokeWidthTransition = transitionTest;
+ auto toptions = rawLayer->getCircleStrokeWidthTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition circleStrokeWidthTransition = layer.circleStrokeWidthTransition;
+ XCTAssertEqual(circleStrokeWidthTransition.delay, transitionTest.delay);
+ XCTAssertEqual(circleStrokeWidthTransition.duration, transitionTest.duration);
}
// circle-translate
diff --git a/platform/darwin/test/MGLFillStyleLayerTests.mm b/platform/darwin/test/MGLFillStyleLayerTests.mm
index c03b22c399..85f0b24fa7 100644
--- a/platform/darwin/test/MGLFillStyleLayerTests.mm
+++ b/platform/darwin/test/MGLFillStyleLayerTests.mm
@@ -2,10 +2,12 @@
// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLStyleLayerTests.h"
+#import "../../darwin/src/NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/fill_layer.hpp>
+#include <mbgl/style/transition_options.hpp>
@interface MGLFillLayerTests : MGLStyleLayerTests
@end
@@ -43,6 +45,9 @@
XCTAssertTrue(layer.rawLayer->is<mbgl::style::FillLayer>());
auto rawLayer = layer.rawLayer->as<mbgl::style::FillLayer>();
+ MGLTransition transitionTest = MGLTransitionMake(5, 4);
+
+
// fill-antialias
{
XCTAssertTrue(rawLayer->getFillAntialias().isUndefined(),
@@ -137,6 +142,15 @@
@"Unsetting fillColor should return fill-color to the default value.");
XCTAssertEqualObjects(layer.fillColor, defaultStyleValue,
@"fillColor should return the default value after being unset.");
+ // Transition property test
+ layer.fillColorTransition = transitionTest;
+ auto toptions = rawLayer->getFillColorTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition fillColorTransition = layer.fillColorTransition;
+ XCTAssertEqual(fillColorTransition.delay, transitionTest.delay);
+ XCTAssertEqual(fillColorTransition.duration, transitionTest.duration);
}
// fill-opacity
@@ -194,6 +208,15 @@
@"Unsetting fillOpacity should return fill-opacity to the default value.");
XCTAssertEqualObjects(layer.fillOpacity, defaultStyleValue,
@"fillOpacity should return the default value after being unset.");
+ // Transition property test
+ layer.fillOpacityTransition = transitionTest;
+ auto toptions = rawLayer->getFillOpacityTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition fillOpacityTransition = layer.fillOpacityTransition;
+ XCTAssertEqual(fillOpacityTransition.delay, transitionTest.delay);
+ XCTAssertEqual(fillOpacityTransition.duration, transitionTest.duration);
}
// fill-outline-color
@@ -251,6 +274,15 @@
@"Unsetting fillOutlineColor should return fill-outline-color to the default value.");
XCTAssertEqualObjects(layer.fillOutlineColor, defaultStyleValue,
@"fillOutlineColor should return the default value after being unset.");
+ // Transition property test
+ layer.fillOutlineColorTransition = transitionTest;
+ auto toptions = rawLayer->getFillOutlineColorTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition fillOutlineColorTransition = layer.fillOutlineColorTransition;
+ XCTAssertEqual(fillOutlineColorTransition.delay, transitionTest.delay);
+ XCTAssertEqual(fillOutlineColorTransition.duration, transitionTest.duration);
}
// fill-pattern
@@ -290,6 +322,15 @@
XCTAssertThrowsSpecificNamed(layer.fillPattern = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<NSString *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.fillPattern = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
+ // Transition property test
+ layer.fillPatternTransition = transitionTest;
+ auto toptions = rawLayer->getFillPatternTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition fillPatternTransition = layer.fillPatternTransition;
+ XCTAssertEqual(fillPatternTransition.delay, transitionTest.delay);
+ XCTAssertEqual(fillPatternTransition.duration, transitionTest.duration);
}
// fill-translate
diff --git a/platform/darwin/test/MGLLineStyleLayerTests.mm b/platform/darwin/test/MGLLineStyleLayerTests.mm
index 95c3e434c0..1e92959520 100644
--- a/platform/darwin/test/MGLLineStyleLayerTests.mm
+++ b/platform/darwin/test/MGLLineStyleLayerTests.mm
@@ -2,10 +2,12 @@
// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLStyleLayerTests.h"
+#import "../../darwin/src/NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/line_layer.hpp>
+#include <mbgl/style/transition_options.hpp>
@interface MGLLineLayerTests : MGLStyleLayerTests
@end
@@ -43,6 +45,9 @@
XCTAssertTrue(layer.rawLayer->is<mbgl::style::LineLayer>());
auto rawLayer = layer.rawLayer->as<mbgl::style::LineLayer>();
+ MGLTransition transitionTest = MGLTransitionMake(5, 4);
+
+
// line-cap
{
XCTAssertTrue(rawLayer->getLineCap().isUndefined(),
@@ -254,6 +259,15 @@
@"Unsetting lineBlur should return line-blur to the default value.");
XCTAssertEqualObjects(layer.lineBlur, defaultStyleValue,
@"lineBlur should return the default value after being unset.");
+ // Transition property test
+ layer.lineBlurTransition = transitionTest;
+ auto toptions = rawLayer->getLineBlurTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition lineBlurTransition = layer.lineBlurTransition;
+ XCTAssertEqual(lineBlurTransition.delay, transitionTest.delay);
+ XCTAssertEqual(lineBlurTransition.duration, transitionTest.duration);
}
// line-color
@@ -311,6 +325,15 @@
@"Unsetting lineColor should return line-color to the default value.");
XCTAssertEqualObjects(layer.lineColor, defaultStyleValue,
@"lineColor should return the default value after being unset.");
+ // Transition property test
+ layer.lineColorTransition = transitionTest;
+ auto toptions = rawLayer->getLineColorTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition lineColorTransition = layer.lineColorTransition;
+ XCTAssertEqual(lineColorTransition.delay, transitionTest.delay);
+ XCTAssertEqual(lineColorTransition.duration, transitionTest.duration);
}
// line-dasharray
@@ -407,6 +430,15 @@
@"Unsetting lineGapWidth should return line-gap-width to the default value.");
XCTAssertEqualObjects(layer.lineGapWidth, defaultStyleValue,
@"lineGapWidth should return the default value after being unset.");
+ // Transition property test
+ layer.lineGapWidthTransition = transitionTest;
+ auto toptions = rawLayer->getLineGapWidthTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition lineGapWidthTransition = layer.lineGapWidthTransition;
+ XCTAssertEqual(lineGapWidthTransition.delay, transitionTest.delay);
+ XCTAssertEqual(lineGapWidthTransition.duration, transitionTest.duration);
}
// line-offset
@@ -464,6 +496,15 @@
@"Unsetting lineOffset should return line-offset to the default value.");
XCTAssertEqualObjects(layer.lineOffset, defaultStyleValue,
@"lineOffset should return the default value after being unset.");
+ // Transition property test
+ layer.lineOffsetTransition = transitionTest;
+ auto toptions = rawLayer->getLineOffsetTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition lineOffsetTransition = layer.lineOffsetTransition;
+ XCTAssertEqual(lineOffsetTransition.delay, transitionTest.delay);
+ XCTAssertEqual(lineOffsetTransition.duration, transitionTest.duration);
}
// line-opacity
@@ -521,6 +562,15 @@
@"Unsetting lineOpacity should return line-opacity to the default value.");
XCTAssertEqualObjects(layer.lineOpacity, defaultStyleValue,
@"lineOpacity should return the default value after being unset.");
+ // Transition property test
+ layer.lineOpacityTransition = transitionTest;
+ auto toptions = rawLayer->getLineOpacityTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition lineOpacityTransition = layer.lineOpacityTransition;
+ XCTAssertEqual(lineOpacityTransition.delay, transitionTest.delay);
+ XCTAssertEqual(lineOpacityTransition.duration, transitionTest.duration);
}
// line-pattern
@@ -560,6 +610,15 @@
XCTAssertThrowsSpecificNamed(layer.linePattern = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<NSString *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.linePattern = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
+ // Transition property test
+ layer.linePatternTransition = transitionTest;
+ auto toptions = rawLayer->getLinePatternTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition linePatternTransition = layer.linePatternTransition;
+ XCTAssertEqual(linePatternTransition.delay, transitionTest.delay);
+ XCTAssertEqual(linePatternTransition.duration, transitionTest.duration);
}
// line-translate
@@ -683,6 +742,15 @@
XCTAssertThrowsSpecificNamed(layer.lineWidth = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<NSNumber *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.lineWidth = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
+ // Transition property test
+ layer.lineWidthTransition = transitionTest;
+ auto toptions = rawLayer->getLineWidthTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition lineWidthTransition = layer.lineWidthTransition;
+ XCTAssertEqual(lineWidthTransition.delay, transitionTest.delay);
+ XCTAssertEqual(lineWidthTransition.duration, transitionTest.duration);
}
}
diff --git a/platform/darwin/test/MGLNSDateAdditionsTests.mm b/platform/darwin/test/MGLNSDateAdditionsTests.mm
new file mode 100644
index 0000000000..6d8d951024
--- /dev/null
+++ b/platform/darwin/test/MGLNSDateAdditionsTests.mm
@@ -0,0 +1,40 @@
+#import <XCTest/XCTest.h>
+
+#include <mbgl/util/chrono.hpp>
+#import "../../darwin/src/NSDate+MGLAdditions.h"
+
+using namespace std::chrono_literals;
+
+@interface MGLNSDateAdditionsTests : XCTestCase
+@end
+
+@implementation MGLNSDateAdditionsTests
+
+- (void)testDurationToNSTimeInterval {
+
+ NSTimeInterval timeInterval = 5;
+ mbgl::Duration duration = MGLDurationFromTimeInterval(timeInterval);
+ NSTimeInterval durationTimeInterval = MGLTimeIntervalFromDuration(duration);
+
+ mbgl::Duration expectedDuration = 5s;
+ mbgl::Duration expectedDurationMiliSeconds = 5000ms;
+ mbgl::Duration expectedDurationMicroSeconds = 5000000us;
+ mbgl::Duration expectedDurationNanoSeconds = 5000000000ns;
+
+ XCTAssertEqual(timeInterval, durationTimeInterval);
+ XCTAssertEqual(timeInterval, MGLTimeIntervalFromDuration(expectedDuration));
+ XCTAssertEqual(timeInterval, MGLTimeIntervalFromDuration(expectedDurationMiliSeconds));
+ XCTAssertEqual(timeInterval, MGLTimeIntervalFromDuration(expectedDurationMicroSeconds));
+ XCTAssertEqual(timeInterval, MGLTimeIntervalFromDuration(expectedDurationNanoSeconds));
+
+ mbgl::Duration durationMiliSeconds = 2500ms;
+ mbgl::Duration durationMicroSeconds = 2500000us;
+ mbgl::Duration durationNanoSeconds = 2500000000ns;
+
+ XCTAssertEqual(NSTimeInterval(2.5), MGLTimeIntervalFromDuration(durationMiliSeconds));
+ XCTAssertEqual(NSTimeInterval(2.5), MGLTimeIntervalFromDuration(durationMicroSeconds));
+ XCTAssertEqual(NSTimeInterval(2.5), MGLTimeIntervalFromDuration(durationNanoSeconds));
+
+}
+
+@end
diff --git a/platform/darwin/test/MGLRasterStyleLayerTests.mm b/platform/darwin/test/MGLRasterStyleLayerTests.mm
index b7a764e6c2..7b0757eeb6 100644
--- a/platform/darwin/test/MGLRasterStyleLayerTests.mm
+++ b/platform/darwin/test/MGLRasterStyleLayerTests.mm
@@ -2,10 +2,12 @@
// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLStyleLayerTests.h"
+#import "../../darwin/src/NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/raster_layer.hpp>
+#include <mbgl/style/transition_options.hpp>
@interface MGLRasterLayerTests : MGLStyleLayerTests
@end
@@ -25,6 +27,9 @@
XCTAssertTrue(layer.rawLayer->is<mbgl::style::RasterLayer>());
auto rawLayer = layer.rawLayer->as<mbgl::style::RasterLayer>();
+ MGLTransition transitionTest = MGLTransitionMake(5, 4);
+
+
// raster-brightness-max
{
XCTAssertTrue(rawLayer->getRasterBrightnessMax().isUndefined(),
@@ -140,6 +145,15 @@
XCTAssertThrowsSpecificNamed(layer.rasterContrast = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<NSNumber *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.rasterContrast = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
+ // Transition property test
+ layer.rasterContrastTransition = transitionTest;
+ auto toptions = rawLayer->getRasterContrastTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition rasterContrastTransition = layer.rasterContrastTransition;
+ XCTAssertEqual(rasterContrastTransition.delay, transitionTest.delay);
+ XCTAssertEqual(rasterContrastTransition.duration, transitionTest.duration);
}
// raster-fade-duration
@@ -179,6 +193,15 @@
XCTAssertThrowsSpecificNamed(layer.rasterFadeDuration = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<NSNumber *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.rasterFadeDuration = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
+ // Transition property test
+ layer.rasterFadeDurationTransition = transitionTest;
+ auto toptions = rawLayer->getRasterFadeDurationTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition rasterFadeDurationTransition = layer.rasterFadeDurationTransition;
+ XCTAssertEqual(rasterFadeDurationTransition.delay, transitionTest.delay);
+ XCTAssertEqual(rasterFadeDurationTransition.duration, transitionTest.duration);
}
// raster-hue-rotate
@@ -257,6 +280,15 @@
XCTAssertThrowsSpecificNamed(layer.rasterOpacity = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<NSNumber *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.rasterOpacity = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
+ // Transition property test
+ layer.rasterOpacityTransition = transitionTest;
+ auto toptions = rawLayer->getRasterOpacityTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition rasterOpacityTransition = layer.rasterOpacityTransition;
+ XCTAssertEqual(rasterOpacityTransition.delay, transitionTest.delay);
+ XCTAssertEqual(rasterOpacityTransition.duration, transitionTest.duration);
}
// raster-saturation
@@ -296,6 +328,15 @@
XCTAssertThrowsSpecificNamed(layer.rasterSaturation = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<NSNumber *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.rasterSaturation = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
+ // Transition property test
+ layer.rasterSaturationTransition = transitionTest;
+ auto toptions = rawLayer->getRasterSaturationTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition rasterSaturationTransition = layer.rasterSaturationTransition;
+ XCTAssertEqual(rasterSaturationTransition.delay, transitionTest.delay);
+ XCTAssertEqual(rasterSaturationTransition.duration, transitionTest.duration);
}
}
diff --git a/platform/darwin/test/MGLStyleLayerTests.mm.ejs b/platform/darwin/test/MGLStyleLayerTests.mm.ejs
index 810d7fbd3b..a405ae58c4 100644
--- a/platform/darwin/test/MGLStyleLayerTests.mm.ejs
+++ b/platform/darwin/test/MGLStyleLayerTests.mm.ejs
@@ -7,10 +7,12 @@
// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLStyleLayerTests.h"
+#import "../../darwin/src/NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/<%- type %>_layer.hpp>
+#include <mbgl/style/transition_options.hpp>
@interface MGL<%- camelize(type) %>LayerTests : MGLStyleLayerTests
@end
@@ -53,6 +55,9 @@
XCTAssertNotEqual(layer.rawLayer, nullptr);
XCTAssertTrue(layer.rawLayer->is<mbgl::style::<%- camelize(type) %>Layer>());
auto rawLayer = layer.rawLayer->as<mbgl::style::<%- camelize(type) %>Layer>();
+
+ MGLTransition transitionTest = MGLTransitionMake(5, 4);
+
<% for (const property of properties) { -%>
// <%- originalPropertyName(property) %>
@@ -124,6 +129,17 @@
functionStyleValue = [MGLStyleValue<<%- propertyType(property) %>> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.<%- objCName(property) %> = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
<% } -%>
+<% if (property["transition"] && !property.original) { -%>
+ // Transition property test
+ layer.<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %>Transition = transitionTest;
+ auto toptions = rawLayer->get<%- camelize(originalPropertyName(property)) %>Transition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition <%- camelizeWithLeadingLowercase(originalPropertyName(property)) %>Transition = layer.<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %>Transition;
+ XCTAssertEqual(<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %>Transition.delay, transitionTest.delay);
+ XCTAssertEqual(<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %>Transition.duration, transitionTest.duration);
+<% } -%>
}
<% } -%>
}
diff --git a/platform/darwin/test/MGLStyleValueTests.swift b/platform/darwin/test/MGLStyleValueTests.swift
index f965c31e40..784b2fbaf1 100644
--- a/platform/darwin/test/MGLStyleValueTests.swift
+++ b/platform/darwin/test/MGLStyleValueTests.swift
@@ -24,8 +24,8 @@ extension MGLStyleValueTests {
return
}
- if let actualConstant = actual as? MGLStyleConstantValue<MGLColor> {
- assertColorsEqualWithAccuracy(actualConstant.rawValue, (expected as! MGLStyleConstantValue<MGLColor>).rawValue)
+ if let actualConstant = actual as? MGLConstantStyleValue<MGLColor> {
+ assertColorsEqualWithAccuracy(actualConstant.rawValue, (expected as! MGLConstantStyleValue<MGLColor>).rawValue)
} else if let actualFunction = actual as? MGLStyleFunction<MGLColor>,
let expectedFunction = expected as? MGLStyleFunction<MGLColor> {
@@ -55,11 +55,11 @@ extension MGLStyleValueTests {
XCTFail("Expected stop value of type \(type(of: expectedValue)), but found \(type(of: actualValue)) instead.")
return
}
- if let actualValue = actualValue as? MGLStyleConstantValue<MGLColor>,
- let expectedValue = expectedValue as? MGLStyleConstantValue<MGLColor> {
+ if let actualValue = actualValue as? MGLConstantStyleValue<MGLColor>,
+ let expectedValue = expectedValue as? MGLConstantStyleValue<MGLColor> {
assertColorsEqualWithAccuracy(actualValue.rawValue, expectedValue.rawValue)
- } else if let actualValue = actualValue as? MGLStyleConstantValue<AnyObject>,
- let expectedValue = expectedValue as? MGLStyleConstantValue<AnyObject> {
+ } else if let actualValue = actualValue as? MGLConstantStyleValue<AnyObject>,
+ let expectedValue = expectedValue as? MGLConstantStyleValue<AnyObject> {
XCTAssertEqual(actualValue, expectedValue)
} else {
XCTFail("Unsupported stop value type \(type(of: actualValue)).")
@@ -90,16 +90,16 @@ extension MGLStyleValueTests {
let circleStyleLayer = MGLCircleStyleLayer(identifier: "circleLayer", source: shapeSource)
// Boolean
- symbolStyleLayer.iconAllowsOverlap = MGLStyleConstantValue(rawValue: true)
- XCTAssertEqual((symbolStyleLayer.iconAllowsOverlap as! MGLStyleConstantValue<NSNumber>).rawValue, true)
+ symbolStyleLayer.iconAllowsOverlap = MGLConstantStyleValue(rawValue: true)
+ XCTAssertEqual((symbolStyleLayer.iconAllowsOverlap as! MGLConstantStyleValue<NSNumber>).rawValue, true)
// Number
- symbolStyleLayer.iconHaloWidth = MGLStyleConstantValue(rawValue: 3)
- XCTAssertEqual((symbolStyleLayer.iconHaloWidth as! MGLStyleConstantValue<NSNumber>).rawValue, 3)
+ symbolStyleLayer.iconHaloWidth = MGLConstantStyleValue(rawValue: 3)
+ XCTAssertEqual((symbolStyleLayer.iconHaloWidth as! MGLConstantStyleValue<NSNumber>).rawValue, 3)
// String
- symbolStyleLayer.text = MGLStyleConstantValue(rawValue: "{name}")
- XCTAssertEqual((symbolStyleLayer.text as! MGLStyleConstantValue<NSString>).rawValue, "{name}")
+ symbolStyleLayer.text = MGLConstantStyleValue(rawValue: "{name}")
+ XCTAssertEqual((symbolStyleLayer.text as! MGLConstantStyleValue<NSString>).rawValue, "{name}")
var circleTranslationOne = CGVector(dx: 100, dy: 0)
let circleTranslationValueOne = NSValue(bytes: &circleTranslationOne, objCType: "{CGVector=dd}")
diff --git a/platform/darwin/test/MGLSymbolStyleLayerTests.mm b/platform/darwin/test/MGLSymbolStyleLayerTests.mm
index 1d599f5aca..e3e473ef78 100644
--- a/platform/darwin/test/MGLSymbolStyleLayerTests.mm
+++ b/platform/darwin/test/MGLSymbolStyleLayerTests.mm
@@ -2,10 +2,12 @@
// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLStyleLayerTests.h"
+#import "../../darwin/src/NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/symbol_layer.hpp>
+#include <mbgl/style/transition_options.hpp>
@interface MGLSymbolLayerTests : MGLStyleLayerTests
@end
@@ -43,6 +45,9 @@
XCTAssertTrue(layer.rawLayer->is<mbgl::style::SymbolLayer>());
auto rawLayer = layer.rawLayer->as<mbgl::style::SymbolLayer>();
+ MGLTransition transitionTest = MGLTransitionMake(5, 4);
+
+
// icon-allow-overlap
{
XCTAssertTrue(rawLayer->getIconAllowOverlap().isUndefined(),
@@ -1468,6 +1473,15 @@
@"Unsetting iconColor should return icon-color to the default value.");
XCTAssertEqualObjects(layer.iconColor, defaultStyleValue,
@"iconColor should return the default value after being unset.");
+ // Transition property test
+ layer.iconColorTransition = transitionTest;
+ auto toptions = rawLayer->getIconColorTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition iconColorTransition = layer.iconColorTransition;
+ XCTAssertEqual(iconColorTransition.delay, transitionTest.delay);
+ XCTAssertEqual(iconColorTransition.duration, transitionTest.duration);
}
// icon-halo-blur
@@ -1525,6 +1539,15 @@
@"Unsetting iconHaloBlur should return icon-halo-blur to the default value.");
XCTAssertEqualObjects(layer.iconHaloBlur, defaultStyleValue,
@"iconHaloBlur should return the default value after being unset.");
+ // Transition property test
+ layer.iconHaloBlurTransition = transitionTest;
+ auto toptions = rawLayer->getIconHaloBlurTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition iconHaloBlurTransition = layer.iconHaloBlurTransition;
+ XCTAssertEqual(iconHaloBlurTransition.delay, transitionTest.delay);
+ XCTAssertEqual(iconHaloBlurTransition.duration, transitionTest.duration);
}
// icon-halo-color
@@ -1582,6 +1605,15 @@
@"Unsetting iconHaloColor should return icon-halo-color to the default value.");
XCTAssertEqualObjects(layer.iconHaloColor, defaultStyleValue,
@"iconHaloColor should return the default value after being unset.");
+ // Transition property test
+ layer.iconHaloColorTransition = transitionTest;
+ auto toptions = rawLayer->getIconHaloColorTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition iconHaloColorTransition = layer.iconHaloColorTransition;
+ XCTAssertEqual(iconHaloColorTransition.delay, transitionTest.delay);
+ XCTAssertEqual(iconHaloColorTransition.duration, transitionTest.duration);
}
// icon-halo-width
@@ -1639,6 +1671,15 @@
@"Unsetting iconHaloWidth should return icon-halo-width to the default value.");
XCTAssertEqualObjects(layer.iconHaloWidth, defaultStyleValue,
@"iconHaloWidth should return the default value after being unset.");
+ // Transition property test
+ layer.iconHaloWidthTransition = transitionTest;
+ auto toptions = rawLayer->getIconHaloWidthTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition iconHaloWidthTransition = layer.iconHaloWidthTransition;
+ XCTAssertEqual(iconHaloWidthTransition.delay, transitionTest.delay);
+ XCTAssertEqual(iconHaloWidthTransition.duration, transitionTest.duration);
}
// icon-opacity
@@ -1696,6 +1737,15 @@
@"Unsetting iconOpacity should return icon-opacity to the default value.");
XCTAssertEqualObjects(layer.iconOpacity, defaultStyleValue,
@"iconOpacity should return the default value after being unset.");
+ // Transition property test
+ layer.iconOpacityTransition = transitionTest;
+ auto toptions = rawLayer->getIconOpacityTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition iconOpacityTransition = layer.iconOpacityTransition;
+ XCTAssertEqual(iconOpacityTransition.delay, transitionTest.delay);
+ XCTAssertEqual(iconOpacityTransition.duration, transitionTest.duration);
}
// icon-translate
@@ -1837,6 +1887,15 @@
@"Unsetting textColor should return text-color to the default value.");
XCTAssertEqualObjects(layer.textColor, defaultStyleValue,
@"textColor should return the default value after being unset.");
+ // Transition property test
+ layer.textColorTransition = transitionTest;
+ auto toptions = rawLayer->getTextColorTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition textColorTransition = layer.textColorTransition;
+ XCTAssertEqual(textColorTransition.delay, transitionTest.delay);
+ XCTAssertEqual(textColorTransition.duration, transitionTest.duration);
}
// text-halo-blur
@@ -1894,6 +1953,15 @@
@"Unsetting textHaloBlur should return text-halo-blur to the default value.");
XCTAssertEqualObjects(layer.textHaloBlur, defaultStyleValue,
@"textHaloBlur should return the default value after being unset.");
+ // Transition property test
+ layer.textHaloBlurTransition = transitionTest;
+ auto toptions = rawLayer->getTextHaloBlurTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition textHaloBlurTransition = layer.textHaloBlurTransition;
+ XCTAssertEqual(textHaloBlurTransition.delay, transitionTest.delay);
+ XCTAssertEqual(textHaloBlurTransition.duration, transitionTest.duration);
}
// text-halo-color
@@ -1951,6 +2019,15 @@
@"Unsetting textHaloColor should return text-halo-color to the default value.");
XCTAssertEqualObjects(layer.textHaloColor, defaultStyleValue,
@"textHaloColor should return the default value after being unset.");
+ // Transition property test
+ layer.textHaloColorTransition = transitionTest;
+ auto toptions = rawLayer->getTextHaloColorTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition textHaloColorTransition = layer.textHaloColorTransition;
+ XCTAssertEqual(textHaloColorTransition.delay, transitionTest.delay);
+ XCTAssertEqual(textHaloColorTransition.duration, transitionTest.duration);
}
// text-halo-width
@@ -2008,6 +2085,15 @@
@"Unsetting textHaloWidth should return text-halo-width to the default value.");
XCTAssertEqualObjects(layer.textHaloWidth, defaultStyleValue,
@"textHaloWidth should return the default value after being unset.");
+ // Transition property test
+ layer.textHaloWidthTransition = transitionTest;
+ auto toptions = rawLayer->getTextHaloWidthTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition textHaloWidthTransition = layer.textHaloWidthTransition;
+ XCTAssertEqual(textHaloWidthTransition.delay, transitionTest.delay);
+ XCTAssertEqual(textHaloWidthTransition.duration, transitionTest.duration);
}
// text-opacity
@@ -2065,6 +2151,15 @@
@"Unsetting textOpacity should return text-opacity to the default value.");
XCTAssertEqualObjects(layer.textOpacity, defaultStyleValue,
@"textOpacity should return the default value after being unset.");
+ // Transition property test
+ layer.textOpacityTransition = transitionTest;
+ auto toptions = rawLayer->getTextOpacityTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition textOpacityTransition = layer.textOpacityTransition;
+ XCTAssertEqual(textOpacityTransition.delay, transitionTest.delay);
+ XCTAssertEqual(textOpacityTransition.duration, transitionTest.duration);
}
// text-translate