summaryrefslogtreecommitdiff
path: root/platform/macos
diff options
context:
space:
mode:
authorFabian Guerra <fabian.guerra@mapbox.com>2017-04-11 21:46:23 -0400
committerFabian Guerra <fabian.guerra@mapbox.com>2017-04-11 21:46:23 -0400
commit12b6fdbe3b1caad95089150d5c3ab69af31fb725 (patch)
tree414df39761f08c8221e9f51f73c18ced91656a11 /platform/macos
parent0cb05f926b7dcc18ba59c7a3c16f94860d1a0b1b (diff)
parent4d0605a004844726fc5f5e015c6d4320a880bfa0 (diff)
downloadqtlocation-mapboxgl-12b6fdbe3b1caad95089150d5c3ab69af31fb725.tar.gz
Merge branch 'release-ios-v3.5.0-android-v5.0.0' into boundsj-merge-release-branch
# Conflicts: # cmake/core-files.cmake # mapbox-gl-js # platform/android/CHANGELOG.md # platform/ios/CHANGELOG.md # platform/macos/CHANGELOG.md # platform/qt/bitrise-qt5.yml # src/mbgl/gl/attribute.hpp # src/mbgl/gl/context.cpp # src/mbgl/gl/program.hpp # src/mbgl/map/map.cpp # src/mbgl/programs/program.hpp # src/mbgl/renderer/painter.cpp
Diffstat (limited to 'platform/macos')
-rw-r--r--platform/macos/CHANGELOG.md15
-rw-r--r--platform/macos/Mapbox-macOS-SDK-symbols.podspec2
-rw-r--r--platform/macos/Mapbox-macOS-SDK.podspec2
-rw-r--r--platform/macos/docs/guides/For Style Authors.md157
-rw-r--r--platform/macos/docs/guides/Using Style Functions at Runtime.md (renamed from platform/macos/docs/guides/Data-Driven Styling.md)73
-rw-r--r--platform/macos/jazzy.yml3
-rwxr-xr-xplatform/macos/scripts/deploy-packages.sh2
-rwxr-xr-xplatform/macos/scripts/document.sh3
-rw-r--r--platform/macos/src/MGLMapView.mm21
9 files changed, 106 insertions, 172 deletions
diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md
index dab02592a5..1f47ef98d4 100644
--- a/platform/macos/CHANGELOG.md
+++ b/platform/macos/CHANGELOG.md
@@ -5,15 +5,24 @@
* Fixed an issue causing attribution button text to appear blue instead of black. ([#8701](https://github.com/mapbox/mapbox-gl-native/pull/8701))
* The error passed into `-[MGLMapViewDelegate mapViewDidFailLoadingMap:withError:]` now includes a more specific description and failure reason. ([#8418](https://github.com/mapbox/mapbox-gl-native/pull/8418))
-## 0.4.0
+## 0.4.1
+
+This version of the Mapbox macOS SDK corresponds to version 3.5.2 of the Mapbox iOS SDK.
+
+* Fixed an issue causing code signing failures and bloating the framework. ([#8640](https://github.com/mapbox/mapbox-gl-native/pull/8640))
+* Fixed an issue that could cause a crash if annotations unknown to the map view were interacted with. ([#8686](https://github.com/mapbox/mapbox-gl-native/pull/8686))
+* Renamed the “Data-Driven Styling” guide to “Using Style Functions at Runtime” and clarified the meaning of data-driven styling in the guide’s discussion of runtime style functions. ([#8627](https://github.com/mapbox/mapbox-gl-native/pull/8627))
+
+## 0.4.0 - April 2, 2017
+
+This version of the Mapbox macOS SDK corresponds to version 3.5.1 of the Mapbox iOS SDK.
### Internationalization
* Added support for right-to-left text and Arabic ligatures in labels. ([#6984](https://github.com/mapbox/mapbox-gl-native/pull/6984), [#7123](https://github.com/mapbox/mapbox-gl-native/pull/7123))
* Improved the line wrapping behavior of point-placed labels, especially labels written in Chinese and Japanese. ([#6828](https://github.com/mapbox/mapbox-gl-native/pull/6828), [#7446](https://github.com/mapbox/mapbox-gl-native/pull/7446))
* CJK characters now remain upright in vertically oriented labels that have line placement, such as road labels. ([#7114](https://github.com/mapbox/mapbox-gl-native/issues/7114))
-* Added Catalan, Chinese (Simplified and Traditional), Dutch, Finnish, French, German, Japanese, Lithuanian, Polish, Portuguese (Brazilian), Spanish, Swedish, Ukrainian, and Vietnamese localizations. ([#7316](https://github.com/mapbox/mapbox-gl-native/pull/7316), [#7503](https://github.com/mapbox/mapbox-gl-native/pull/7503), [#7899](https://github.com/mapbox/mapbox-gl-native/pull/7899), [#7999](https://github.com/mapbox/mapbox-gl-native/pull/7999),
-[#8113](https://github.com/mapbox/mapbox-gl-native/pull/8113), [#8256](https://github.com/mapbox/mapbox-gl-native/pull/8256))
+* Added Catalan, Chinese (Simplified and Traditional), Dutch, Finnish, French, German, Japanese, Lithuanian, Polish, Portuguese (Brazilian), Spanish, Swedish, Ukrainian, and Vietnamese localizations. ([#7316](https://github.com/mapbox/mapbox-gl-native/pull/7316), [#7503](https://github.com/mapbox/mapbox-gl-native/pull/7503), [#7899](https://github.com/mapbox/mapbox-gl-native/pull/7899), [#7999](https://github.com/mapbox/mapbox-gl-native/pull/7999), [#8113](https://github.com/mapbox/mapbox-gl-native/pull/8113), [#8256](https://github.com/mapbox/mapbox-gl-native/pull/8256))
### Styles
diff --git a/platform/macos/Mapbox-macOS-SDK-symbols.podspec b/platform/macos/Mapbox-macOS-SDK-symbols.podspec
index c17e665512..c621a7312b 100644
--- a/platform/macos/Mapbox-macOS-SDK-symbols.podspec
+++ b/platform/macos/Mapbox-macOS-SDK-symbols.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |m|
- version = '0.3.1'
+ version = '0.4.1'
m.name = 'Mapbox-macOS-SDK-symbols'
m.version = "#{version}-symbols"
diff --git a/platform/macos/Mapbox-macOS-SDK.podspec b/platform/macos/Mapbox-macOS-SDK.podspec
index a6f2d2838b..2417fb11ec 100644
--- a/platform/macos/Mapbox-macOS-SDK.podspec
+++ b/platform/macos/Mapbox-macOS-SDK.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |m|
- version = '0.3.1'
+ version = '0.4.1'
m.name = 'Mapbox-macOS-SDK'
m.version = version
diff --git a/platform/macos/docs/guides/For Style Authors.md b/platform/macos/docs/guides/For Style Authors.md
index 9c3665d816..9ed69ac9ea 100644
--- a/platform/macos/docs/guides/For Style Authors.md
+++ b/platform/macos/docs/guides/For Style Authors.md
@@ -179,30 +179,6 @@ layer objects. The property names generally correspond to the style JSON
properties, except for the use of camelCase instead of kebab-case. Properties
whose names differ from the style specification are listed below:
-### Circle style functions
-
-The runtime styling API introduces `MGLStyleFunction` to the macOS 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`
-
### Circle style layers
In style JSON | In Objective-C | In Swift
@@ -211,30 +187,6 @@ In style JSON | In Objective-C | In Swift
`circle-translate` | `MGLCircleStyleLayer.circleTranslation` | `MGLCircleStyleLayer.circleTranslation`
`circle-translate-anchor` | `MGLCircleStyleLayer.circleTranslationAnchor` | `MGLCircleStyleLayer.circleTranslationAnchor`
-### Fill style functions
-
-The runtime styling API introduces `MGLStyleFunction` to the macOS 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`
-
### Fill style layers
In style JSON | In Objective-C | In Swift
@@ -243,30 +195,6 @@ In style JSON | In Objective-C | In Swift
`fill-translate` | `MGLFillStyleLayer.fillTranslation` | `MGLFillStyleLayer.fillTranslation`
`fill-translate-anchor` | `MGLFillStyleLayer.fillTranslationAnchor` | `MGLFillStyleLayer.fillTranslationAnchor`
-### Line style functions
-
-The runtime styling API introduces `MGLStyleFunction` to the macOS 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`
-
### Line style layers
In style JSON | In Objective-C | In Swift
@@ -275,30 +203,6 @@ In style JSON | In Objective-C | In Swift
`line-translate` | `MGLLineStyleLayer.lineTranslation` | `MGLLineStyleLayer.lineTranslation`
`line-translate-anchor` | `MGLLineStyleLayer.lineTranslationAnchor` | `MGLLineStyleLayer.lineTranslationAnchor`
-### Raster style functions
-
-The runtime styling API introduces `MGLStyleFunction` to the macOS 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`
-
### Raster style layers
In style JSON | In Objective-C | In Swift
@@ -307,30 +211,6 @@ In style JSON | In Objective-C | In Swift
`raster-brightness-min` | `MGLRasterStyleLayer.minimumRasterBrightness` | `MGLRasterStyleLayer.minimumRasterBrightness`
`raster-hue-rotate` | `MGLRasterStyleLayer.rasterHueRotation` | `MGLRasterStyleLayer.rasterHueRotation`
-### Symbol style functions
-
-The runtime styling API introduces `MGLStyleFunction` to the macOS 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`
-
### Symbol style layers
In style JSON | In Objective-C | In Swift
@@ -363,10 +243,12 @@ In style JSON | In Objective-C | In Swift
Each property representing a layout or paint attribute is set to an
`MGLStyleValue` object, which is either an `MGLConstantStyleValue` object (for
-constant values) or an `MGLStyleFunction` object (for zoom level functions). The
+constant values) or an `MGLStyleFunction` object (for style functions). The
style value object is a container for the raw value or function parameters that
you want the attribute to be set to.
+### Constant style values
+
In contrast to the JSON type that the style specification defines for each
layout or paint property, the style value object often contains a more specific
Foundation or Cocoa type. General rules for attribute types are listed below.
@@ -397,6 +279,39 @@ offset or translation upward, while a negative `CGVector.dy` means an offset or
translation downward. This is the reverse of how `CGVector` is interpreted on
iOS.
+### Style functions
+
+A _style function_ allows you to vary the value of a layout or paint attribute
+based on the zoom level, data provided by content sources, or both. For more
+information about style functions, see “[Using Style Functions at Runtime](using-style-functions-at-runtime.html)”.
+
+Each kind of style function is represented by a distinct class, but you
+typically create style functions as you create any other style value, using
+class methods on `MGLStyleValue`:
+
+In style specification | SDK class | SDK factory method
+---------------------------|-----------------------------|-------------------
+zoom function | `MGLCameraStyleFunction` | `+[MGLStyleValue valueWithInterpolationMode:cameraStops:options:]`
+property function | `MGLSourceStyleFunction` | `+[MGLStyleValue valueWithInterpolationMode:sourceStops:attributeName:options:]`
+zoom-and-property function | `MGLCompositeStyleFunction` | `+[MGLStyleValue valueWithInterpolationMode:compositeStops:attributeName:options:]`
+
+The documentation for each individual style layer property indicates the kinds
+of style functions that are enabled for that property.
+
+When you create a style function, you specify an _interpolation mode_ and a
+series of _stops_. Each stop determines the effective value displayed at a
+particular zoom level (for camera functions) or the effective value on features
+with a particular attribute value in the content source (for source functions).
+The interpolation mode tells the SDK how to calculate the effective value
+between any two stops:
+
+In style specification | In the SDK
+-----------------------------|-----------
+`exponential` | `MGLInterpolationModeExponential`
+`interval` | `MGLInterpolationModeInterval`
+`categorical` | `MGLInterpolationModeCategorical`
+`identity` | `MGLInterpolationModeIdentity`
+
## Filtering sources
You can filter a shape or vector source by setting the
diff --git a/platform/macos/docs/guides/Data-Driven Styling.md b/platform/macos/docs/guides/Using Style Functions at Runtime.md
index 9e38e71318..b3098dfe04 100644
--- a/platform/macos/docs/guides/Data-Driven Styling.md
+++ b/platform/macos/docs/guides/Using Style Functions at Runtime.md
@@ -4,46 +4,47 @@
Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
-->
-# Data-Driven Styling
+# Using Style Functions at Runtime
-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.
+[Runtime Styling](runtime-styling.html) enables you to modify every aspect of the map’s appearance dynamically as a user interacts with your application. Much of the runtime styling API allows you to specify _style functions_ instead of constant values. A style function allows you to specify in advance how a layout or paint attribute will vary as the zoom level changes or how the appearance of individual features vary based on metadata provided by a content source.
-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.
+Style functions spare you the inconvenience of manually calculating intermediate values between different zoom levels or creating a multitude of style layers to handle homogeneous features in the map content. For example, if your content source indicates the prices of hotels in an area, you can color-code the hotels by price, relying on a style function to smoothly interpolate among desired colors without having to specify the color for each exact price.
-![available bikes](img/data-driven-styling/citibikes.png) ![subway lines](img/data-driven-styling/polylineExample.png)
+_Data-driven styling_ specifically refers to the use of style functions to vary the map’s appearance based on data in a content source.
+
+You can also specify style functions in a style JSON file, to be applied automatically when the map loads. See the [Mapbox Style Specification](https://www.mapbox.com/mapbox-gl-js/style-spec/#types-function) for details.
-# 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.
+![available bikes](img/data-driven-styling/citibikes.png) ![subway lines](img/data-driven-styling/polylineExample.png)
-`MGLStyleFunction`
+This guide uses earthquake data from the [U.S. Geological Survey](https://earthquake.usgs.gov/earthquakes/feed/v1.0/geojson.php) and data-driven styling 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.
-There are three subclasses of `MGLStyleFunction`:
+A style function is represented at runtime by the `MGLStyleFunction` class. 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.
+* `MGLCameraStyleFunction` is a style value that changes with zoom level. For example, you can make the radius of a circle increase according to zoom level.
+* `MGLSourceStyleFunction` is 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` is 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.
+The documentation for each individual style layer property notes 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)]
+let stops = [0: MGLStyleValue<NSColor>(rawValue: .yellow),
+ 2.5: MGLStyleValue(rawValue: .orange),
+ 5: MGLStyleValue(rawValue: .red),
+ 7.5: MGLStyleValue(rawValue: .blue),
+ 10: MGLStyleValue(rawValue: .white)]
```
-## Interpolation Mode
+## 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.
+`MGLInterpolationModeExponential` 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.
@@ -55,11 +56,11 @@ let symbolLayer = MGLSymbolStyleLayer(identifier: "place-city-sm", source: symbo
let source = MGLShapeSource(identifier: "earthquakes", url: url, options: nil)
style.addSource(source)
-let stops = [0: MGLStyleValue(rawValue: NSColor.yellow),
- 2.5: MGLStyleValue(rawValue: NSColor.orange),
- 5: MGLStyleValue(rawValue: NSColor.red),
- 7.5: MGLStyleValue(rawValue: NSColor.blue),
- 10: MGLStyleValue(rawValue: NSColor.white)]
+let stops = [0: MGLStyleValue<NSColor>(rawValue: .yellow),
+ 2.5: MGLStyleValue(rawValue: .orange),
+ 5: MGLStyleValue(rawValue: .red),
+ 7.5: MGLStyleValue(rawValue: .blue),
+ 10: MGLStyleValue(rawValue: .white)]
let layer = MGLCircleStyleLayer(identifier: "circles", source: source)
layer.circleColor = MGLStyleValue(interpolationMode: .exponential,
@@ -74,7 +75,7 @@ style.insertLayer(layer, below: symbolLayer)
### Exponential
-`MGLInterpolationModelExponential` combined with any `MGLStyleFunctionOptionInterpolationBase` greater than `0`, you can interpolate between values exponentially, create an accelerated ramp effect.
+By combining `MGLInterpolationModeExponential` with an `MGLStyleFunctionOptionInterpolationBase` greater than `0` (other than `1`), 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.
@@ -100,11 +101,11 @@ layer.circleRadius = MGLStyleValue(interpolationMode: .exponential,
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: NSColor.yellow),
- 2.5: MGLStyleValue(rawValue: NSColor.orange),
- 5: MGLStyleValue(rawValue: NSColor.red),
- 7.5: MGLStyleValue(rawValue: NSColor.blue),
- 10: MGLStyleValue(rawValue: NSColor.white)]
+let stops = [0: MGLStyleValue<NSColor>(rawValue: .yellow),
+ 2.5: MGLStyleValue(rawValue: .orange),
+ 5: MGLStyleValue(rawValue: .red),
+ 7.5: MGLStyleValue(rawValue: .blue),
+ 10: MGLStyleValue(rawValue: .white)]
layer.circleColor = MGLStyleValue(interpolationMode: .interval,
sourceStops: stops,
@@ -116,19 +117,19 @@ layer.circleColor = MGLStyleValue(interpolationMode: .interval,
### 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.
+At each stop, `MGLInterpolationModeCategorical` produces an output value equal to 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.
+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 blue to catch any events that do not fall into any of those categories.
``` swift
-let categoricalStops = ["earthquake": MGLStyleValue(rawValue: NSColor.orange),
- "explosion": MGLStyleValue(rawValue: NSColor.red),
- "quarry blast": MGLStyleValue(rawValue: NSColor.yellow)]
+let categoricalStops = ["earthquake": MGLStyleValue<NSColor>(rawValue: .orange),
+ "explosion": MGLStyleValue(rawValue: .red),
+ "quarry blast": MGLStyleValue(rawValue: .yellow)]
layer.circleColor = MGLStyleValue(interpolationMode: .categorical,
sourceStops: categoricalStops,
attributeName: "type",
- options: [.defaultValue: MGLStyleValue(rawValue: NSColor.blue)])
+ options: [.defaultValue: MGLStyleValue<NSColor>(rawValue: .blue)])
```
diff --git a/platform/macos/jazzy.yml b/platform/macos/jazzy.yml
index 9323119718..1f0e2fbc74 100644
--- a/platform/macos/jazzy.yml
+++ b/platform/macos/jazzy.yml
@@ -19,7 +19,7 @@ custom_categories:
children:
- Working with GeoJSON Data
- For Style Authors
- - Data-Driven Styling
+ - Using Style Functions at Runtime
- Info.plist Keys
- name: Maps
children:
@@ -27,7 +27,6 @@ custom_categories:
- MGLMapCamera
- MGLMapView
- MGLMapViewDelegate
- - MGLUserTrackingMode
- name: Shapes and Annotations
children:
- MGLAnnotation
diff --git a/platform/macos/scripts/deploy-packages.sh b/platform/macos/scripts/deploy-packages.sh
index 8f61519244..d9d74b2867 100755
--- a/platform/macos/scripts/deploy-packages.sh
+++ b/platform/macos/scripts/deploy-packages.sh
@@ -37,7 +37,7 @@ buildPackageStyle() {
step "Compressing ${file_name}…"
cd build/macos/pkg
rm -f ../deploy/${file_name}
- zip -r ../deploy/${file_name} *
+ zip -yr ../deploy/${file_name} *
cd -
if [[ "${GITHUB_RELEASE}" == true ]]; then
echo "Uploading ${file_name} to GitHub"
diff --git a/platform/macos/scripts/document.sh b/platform/macos/scripts/document.sh
index 69c9aaa871..2e53dc359b 100755
--- a/platform/macos/scripts/document.sh
+++ b/platform/macos/scripts/document.sh
@@ -36,7 +36,8 @@ sed -n -e '/^## /{' -e ':a' -e 'n' -e '/^## /q' -e 'p' -e 'ba' -e '}' platform/m
rm -rf ${OUTPUT}
mkdir -p ${OUTPUT}
-cp -r platform/macos/docs/img "${OUTPUT}/img"
+cp -r platform/darwin/docs/img "${OUTPUT}"
+cp -r platform/macos/docs/img "${OUTPUT}"
jazzy \
--config platform/macos/jazzy.yml \
diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm
index 5d14192c61..68a21b5666 100644
--- a/platform/macos/src/MGLMapView.mm
+++ b/platform/macos/src/MGLMapView.mm
@@ -1806,12 +1806,18 @@ public:
for (auto const& annotationTag: annotationTags)
{
- if (!_annotationContextsByAnnotationTag.count(annotationTag))
+ if (!_annotationContextsByAnnotationTag.count(annotationTag) ||
+ annotationTag == MGLAnnotationTagNotFound)
{
continue;
}
+
MGLAnnotationContext annotationContext = _annotationContextsByAnnotationTag.at(annotationTag);
- [annotations addObject:annotationContext.annotation];
+ NSAssert(annotationContext.annotation, @"Missing annotation for tag %u.", annotationTag);
+ if (annotationContext.annotation)
+ {
+ [annotations addObject:annotationContext.annotation];
+ }
}
return [annotations copy];
@@ -1822,11 +1828,12 @@ public:
/// Returns the annotation assigned the given tag. Cheap.
- (id <MGLAnnotation>)annotationWithTag:(MGLAnnotationTag)tag {
- if (!_annotationContextsByAnnotationTag.count(tag)) {
+ if ( ! _annotationContextsByAnnotationTag.count(tag) ||
+ tag == MGLAnnotationTagNotFound) {
return nil;
}
- MGLAnnotationContext &annotationContext = _annotationContextsByAnnotationTag[tag];
+ MGLAnnotationContext &annotationContext = _annotationContextsByAnnotationTag.at(tag);
return annotationContext.annotation;
}
@@ -2063,8 +2070,8 @@ public:
// Filter out any annotation whose image is unselectable or for which
// hit testing fails.
auto end = std::remove_if(nearbyAnnotations.begin(), nearbyAnnotations.end(), [&](const MGLAnnotationTag annotationTag) {
- NSAssert(_annotationContextsByAnnotationTag.count(annotationTag) != 0, @"Unknown annotation found nearby click");
id <MGLAnnotation> annotation = [self annotationWithTag:annotationTag];
+ NSAssert(annotation, @"Unknown annotation found nearby click");
if (!annotation) {
return true;
}
@@ -2153,9 +2160,11 @@ public:
}
- (id <MGLAnnotation>)selectedAnnotation {
- if (!_annotationContextsByAnnotationTag.count(_selectedAnnotationTag)) {
+ if ( ! _annotationContextsByAnnotationTag.count(_selectedAnnotationTag) ||
+ _selectedAnnotationTag == MGLAnnotationTagNotFound) {
return nil;
}
+
MGLAnnotationContext &annotationContext = _annotationContextsByAnnotationTag.at(_selectedAnnotationTag);
return annotationContext.annotation;
}