summaryrefslogtreecommitdiff
path: root/platform/macos
diff options
context:
space:
mode:
Diffstat (limited to 'platform/macos')
-rw-r--r--platform/macos/CHANGELOG.md22
-rw-r--r--platform/macos/app/MapDocument.m10
-rw-r--r--platform/macos/app/ca.lproj/Localizable.strings0
-rw-r--r--platform/macos/app/fi.lproj/Localizable.strings0
-rw-r--r--platform/macos/app/nl.lproj/Localizable.strings0
-rw-r--r--platform/macos/app/ru.lproj/Localizable.strings0
-rw-r--r--platform/macos/docs/guides/Data-Driven Styling.md154
-rw-r--r--platform/macos/docs/guides/For Style Authors.md125
-rw-r--r--platform/macos/docs/pod-README.md34
-rw-r--r--platform/macos/jazzy.yml1
-rw-r--r--platform/macos/macos.xcodeproj/project.pbxproj36
-rw-r--r--platform/macos/sdk/ca.lproj/Localizable.strings15
-rw-r--r--platform/macos/sdk/fi.lproj/Localizable.strings15
-rw-r--r--platform/macos/sdk/nl.lproj/Localizable.strings15
-rw-r--r--platform/macos/sdk/ru.lproj/Localizable.strings15
-rw-r--r--platform/macos/src/MGLMapView.h105
-rw-r--r--platform/macos/src/MGLMapView.mm38
-rw-r--r--platform/macos/src/MGLMapViewDelegate.h14
18 files changed, 505 insertions, 94 deletions
diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md
index c840d2f8a2..152fdc382b 100644
--- a/platform/macos/CHANGELOG.md
+++ b/platform/macos/CHANGELOG.md
@@ -11,16 +11,19 @@
* 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 Chinese (Simplified and Traditional), 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))
+* 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
* Added support for data-driven styling in the form of source and composite style functions. `MGLStyleFunction` is now an abstract class, with `MGLCameraStyleFunction` providing the behavior of `MGLStyleFunction` in previous releases. New `MGLStyleFunction` subclasses allow you to vary a style attribute by the values of attributes of features in the source. ([#7596](https://github.com/mapbox/mapbox-gl-native/pull/7596))
+* Added methods to MGLShapeSource and MGLVectorSource for querying features loaded by the source, whether or not they’re visible on the map. ([#8263](https://github.com/mapbox/mapbox-gl-native/pull/8263))
* Added `circleStrokeColor`, `circleStrokeWidth`, and `circleStrokeOpacity` properties to MGLCircleStyleLayer and support for corresponding properties in style JSON files. ([#7356](https://github.com/mapbox/mapbox-gl-native/pull/7356))
* Point-placed labels in symbol style layers are now placed at more optimal locations within polygons. ([#7465](https://github.com/mapbox/mapbox-gl-native/pull/7465))
* Fixed flickering that occurred when manipulating a style layer. ([#7616](https://github.com/mapbox/mapbox-gl-native/pull/7616))
* Symbol style layers can now render point collections (known as multipoints in GeoJSON). ([#7445](https://github.com/mapbox/mapbox-gl-native/pull/7445))
-* Added properties to MGLStyle to delay or animate changes to style layers. ([#7711](https://github.com/mapbox/mapbox-gl-native/pull/7711))
+* Added a `transition` property to MGLStyle to customize the timing of changes to style layers. ([#7711](https://github.com/mapbox/mapbox-gl-native/pull/7711))
+* Added properties to MGLStyleLayer subclasses to customize the timing of transitions between values of individual attributes. ([#8225](https://github.com/mapbox/mapbox-gl-native/pull/8225))
* Fixed an issue causing lines and text labels toward the top of the map view to appear blurry when the map is tilted. ([#7444](https://github.com/mapbox/mapbox-gl-native/pull/7444))
* Fixed incorrect interpolation of style functions in Boolean-typed style attributes. ([#7526](https://github.com/mapbox/mapbox-gl-native/pull/7526))
* Removed support for the `ref` property in layers in style JSON files. ([#7586](https://github.com/mapbox/mapbox-gl-native/pull/7586))
@@ -30,13 +33,18 @@
* Fixed an issue causing vector style layer predicates to be evaluated as if each feature had a `$type` attribute of 1, 2, or 3. The `$type` key path can now be compared to `Point`, `LineString`, or `Polygon`, as described in the documentation. ([#7971](https://github.com/mapbox/mapbox-gl-native/pull/7971))
* When setting an `MGLShapeSource`’s shape to an `MGLFeature` instance, any `NSColor` attribute value is now converted to the equivalent CSS string representation for use with `MGLInterpolationModeIdentity` in style functions. ([#8025](https://github.com/mapbox/mapbox-gl-native/pull/8025))
* An exception is no longer thrown if layers or sources are removed from a style before they are added. ([#7962](https://github.com/mapbox/mapbox-gl-native/pull/7962))
-* Added feature querying on vector and GeoJSON sources [#8263](https://github.com/mapbox/mapbox-gl-native/pull/8263)
+* Renamed MGLStyleConstantValue to MGLConstantStyleValue. For compatibility with previous releases, MGLStyleConstantValue is now an alias of MGLConstantStyleValue. ([#8090](https://github.com/mapbox/mapbox-gl-native/pull/8090))
+* Fixed a crash that could occur when switching styles after adding an MGLSource to the style. ([#8298](https://github.com/mapbox/mapbox-gl-native/pull/8298))
-### User interaction
+### Annotations and user interaction
* Added a method to MGLMapViewDelegate, `-mapView:shouldChangeFromCamera:toCamera:`, that you can implement to restrict which parts the user can navigate to using gestures. ([#5584](https://github.com/mapbox/mapbox-gl-native/pull/5584))
* When a map view is the first responder, pressing <kbd>+</kbd>, <kbd>-</kbd>, or <kbd>=</kbd> now zooms the map. ([#8033](https://github.com/mapbox/mapbox-gl-native/pull/8033))
+* Changing the coordinates of a point annotation no longer deselects the annotation. ([#8269](https://github.com/mapbox/mapbox-gl-native/pull/8269))
+* Fixed an issue that could cause a crash when point annotations were added and removed while simultaneously querying source features. ([#8374](https://github.com/mapbox/mapbox-gl-native/pull/8374))
+* Fixed an issue preventing MGLMapView from adding a polyline annotation with the same coordinates as a polygon annotation. ([#8355](https://github.com/mapbox/mapbox-gl-native/pull/8355))
* Zooming by double-tap, two-finger tap, zoom buttons, shortcut keys, or demo app menu items or shortcut keys now zooms to the nearest integer zoom level. ([#8027](https://github.com/mapbox/mapbox-gl-native/pull/8027))
+* Fixed an issue where translucent point annotations along tile boundaries would be drawn darker than expected. ([#6832](https://github.com/mapbox/mapbox-gl-native/pull/6832))
### Networking and offline maps
@@ -44,15 +52,15 @@
* Fixed a memory leak in MGLMapView. ([#7956](https://github.com/mapbox/mapbox-gl-native/pull/7956))
* Fixed an issue that could prevent a cached style from appearing while the computer is offline. ([#7770](https://github.com/mapbox/mapbox-gl-native/pull/7770))
* Fixed an issue that could prevent a style from loading when reestablishing a network connection. ([#7902](https://github.com/mapbox/mapbox-gl-native/pull/7902))
-* `MGLOfflineStorage` instances now support a delegate conforming to `MGLOfflineStorageDelegate`, which allows altering URLs before they are requested from the internet. ([#8084](https://github.com/mapbox/mapbox-gl-native/pull/8084))
+* `MGLOfflineStorage` instances now support a delegate conforming to `MGLOfflineStorageDelegate`, which allows altering URLs before they are requested from the Internet. ([#8084](https://github.com/mapbox/mapbox-gl-native/pull/8084))
### Other changes
+* Added support for the Carthage dependency manager. See [this SDK’s homepage](https://mapbox.github.io/mapbox-gl-native/macos/) for setup instructions. ([#8257](https://github.com/mapbox/mapbox-gl-native/pull/8257))
* Fixed an issue that, among other things, caused various islands to disappear at certain zoom levels. ([#7621](https://github.com/mapbox/mapbox-gl-native/pull/7621))
-* Fixed an issue where translucent point annotations along tile boundaries would be drawn darker than expected. ([#6832](https://github.com/mapbox/mapbox-gl-native/pull/6832))
+* Added a method to MGLMapView that allows you to specify a predicate when querying for visible features. ([#8256](https://github.com/mapbox/mapbox-gl-native/pull/8246))
* Fixed flickering that occurred when panning past the antimeridian. ([#7574](https://github.com/mapbox/mapbox-gl-native/pull/7574))
* Added a `MGLDistanceFormatter` class for formatting geographic distances. ([#7888](https://github.com/mapbox/mapbox-gl-native/pull/7888))
-* Added support for predicates in rendered feature querying [8256](https://github.com/mapbox/mapbox-gl-native/pull/8246)
## 0.3.1 - February 21, 2017
diff --git a/platform/macos/app/MapDocument.m b/platform/macos/app/MapDocument.m
index 39055d7447..ec90888084 100644
--- a/platform/macos/app/MapDocument.m
+++ b/platform/macos/app/MapDocument.m
@@ -369,14 +369,14 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
return localizedString;
};
- if ([layer.text isKindOfClass:[MGLStyleConstantValue class]]) {
- NSString *textField = [(MGLStyleConstantValue<NSString *> *)layer.text rawValue];
+ if ([layer.text isKindOfClass:[MGLConstantStyleValue class]]) {
+ NSString *textField = [(MGLConstantStyleValue<NSString *> *)layer.text rawValue];
layer.text = [MGLStyleValue<NSString *> valueWithRawValue:stringByLocalizingString(textField)];
}
else if ([layer.text isKindOfClass:[MGLCameraStyleFunction class]]) {
MGLCameraStyleFunction *function = (MGLCameraStyleFunction<NSString *> *)layer.text;
NSMutableDictionary *stops = function.stops.mutableCopy;
- [stops enumerateKeysAndObjectsUsingBlock:^(NSNumber *zoomLevel, MGLStyleConstantValue<NSString *> *stop, BOOL *done) {
+ [stops enumerateKeysAndObjectsUsingBlock:^(NSNumber *zoomLevel, MGLConstantStyleValue<NSString *> *stop, BOOL *done) {
NSString *textField = stop.rawValue;
stops[zoomLevel] = [MGLStyleValue<NSString *> valueWithRawValue:stringByLocalizingString(textField)];
}];
@@ -683,8 +683,8 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
}
- (IBAction)manipulateStyle:(id)sender {
- self.mapView.style.transitionDuration = 5;
- self.mapView.style.transitionDelay = 1;
+ MGLTransition transition = { .duration = 5, .delay = 1 };
+ self.mapView.style.transition = transition;
MGLFillStyleLayer *fillStyleLayer = (MGLFillStyleLayer *)[self.mapView.style layerWithIdentifier:@"water"];
diff --git a/platform/macos/app/ca.lproj/Localizable.strings b/platform/macos/app/ca.lproj/Localizable.strings
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/platform/macos/app/ca.lproj/Localizable.strings
diff --git a/platform/macos/app/fi.lproj/Localizable.strings b/platform/macos/app/fi.lproj/Localizable.strings
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/platform/macos/app/fi.lproj/Localizable.strings
diff --git a/platform/macos/app/nl.lproj/Localizable.strings b/platform/macos/app/nl.lproj/Localizable.strings
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/platform/macos/app/nl.lproj/Localizable.strings
diff --git a/platform/macos/app/ru.lproj/Localizable.strings b/platform/macos/app/ru.lproj/Localizable.strings
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/platform/macos/app/ru.lproj/Localizable.strings
diff --git a/platform/macos/docs/guides/Data-Driven Styling.md b/platform/macos/docs/guides/Data-Driven Styling.md
new file mode 100644
index 0000000000..9e38e71318
--- /dev/null
+++ b/platform/macos/docs/guides/Data-Driven Styling.md
@@ -0,0 +1,154 @@
+
+<!--
+ 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: 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 layer = MGLCircleStyleLayer(identifier: "circles", source: source)
+layer.circleColor = MGLStyleValue(interpolationMode: .exponential,
+ sourceStops: stops,
+ attributeName: "mag",
+ options: [.defaultValue: MGLStyleValue<NSColor>(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: NSColor.yellow),
+ 2.5: MGLStyleValue(rawValue: NSColor.orange),
+ 5: MGLStyleValue(rawValue: NSColor.red),
+ 7.5: MGLStyleValue(rawValue: NSColor.blue),
+ 10: MGLStyleValue(rawValue: NSColor.white)]
+
+layer.circleColor = MGLStyleValue(interpolationMode: .interval,
+ sourceStops: stops,
+ attributeName: "mag",
+ options: [.defaultValue: MGLStyleValue<NSColor>(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: NSColor.orange),
+ "explosion": MGLStyleValue(rawValue: NSColor.red),
+ "quarry blast": MGLStyleValue(rawValue: NSColor.yellow)]
+
+layer.circleColor = MGLStyleValue(interpolationMode: .categorical,
+ sourceStops: categoricalStops,
+ attributeName: "type",
+ options: [.defaultValue: MGLStyleValue(rawValue: NSColor.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/macos/docs/guides/For Style Authors.md b/platform/macos/docs/guides/For Style Authors.md
index 78a3063b06..9c3665d816 100644
--- a/platform/macos/docs/guides/For Style Authors.md
+++ b/platform/macos/docs/guides/For Style Authors.md
@@ -1,6 +1,6 @@
<!--
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
@@ -98,6 +98,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
@@ -178,6 +179,30 @@ 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
@@ -186,6 +211,30 @@ 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
@@ -194,6 +243,30 @@ 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
@@ -202,6 +275,30 @@ 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
@@ -210,6 +307,30 @@ 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
@@ -241,7 +362,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/macos/docs/pod-README.md b/platform/macos/docs/pod-README.md
index 33386340c6..f247277ca2 100644
--- a/platform/macos/docs/pod-README.md
+++ b/platform/macos/docs/pod-README.md
@@ -14,15 +14,43 @@ The Mapbox macOS SDK is compatible with macOS 10.10.0 and above for Cocoa applic
## Installation
-1. Download the [latest Mapbox macOS SDK release](https://github.com/mapbox/mapbox-gl-native/releases/) from GitHub – look for a release that begins with “macos-”. (Alternatively, you can integrate the Mapbox macOS SDK into your application [using CocoaPods](https://cocoapods.org/pods/Mapbox-macOS-SDK). If you do use CocoaPods, skip the next step.)
+There are three ways to install the Mapbox macOS SDK:
+
+### Manually
+
+1. Download the [latest Mapbox macOS SDK release](https://github.com/mapbox/mapbox-gl-native/releases/) from GitHub – look for a release that begins with “macos-”.
1. Open the project editor, select your application target, then go to the General tab. Drag Mapbox.framework into the “Embedded Binaries” section. (Don’t drag it into the “Linked Frameworks and Libraries” section; Xcode will add it there automatically.) In the sheet that appears, make sure “Copy items if needed” is checked, then click Finish.
-1. Mapbox vector tiles require a Mapbox account and API access token. In the project editor, select the application target, then go to the Info tab. Under the “Custom macOS Application Target Properties” section, set `MGLMapboxAccessToken` to your access token. You can obtain an access token from the [Mapbox account page](https://www.mapbox.com/studio/account/tokens/).
+### Via Carthage
+
+The Mapbox macOS SDK is a binary-only dependency, so you’ll need Carthage 0.19 or above. In your [Cartfile](https://github.com/Carthage/Carthage/blob/master/Documentation/Artifacts.md#binary-only-frameworks), specify this dependency (plus an optional version requirement):
+
+```
+binary "https://mapbox.github.io/mapbox-gl-native/macos/Mapbox-macOS-SDK.json"
+```
+
+After running `carthage update`, you’ll find Mapbox.framework in the Carthage/Build/ folder. Follow [these instructions](https://github.com/Carthage/Carthage#if-youre-building-for-os-x) to integrate it into your project.
+
+### Via CocoaPods
+
+Create a [Podfile](https://guides.cocoapods.org/syntax/podfile.html) with the following specification:
+
+```rb
+platform :osx, '10.10'
+
+target 'TargetNameForYourApp' do
+ pod 'Mapbox-iOS-SDK', '~> x.y'
+end
+```
+
+where _x.y_ is the current version. In Terminal, run `pod install`.
## Usage
-In a storyboard or XIB:
+Mapbox vector tiles require a Mapbox account and API access token. In the project editor, select the application target, then go to the Info tab. Under the “Custom macOS Application Target Properties” section, set `MGLMapboxAccessToken` to your access token. You can obtain an access token from the [Mapbox account page](https://www.mapbox.com/studio/account/tokens/).
+
+Then, in a storyboard or XIB:
1. Add a view to your view controller or window. (Drag Custom View from the Object library to the View Controller scene on the Interface Builder canvas. In a XIB, drag it instead to the window on the canvas.)
2. In the Identity inspector, set the view’s custom class to `MGLMapView`.
diff --git a/platform/macos/jazzy.yml b/platform/macos/jazzy.yml
index 3d74fbc652..9323119718 100644
--- a/platform/macos/jazzy.yml
+++ b/platform/macos/jazzy.yml
@@ -19,6 +19,7 @@ custom_categories:
children:
- Working with GeoJSON Data
- For Style Authors
+ - Data-Driven Styling
- Info.plist Keys
- name: Maps
children:
diff --git a/platform/macos/macos.xcodeproj/project.pbxproj b/platform/macos/macos.xcodeproj/project.pbxproj
index 7cd5c55ca3..0db0acb5b0 100644
--- a/platform/macos/macos.xcodeproj/project.pbxproj
+++ b/platform/macos/macos.xcodeproj/project.pbxproj
@@ -8,6 +8,7 @@
/* Begin PBXBuildFile section */
1753ED401E53CE6100A9FD90 /* MGLConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = 1753ED3F1E53CE5200A9FD90 /* MGLConversion.h */; };
+ 1F95931B1E6DE2B600D5B294 /* MGLNSDateAdditionsTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1F95931A1E6DE2B600D5B294 /* MGLNSDateAdditionsTests.mm */; };
30E5781B1DAA857E0050F07E /* NSImage+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 30E578141DAA7D920050F07E /* NSImage+MGLAdditions.h */; };
3508EC641D749D39009B0EE4 /* NSExpression+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 3508EC621D749D39009B0EE4 /* NSExpression+MGLAdditions.h */; };
3508EC651D749D39009B0EE4 /* NSExpression+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3508EC631D749D39009B0EE4 /* NSExpression+MGLAdditions.mm */; };
@@ -265,6 +266,7 @@
/* Begin PBXFileReference section */
1753ED3F1E53CE5200A9FD90 /* MGLConversion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLConversion.h; sourceTree = "<group>"; };
+ 1F95931A1E6DE2B600D5B294 /* MGLNSDateAdditionsTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLNSDateAdditionsTests.mm; path = ../../darwin/test/MGLNSDateAdditionsTests.mm; sourceTree = "<group>"; };
30E578141DAA7D920050F07E /* NSImage+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSImage+MGLAdditions.h"; path = "src/NSImage+MGLAdditions.h"; sourceTree = SOURCE_ROOT; };
3508EC621D749D39009B0EE4 /* NSExpression+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSExpression+MGLAdditions.h"; sourceTree = "<group>"; };
3508EC631D749D39009B0EE4 /* NSExpression+MGLAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSExpression+MGLAdditions.mm"; sourceTree = "<group>"; };
@@ -374,6 +376,16 @@
DA5589761D320C41006B7F64 /* wms.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = wms.json; sourceTree = "<group>"; };
DA6023EF1E4CE8E500DBFF23 /* sv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sv; path = sv.lproj/Foundation.strings; sourceTree = "<group>"; };
DA6023F01E4CE8FF00DBFF23 /* sv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = sv; path = sv.lproj/Foundation.stringsdict; sourceTree = "<group>"; };
+ DA618B131E68850300CB7F44 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Localizable.strings; sourceTree = "<group>"; };
+ DA618B141E68852C00CB7F44 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Localizable.strings; sourceTree = "<group>"; };
+ DA618B151E6886DF00CB7F44 /* ca */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = ca; path = ca.lproj/Foundation.stringsdict; sourceTree = "<group>"; };
+ DA618B161E6886E000CB7F44 /* ca */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ca; path = ca.lproj/Localizable.strings; sourceTree = "<group>"; };
+ DA618B171E68876C00CB7F44 /* ca */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ca; path = ca.lproj/Foundation.strings; sourceTree = "<group>"; };
+ DA618B181E6887C600CB7F44 /* ca */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ca; path = ca.lproj/Localizable.strings; sourceTree = "<group>"; };
+ DA618B231E6891ED00CB7F44 /* lt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = lt; path = lt.lproj/Foundation.strings; sourceTree = "<group>"; };
+ DA618B241E6891F300CB7F44 /* lt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = lt; path = lt.lproj/Foundation.stringsdict; sourceTree = "<group>"; };
+ DA618B271E68926E00CB7F44 /* fi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fi; path = fi.lproj/Localizable.strings; sourceTree = "<group>"; };
+ DA618B2A1E6892B500CB7F44 /* fi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fi; path = fi.lproj/Localizable.strings; sourceTree = "<group>"; };
DA6408D51DA4E5DA00908C90 /* MGLVectorStyleLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLVectorStyleLayer.h; sourceTree = "<group>"; };
DA6408D61DA4E5DA00908C90 /* MGLVectorStyleLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLVectorStyleLayer.m; sourceTree = "<group>"; };
DA7262051DEEDD460043BB89 /* MGLOpenGLStyleLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLOpenGLStyleLayer.h; sourceTree = "<group>"; };
@@ -533,6 +545,9 @@
DAE6C3CA1CC34BD800DB3429 /* MGLOfflineRegionTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLOfflineRegionTests.m; path = ../../darwin/test/MGLOfflineRegionTests.m; sourceTree = "<group>"; };
DAE6C3CC1CC34BD800DB3429 /* MGLStyleTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLStyleTests.mm; path = ../../darwin/test/MGLStyleTests.mm; sourceTree = "<group>"; };
DAE7DEC31E24549F007505A6 /* MGLNSStringAdditionsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLNSStringAdditionsTests.m; path = ../../darwin/test/MGLNSStringAdditionsTests.m; sourceTree = "<group>"; };
+ DAE8CCAA1E6E8605009B5CB0 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = ru; path = ru.lproj/Foundation.stringsdict; sourceTree = "<group>"; };
+ DAE8CCAB1E6E8B72009B5CB0 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/Localizable.strings; sourceTree = "<group>"; };
+ DAE8CCAC1E6E8B8D009B5CB0 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/Localizable.strings; sourceTree = "<group>"; };
DAED385D1D62CED700D7640F /* NSURL+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSURL+MGLAdditions.h"; sourceTree = "<group>"; };
DAED385E1D62CED700D7640F /* NSURL+MGLAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSURL+MGLAdditions.m"; sourceTree = "<group>"; };
DAEDC4311D6033F1000224FF /* MGLAttributionInfoTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLAttributionInfoTests.m; path = ../../darwin/test/MGLAttributionInfoTests.m; sourceTree = "<group>"; };
@@ -950,6 +965,7 @@
DA2987591E1A4290002299F5 /* MGLDocumentationExampleTests.swift */,
DD58A4C71D822C6200E1F038 /* MGLExpressionTests.mm */,
35C6DF861E214C1800ACA483 /* MGLDistanceFormatterTests.m */,
+ 1F95931A1E6DE2B600D5B294 /* MGLNSDateAdditionsTests.mm */,
DA0CD58D1CF56F5800A5F5A5 /* MGLFeatureTests.mm */,
DAE6C3C81CC34BD800DB3429 /* MGLGeometryTests.mm */,
DAE7DEC31E24549F007505A6 /* MGLNSStringAdditionsTests.m */,
@@ -1253,6 +1269,10 @@
pl,
uk,
lt,
+ ru,
+ ca,
+ fi,
+ nl,
);
mainGroup = DA839E891CC2E3400062CAFB;
productRefGroup = DA839E931CC2E3400062CAFB /* Products */;
@@ -1411,6 +1431,7 @@
DAE6C3D21CC34C9900DB3429 /* MGLGeometryTests.mm in Sources */,
DA87A9A41DCACC5000810D09 /* MGLSymbolStyleLayerTests.mm in Sources */,
40E1601D1DF217D6005EA6D9 /* MGLStyleLayerTests.m in Sources */,
+ 1F95931B1E6DE2B600D5B294 /* MGLNSDateAdditionsTests.mm in Sources */,
DA87A9A61DCACC5000810D09 /* MGLCircleStyleLayerTests.mm in Sources */,
DA87A99E1DC9DC2100810D09 /* MGLPredicateTests.mm in Sources */,
DD58A4C91D822C6700E1F038 /* MGLExpressionTests.mm in Sources */,
@@ -1466,6 +1487,10 @@
966091711E5BBFF900A9A03B /* pl */,
966091721E5BBFFA00A9A03B /* uk */,
966091731E5BBFFA00A9A03B /* lt */,
+ DA618B131E68850300CB7F44 /* ru */,
+ DA618B161E6886E000CB7F44 /* ca */,
+ DA618B271E68926E00CB7F44 /* fi */,
+ DAE8CCAB1E6E8B72009B5CB0 /* nl */,
);
name = Localizable.strings;
sourceTree = "<group>";
@@ -1510,6 +1535,10 @@
DA737AE41E5915B000AD2CDE /* pl */,
DA737AEC1E59180E00AD2CDE /* uk */,
DA1AC01E1E5B8826006DF1D6 /* lt */,
+ DA618B141E68852C00CB7F44 /* ru */,
+ DA618B181E6887C600CB7F44 /* ca */,
+ DA618B2A1E6892B500CB7F44 /* fi */,
+ DAE8CCAC1E6E8B8D009B5CB0 /* nl */,
);
name = Localizable.strings;
sourceTree = "<group>";
@@ -1524,6 +1553,8 @@
DAA32CB21E4C4CB7006F8D24 /* ja */,
DAA32CC01E4C4F89006F8D24 /* vi */,
DA6023EF1E4CE8E500DBFF23 /* sv */,
+ DA618B171E68876C00CB7F44 /* ca */,
+ DA618B231E6891ED00CB7F44 /* lt */,
);
name = Foundation.strings;
sourceTree = "<group>";
@@ -1539,6 +1570,9 @@
DA737ADE1E5914AD00AD2CDE /* es */,
DA737AE31E5915A500AD2CDE /* pl */,
DA1AC01F1E5B8904006DF1D6 /* uk */,
+ DAE8CCAA1E6E8605009B5CB0 /* ru */,
+ DA618B151E6886DF00CB7F44 /* ca */,
+ DA618B241E6891F300CB7F44 /* lt */,
);
name = Foundation.stringsdict;
sourceTree = "<group>";
@@ -1559,6 +1593,7 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
@@ -1606,6 +1641,7 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
diff --git a/platform/macos/sdk/ca.lproj/Localizable.strings b/platform/macos/sdk/ca.lproj/Localizable.strings
new file mode 100644
index 0000000000..b679fa0459
--- /dev/null
+++ b/platform/macos/sdk/ca.lproj/Localizable.strings
@@ -0,0 +1,15 @@
+/* Accessibility title */
+"MAP_A11Y_TITLE" = "Mapbox";
+
+/* Label of Zoom In button */
+"ZOOM_IN_LABEL" = "+";
+
+/* Tooltip of Zoom In button */
+"ZOOM_IN_TOOLTIP" = "Apropar";
+
+/* Label of Zoom Out button; U+2212 MINUS SIGN */
+"ZOOM_OUT_LABEL" = "−";
+
+/* Tooltip of Zoom Out button */
+"ZOOM_OUT_TOOLTIP" = "Allunyar";
+
diff --git a/platform/macos/sdk/fi.lproj/Localizable.strings b/platform/macos/sdk/fi.lproj/Localizable.strings
new file mode 100644
index 0000000000..071cc3558b
--- /dev/null
+++ b/platform/macos/sdk/fi.lproj/Localizable.strings
@@ -0,0 +1,15 @@
+/* Accessibility title */
+"MAP_A11Y_TITLE" = "Mapbox";
+
+/* Label of Zoom In button */
+"ZOOM_IN_LABEL" = "+";
+
+/* Tooltip of Zoom In button */
+"ZOOM_IN_TOOLTIP" = "Lähennä";
+
+/* Label of Zoom Out button; U+2212 MINUS SIGN */
+"ZOOM_OUT_LABEL" = "−";
+
+/* Tooltip of Zoom Out button */
+"ZOOM_OUT_TOOLTIP" = "Loitonna";
+
diff --git a/platform/macos/sdk/nl.lproj/Localizable.strings b/platform/macos/sdk/nl.lproj/Localizable.strings
new file mode 100644
index 0000000000..8e7b0ae45f
--- /dev/null
+++ b/platform/macos/sdk/nl.lproj/Localizable.strings
@@ -0,0 +1,15 @@
+/* Accessibility title */
+"MAP_A11Y_TITLE" = "Mapbox";
+
+/* Label of Zoom In button */
+"ZOOM_IN_LABEL" = "+";
+
+/* Tooltip of Zoom In button */
+"ZOOM_IN_TOOLTIP" = "Inzoomen";
+
+/* Label of Zoom Out button; U+2212 MINUS SIGN */
+"ZOOM_OUT_LABEL" = "−";
+
+/* Tooltip of Zoom Out button */
+"ZOOM_OUT_TOOLTIP" = "Uitzoomen";
+
diff --git a/platform/macos/sdk/ru.lproj/Localizable.strings b/platform/macos/sdk/ru.lproj/Localizable.strings
new file mode 100644
index 0000000000..4fa1104cc7
--- /dev/null
+++ b/platform/macos/sdk/ru.lproj/Localizable.strings
@@ -0,0 +1,15 @@
+/* Accessibility title */
+"MAP_A11Y_TITLE" = "Mapbox";
+
+/* Label of Zoom In button */
+"ZOOM_IN_LABEL" = "+";
+
+/* Tooltip of Zoom In button */
+"ZOOM_IN_TOOLTIP" = "Приблизить";
+
+/* Label of Zoom Out button; U+2212 MINUS SIGN */
+"ZOOM_OUT_LABEL" = "−";
+
+/* Tooltip of Zoom Out button */
+"ZOOM_OUT_TOOLTIP" = "Отдалить";
+
diff --git a/platform/macos/src/MGLMapView.h b/platform/macos/src/MGLMapView.h
index fa07821e19..fb715a506d 100644
--- a/platform/macos/src/MGLMapView.h
+++ b/platform/macos/src/MGLMapView.h
@@ -783,24 +783,17 @@ MGL_EXPORT IB_DESIGNABLE
@return An array of objects conforming to the `MGLFeature` protocol that
represent features in the sources used by the current style.
*/
-- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesAtPoint:(NSPoint)point NS_SWIFT_NAME(visibleFeatures(_:));
+- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesAtPoint:(NSPoint)point NS_SWIFT_NAME(visibleFeatures(at:));
/**
Returns an array of rendered map features that intersect with a given point,
restricted to the given style layers.
- This method may return all features from the specified layers. To filter
- the returned features, use the
- `-visibleFeaturesAtPoint:inStyleLayersWithIdentifiers:predicate:` method. For more
- information about searching for map features, see that method’s documentation.
-
- @note Layer identifiers are not guaranteed to exist across styles or different
- versions of the same style. Applications that use this API must first set the
- style URL to an explicitly versioned style using a convenience method like
- `+[MGLStyle outdoorsStyleURLWithVersion:]`, `MGLMapView`’s “Style URL”
- inspectable in Interface Builder, or a manually constructed `NSURL`. This
- approach also avoids layer identifer name changes that will occur in the default
- style’s layers over time.
+ This method returns all the intersecting features from the specified layers. To
+ filter the returned features, use the
+ `-visibleFeaturesAtPoint:inStyleLayersWithIdentifiers:predicate:` method. For
+ more information about searching for map features, see that method’s
+ documentation.
@param point A point expressed in the map view’s coordinate system.
@param styleLayerIdentifiers A set of strings that correspond to the names of
@@ -813,17 +806,17 @@ MGL_EXPORT IB_DESIGNABLE
/**
Returns an array of rendered map features that intersect with a given point,
- restricted to the given style layers and filtered by the given
- predicate.
+ restricted to the given style layers and filtered by the given predicate.
Each object in the returned array represents a feature rendered by the
- current style and provides access to attributes specified by the relevant
- <a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources">tile sources</a>.
- The returned array includes features specified in vector and GeoJSON tile
- sources but does not include anything from raster, image, or video sources.
-
- Only visible features are returned. For example, suppose the current style uses
- the
+ current style and provides access to attributes specified by the relevant map
+ content sources. The returned array includes features loaded by
+ `MGLShapeSource` and `MGLVectorSource` objects but does not include anything
+ from `MGLRasterSource` objects, or from image, video, or canvas sources, which
+ are unsupported by this SDK.
+
+ The returned features are drawn by a style layer in the current style. For
+ example, suppose the current style uses the
<a href="https://www.mapbox.com/vector-tiles/mapbox-streets/">Mapbox Streets source</a>,
but none of the specified style layers includes features that have the `maki`
property set to `bus`. If you pass a point corresponding to the location of a
@@ -849,22 +842,27 @@ MGL_EXPORT IB_DESIGNABLE
To find out the layer names in a particular style, view the style in
<a href="https://www.mapbox.com/studio/">Mapbox Studio</a>.
+
+ Only visible features are returned. To obtain features regardless of
+ visibility, use the
+ `-[MGLVectorSource featuresInSourceLayersWithIdentifiers:predicate:]` and
+ `-[MGLShapeSource featuresMatchingPredicate:]` methods on the relevant sources.
@note Layer identifiers are not guaranteed to exist across styles or different
- versions of the same style. Applications that use this API must first set the
- style URL to an explicitly versioned style using a convenience method like
- `+[MGLStyle outdoorsStyleURLWithVersion:]`, `MGLMapView`’s “Style URL”
- inspectable in Interface Builder, or a manually constructed `NSURL`. This
- approach also avoids layer identifer name changes that will occur in the default
- style’s layers over time.
+ versions of the same style. Applications that use this API must first set
+ the style URL to an explicitly versioned style using a convenience method
+ like `+[MGLStyle outdoorsStyleURLWithVersion:]`, `MGLMapView`’s “Style URL”
+ inspectable in Interface Builder, or a manually constructed `NSURL`. This
+ approach also avoids layer identifer name changes that will occur in the
+ default style’s layers over time.
@param point A point expressed in the map view’s coordinate system.
@param styleLayerIdentifiers A set of strings that correspond to the names of
- layers defined in the current style. Only the features contained in these
- layers are included in the returned array.
+ layers defined in the current style. Only the features contained in these
+ layers are included in the returned array.
@param predicate A predicate to filter the returned features.
@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 sources used by the current style.
*/
- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesAtPoint:(NSPoint)point inStyleLayersWithIdentifiers:(nullable NS_SET_OF(NSString *) *)styleLayerIdentifiers predicate:(nullable NSPredicate *)predicate NS_SWIFT_NAME(visibleFeatures(at:styleLayerIdentifiers:predicate:));
@@ -881,14 +879,14 @@ MGL_EXPORT IB_DESIGNABLE
@return An array of objects conforming to the `MGLFeature` protocol that
represent features in the sources used by the current style.
*/
-- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesInRect:(NSRect)rect NS_SWIFT_NAME(visibleFeatures(_:));
+- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesInRect:(NSRect)rect NS_SWIFT_NAME(visibleFeatures(in:));
/**
Returns an array of rendered map features that intersect with the given
rectangle, restricted to the given style layers.
- This method may return all features from the specified layers. To filter
- the returned features, use the
+ This method returns all the intersecting features from the specified layers. To
+ filter the returned features, use the
`-visibleFeaturesAtPoint:inStyleLayersWithIdentifiers:predicate:` method. For
more information about searching for map features, see that method’s
documentation.
@@ -906,16 +904,16 @@ MGL_EXPORT IB_DESIGNABLE
Returns an array of rendered map features that intersect with the given
rectangle, restricted to the given style layers and filtered by the given
predicate.
-
Each object in the returned array represents a feature rendered by the
- current style and provides access to attributes specified by the relevant
- <a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources">tile sources</a>.
- The returned array includes features specified in vector and GeoJSON tile
- sources but does not include anything from raster, image, or video sources.
-
- Only visible features are returned. For example, suppose the current style uses
- the
+ current style and provides access to attributes specified by the relevant map
+ content sources. The returned array includes features loaded by
+ `MGLShapeSource` and `MGLVectorSource` objects but does not include anything
+ from `MGLRasterSource` objects, or from image, video, or canvas sources, which
+ are unsupported by this SDK.
+
+ The returned features are drawn by a style layer in the current style. For
+ example, suppose the current style uses the
<a href="https://www.mapbox.com/vector-tiles/mapbox-streets/">Mapbox Streets source</a>,
but none of the specified style layers includes features that have the `maki`
property set to `bus`. If you pass a rectangle containing the location of a bus
@@ -942,22 +940,27 @@ MGL_EXPORT IB_DESIGNABLE
To find out the layer names in a particular style, view the style in
<a href="https://www.mapbox.com/studio/">Mapbox Studio</a>.
+
+ Only visible features are returned. To obtain features regardless of
+ visibility, use the
+ `-[MGLVectorSource featuresInSourceLayersWithIdentifiers:predicate:]` and
+ `-[MGLShapeSource featuresMatchingPredicate:]` methods on the relevant sources.
@note Layer identifiers are not guaranteed to exist across styles or different
- versions of the same style. Applications that use this API must first set the
- style URL to an explicitly versioned style using a convenience method like
- `+[MGLStyle outdoorsStyleURLWithVersion:]`, `MGLMapView`’s “Style URL”
- inspectable in Interface Builder, or a manually constructed `NSURL`. This
- approach also avoids layer identifer name changes that will occur in the default
- style’s layers over time.
+ versions of the same style. Applications that use this API must first set
+ the style URL to an explicitly versioned style using a convenience method
+ like `+[MGLStyle outdoorsStyleURLWithVersion:]`, `MGLMapView`’s “Style URL”
+ inspectable in Interface Builder, or a manually constructed `NSURL`. This
+ approach also avoids layer identifer name changes that will occur in the
+ default style’s layers over time.
@param rect A rectangle expressed in the map view’s coordinate system.
@param styleLayerIdentifiers A set of strings that correspond to the names of
- layers defined in the current style. Only the features contained in these
- layers are included in the returned array.
+ layers defined in the current style. Only the features contained in these
+ layers are included in the returned array.
@param predicate A predicate to filter the returned features.
@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 sources used by the current style.
*/
- (NS_ARRAY_OF(id <MGLFeature>) *)visibleFeaturesInRect:(NSRect)rect inStyleLayersWithIdentifiers:(nullable NS_SET_OF(NSString *) *)styleLayerIdentifiers predicate:(nullable NSPredicate *)predicate NS_SWIFT_NAME(visibleFeatures(in:styleLayerIdentifiers:predicate:));
diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm
index 3c3a27e29f..028d41ceda 100644
--- a/platform/macos/src/MGLMapView.mm
+++ b/platform/macos/src/MGLMapView.mm
@@ -541,9 +541,7 @@ public:
const mbgl::Point<double> point = MGLPointFromLocationCoordinate2D(annotation.coordinate);
MGLAnnotationImage *annotationImage = [self imageOfAnnotationWithTag:annotationTag];
_mbglMap->updateAnnotation(annotationTag, mbgl::SymbolAnnotation { point, annotationImage.styleIconIdentifier.UTF8String ?: "" });
- if (annotationTag == _selectedAnnotationTag) {
- [self deselectAnnotation:annotation];
- }
+ [self updateAnnotationCallouts];
}
} else if ([keyPath isEqualToString:@"coordinates"] &&
[object isKindOfClass:[MGLMultiPoint class]]) {
@@ -557,12 +555,7 @@ public:
// but safely updated.
if (annotation == [self annotationWithTag:annotationTag]) {
_mbglMap->updateAnnotation(annotationTag, [annotation annotationObjectWithDelegate:self]);
- // We don't current support shape multipoint annotation selection, but let's make sure
- // deselection is handled just to avoid problems in the future.
- if (annotationTag == _selectedAnnotationTag)
- {
- [self deselectAnnotation:annotation];
- }
+ [self updateAnnotationCallouts];
}
}
}
@@ -1000,7 +993,7 @@ public:
[self willChangeValueForKey:@"centerCoordinate"];
_mbglMap->setLatLng(MGLLatLngFromLocationCoordinate2D(centerCoordinate),
MGLEdgeInsetsFromNSEdgeInsets(self.contentInsets),
- MGLDurationInSecondsFromTimeInterval(animated ? MGLAnimationDuration : 0));
+ MGLDurationFromTimeInterval(animated ? MGLAnimationDuration : 0));
[self didChangeValueForKey:@"centerCoordinate"];
}
@@ -1009,7 +1002,7 @@ public:
_mbglMap->cancelTransitions();
MGLMapCamera *oldCamera = self.camera;
_mbglMap->moveBy({ delta.x, delta.y },
- MGLDurationInSecondsFromTimeInterval(animated ? MGLAnimationDuration : 0));
+ MGLDurationFromTimeInterval(animated ? MGLAnimationDuration : 0));
if ([self.delegate respondsToSelector:@selector(mapView:shouldChangeFromCamera:toCamera:)]
&& ![self.delegate mapView:self shouldChangeFromCamera:oldCamera toCamera:self.camera]) {
self.camera = oldCamera;
@@ -1049,7 +1042,7 @@ public:
[self willChangeValueForKey:@"zoomLevel"];
_mbglMap->setZoom(zoomLevel,
MGLEdgeInsetsFromNSEdgeInsets(self.contentInsets),
- MGLDurationInSecondsFromTimeInterval(animated ? MGLAnimationDuration : 0));
+ MGLDurationFromTimeInterval(animated ? MGLAnimationDuration : 0));
[self didChangeValueForKey:@"zoomLevel"];
}
@@ -1063,7 +1056,7 @@ public:
double newZoom = round(self.zoomLevel) + zoomDelta;
MGLMapCamera *oldCamera = self.camera;
mbgl::ScreenCoordinate center(point.x, self.bounds.size.height - point.y);
- _mbglMap->setZoom(newZoom, center, MGLDurationInSecondsFromTimeInterval(animated ? MGLAnimationDuration : 0));
+ _mbglMap->setZoom(newZoom, center, MGLDurationFromTimeInterval(animated ? MGLAnimationDuration : 0));
if ([self.delegate respondsToSelector:@selector(mapView:shouldChangeFromCamera:toCamera:)]
&& ![self.delegate mapView:self shouldChangeFromCamera:oldCamera toCamera:self.camera]) {
self.camera = oldCamera;
@@ -1077,7 +1070,7 @@ public:
[self willChangeValueForKey:@"zoomLevel"];
MGLMapCamera *oldCamera = self.camera;
mbgl::ScreenCoordinate center(point.x, self.bounds.size.height - point.y);
- _mbglMap->scaleBy(scaleFactor, center, MGLDurationInSecondsFromTimeInterval(animated ? MGLAnimationDuration : 0));
+ _mbglMap->scaleBy(scaleFactor, center, MGLDurationFromTimeInterval(animated ? MGLAnimationDuration : 0));
if ([self.delegate respondsToSelector:@selector(mapView:shouldChangeFromCamera:toCamera:)]
&& ![self.delegate mapView:self shouldChangeFromCamera:oldCamera toCamera:self.camera]) {
self.camera = oldCamera;
@@ -1138,7 +1131,7 @@ public:
[self willChangeValueForKey:@"direction"];
_mbglMap->setBearing(direction,
MGLEdgeInsetsFromNSEdgeInsets(self.contentInsets),
- MGLDurationInSecondsFromTimeInterval(animated ? MGLAnimationDuration : 0));
+ MGLDurationFromTimeInterval(animated ? MGLAnimationDuration : 0));
[self didChangeValueForKey:@"direction"];
}
@@ -1166,7 +1159,7 @@ public:
- (void)setCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration animationTimingFunction:(nullable CAMediaTimingFunction *)function completionHandler:(nullable void (^)(void))completion {
mbgl::AnimationOptions animationOptions;
if (duration > 0) {
- animationOptions.duration.emplace(MGLDurationInSecondsFromTimeInterval(duration));
+ animationOptions.duration.emplace(MGLDurationFromTimeInterval(duration));
animationOptions.easing.emplace(MGLUnitBezierForMediaTimingFunction(function));
}
if (completion) {
@@ -1207,7 +1200,7 @@ public:
- (void)flyToCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration peakAltitude:(CLLocationDistance)peakAltitude completionHandler:(nullable void (^)(void))completion {
mbgl::AnimationOptions animationOptions;
if (duration >= 0) {
- animationOptions.duration = MGLDurationInSecondsFromTimeInterval(duration);
+ animationOptions.duration = MGLDurationFromTimeInterval(duration);
}
if (peakAltitude >= 0) {
CLLocationDegrees peakLatitude = (self.centerCoordinate.latitude + camera.centerCoordinate.latitude) / 2;
@@ -1284,7 +1277,7 @@ public:
mbgl::CameraOptions cameraOptions = _mbglMap->cameraForLatLngBounds(MGLLatLngBoundsFromCoordinateBounds(bounds), padding);
mbgl::AnimationOptions animationOptions;
if (animated) {
- animationOptions.duration = MGLDurationInSecondsFromTimeInterval(MGLAnimationDuration);
+ animationOptions.duration = MGLDurationFromTimeInterval(MGLAnimationDuration);
}
MGLMapCamera *camera = [self cameraForCameraOptions:cameraOptions];
@@ -1846,7 +1839,7 @@ public:
return annotationContext.annotation;
}
-/// Returns the annotation tag assigned to the given annotation. Relatively expensive.
+/// Returns the annotation tag assigned to the given annotation.
- (MGLAnnotationTag)annotationTagForAnnotation:(id <MGLAnnotation>)annotation {
if (!annotation || _annotationTagsByAnnotation.count(annotation) == 0) {
return MGLAnnotationTagNotFound;
@@ -1874,8 +1867,7 @@ public:
NSAssert([annotation conformsToProtocol:@protocol(MGLAnnotation)], @"Annotation does not conform to MGLAnnotation");
// adding the same annotation object twice is a no-op
- if ([self.annotations containsObject:annotation])
- {
+ if (_annotationTagsByAnnotation.count(annotation) != 0) {
continue;
}
@@ -2446,9 +2438,11 @@ public:
- (void)addOverlays:(NS_ARRAY_OF(id <MGLOverlay>) *)overlays
{
+#if DEBUG
for (id <MGLOverlay> overlay in overlays) {
NSAssert([overlay conformsToProtocol:@protocol(MGLOverlay)], @"Overlay does not conform to MGLOverlay");
}
+#endif
[self addAnnotations:overlays];
}
@@ -2457,9 +2451,11 @@ public:
}
- (void)removeOverlays:(NS_ARRAY_OF(id <MGLOverlay>) *)overlays {
+#if DEBUG
for (id <MGLOverlay> overlay in overlays) {
NSAssert([overlay conformsToProtocol:@protocol(MGLOverlay)], @"Overlay does not conform to MGLOverlay");
}
+#endif
[self removeAnnotations:overlays];
}
diff --git a/platform/macos/src/MGLMapViewDelegate.h b/platform/macos/src/MGLMapViewDelegate.h
index 08a9f7eff4..dae5b40286 100644
--- a/platform/macos/src/MGLMapViewDelegate.h
+++ b/platform/macos/src/MGLMapViewDelegate.h
@@ -40,10 +40,12 @@ NS_ASSUME_NONNULL_BEGIN
This method is called as the currently displayed map camera changes as part of
an animation, whether due to a user gesture or due to a call to a method such
- as `-[MGLMapView setCamera:animated:]`. During the animation, this method may
- be called many times to report updates to the viewpoint. Therefore, your
- implementation of this method should be as lightweight as possible to avoid
- affecting performance.
+ as `-[MGLMapView setCamera:animated:]`. This method can be called before
+ `-mapViewDidFinishLoadingMap:` is called.
+
+ During the animation, this method may be called many times to report updates
+ to the viewpoint. Therefore, your implementation of this method should be as
+ lightweight as possible to avoid affecting performance.
@param mapView The map view whose viewpoint is changing.
*/
@@ -55,7 +57,9 @@ NS_ASSUME_NONNULL_BEGIN
This method is called whenever the currently displayed map camera has finished
changing, after any calls to `-mapViewRegionIsChanging:` due to animation.
-
+ This method can be called before `-mapViewDidFinishLoadingMap:` is
+ called.
+
@param mapView The map view whose viewpoint has changed.
@param animated Whether the change caused an animated effect on the map.
*/