summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-03-21 11:55:02 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-03-21 12:04:20 -0700
commite488ca702e8f822ba6297a2f3c933ee22ca6ce42 (patch)
tree2efe93d84722f37a61b83155510a3da444fc171b /platform
parent1f8910de186f35216791a17a683a55f01031ec81 (diff)
parente0fe42d8321d19a4a9cb46edac9fbdb035e70a0c (diff)
downloadqtlocation-mapboxgl-e488ca702e8f822ba6297a2f3c933ee22ca6ce42.tar.gz
Merge branch 'release-ios-v3.5.0-android-v5.0.0'
Diffstat (limited to 'platform')
-rw-r--r--platform/android/CHANGELOG.md77
-rw-r--r--platform/android/MapboxGLAndroidSDK/build.gradle2
-rw-r--r--platform/android/MapboxGLAndroidSDK/gradle.properties2
-rw-r--r--platform/android/MapboxGLAndroidSDK/proguard-rules.pro8
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/AndroidManifest.xml5
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java5
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Annotation.java22
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BasePointCollection.java (renamed from platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MultiPoint.java)6
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BubbleLayout.java2
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewContainer.java34
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewManager.java49
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Polygon.java2
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Polyline.java2
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/ConversionException.java13
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/InvalidMarkerPositionException.java3
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java2
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationSource.java1
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationManager.java17
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/IconManager.java21
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java52
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapKeyListener.java13
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java70
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapZoomButtonController.java31
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java205
-rwxr-xr-xplatform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java13
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TrackingSettings.java2
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java23
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java12
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/storage/package-info.java4
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonOptions.java3
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java2
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/RasterSource.java2
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/TileSet.java2
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java2
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_mapview_internal.xml2
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/resources/fabric/com.mapbox.mapboxsdk.mapbox-android-sdk.properties2
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml5
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java7
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/MaxMinZoomActivity.java18
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java21
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_debug_mode.xml13
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/strings.xml1
-rw-r--r--platform/android/bitrise.yml3
-rw-r--r--platform/android/dependencies.gradle6
-rwxr-xr-xplatform/android/src/native_map_view.cpp4
-rwxr-xr-xplatform/android/src/native_map_view.hpp2
-rw-r--r--platform/darwin/docs/guides/Data-Driven Styling.md.ejs160
-rw-r--r--platform/darwin/docs/guides/For Style Authors.md.ejs31
-rw-r--r--platform/darwin/resources/ca.lproj/Foundation.strings291
-rw-r--r--platform/darwin/resources/ca.lproj/Foundation.stringsdict54
-rw-r--r--platform/darwin/resources/lt.lproj/Foundation.strings291
-rw-r--r--platform/darwin/resources/lt.lproj/Foundation.stringsdict66
-rw-r--r--platform/darwin/resources/pl.lproj/Foundation.stringsdict6
-rw-r--r--platform/darwin/resources/ru.lproj/Foundation.stringsdict6
-rw-r--r--platform/darwin/resources/uk.lproj/Foundation.stringsdict12
-rw-r--r--platform/darwin/scripts/generate-style-code.js11
-rw-r--r--platform/darwin/src/MGLAttributionInfo_Private.h1
-rw-r--r--platform/darwin/src/MGLBackgroundStyleLayer.h31
-rw-r--r--platform/darwin/src/MGLBackgroundStyleLayer.mm54
-rw-r--r--platform/darwin/src/MGLCircleStyleLayer.h84
-rw-r--r--platform/darwin/src/MGLCircleStyleLayer.mm146
-rw-r--r--platform/darwin/src/MGLFeature.h6
-rw-r--r--platform/darwin/src/MGLFillStyleLayer.h57
-rw-r--r--platform/darwin/src/MGLFillStyleLayer.mm92
-rw-r--r--platform/darwin/src/MGLLineStyleLayer.h97
-rw-r--r--platform/darwin/src/MGLLineStyleLayer.mm162
-rw-r--r--platform/darwin/src/MGLOfflineStorage.mm9
-rw-r--r--platform/darwin/src/MGLPolyline.mm4
-rw-r--r--platform/darwin/src/MGLRasterStyleLayer.h65
-rw-r--r--platform/darwin/src/MGLRasterStyleLayer.mm126
-rw-r--r--platform/darwin/src/MGLShapeSource.h26
-rw-r--r--platform/darwin/src/MGLStyle.h22
-rw-r--r--platform/darwin/src/MGLStyle.mm32
-rw-r--r--platform/darwin/src/MGLStyleLayer.h3
-rw-r--r--platform/darwin/src/MGLStyleLayer.h.ejs11
-rw-r--r--platform/darwin/src/MGLStyleLayer.mm.ejs24
-rw-r--r--platform/darwin/src/MGLStyleValue.h60
-rw-r--r--platform/darwin/src/MGLStyleValue.mm6
-rw-r--r--platform/darwin/src/MGLStyleValue_Private.h48
-rw-r--r--platform/darwin/src/MGLSymbolStyleLayer.h203
-rw-r--r--platform/darwin/src/MGLSymbolStyleLayer.mm218
-rw-r--r--platform/darwin/src/MGLTileSource.h4
-rw-r--r--platform/darwin/src/MGLTypes.h48
-rw-r--r--platform/darwin/src/MGLVectorSource.h54
-rw-r--r--platform/darwin/src/NSDate+MGLAdditions.h12
-rw-r--r--platform/darwin/src/NSDate+MGLAdditions.mm10
-rw-r--r--platform/darwin/src/NSString+MGLAdditions.h5
-rw-r--r--platform/darwin/src/NSValue+MGLAdditions.h17
-rw-r--r--platform/darwin/src/NSValue+MGLAdditions.m12
-rw-r--r--platform/darwin/test/MGLBackgroundStyleLayerTests.mm32
-rw-r--r--platform/darwin/test/MGLCircleStyleLayerTests.mm68
-rw-r--r--platform/darwin/test/MGLFillStyleLayerTests.mm41
-rw-r--r--platform/darwin/test/MGLLineStyleLayerTests.mm68
-rw-r--r--platform/darwin/test/MGLNSDateAdditionsTests.mm40
-rw-r--r--platform/darwin/test/MGLRasterStyleLayerTests.mm41
-rw-r--r--platform/darwin/test/MGLStyleLayerTests.mm.ejs16
-rw-r--r--platform/darwin/test/MGLStyleValueTests.swift24
-rw-r--r--platform/darwin/test/MGLSymbolStyleLayerTests.mm95
-rw-r--r--platform/ios/CHANGELOG.md31
-rw-r--r--platform/ios/INSTALL.md12
-rw-r--r--platform/ios/Mapbox-iOS-SDK-symbols.podspec2
-rw-r--r--platform/ios/Mapbox-iOS-SDK.podspec2
-rw-r--r--platform/ios/app/MBXViewController.m34
-rw-r--r--platform/ios/app/ca.lproj/Localizable.strings0
-rw-r--r--platform/ios/app/fi.lproj/Localizable.strings0
-rw-r--r--platform/ios/app/nl.lproj/Localizable.strings0
-rw-r--r--platform/ios/docs/guides/Data-Driven Styling.md154
-rw-r--r--platform/ios/docs/guides/For Style Authors.md127
-rw-r--r--platform/ios/docs/guides/Runtime Styling.md4
-rw-r--r--platform/ios/docs/img/data-driven-styling/categorical1.pngbin0 -> 105968 bytes
-rw-r--r--platform/ios/docs/img/data-driven-styling/categorical2.pngbin0 -> 125698 bytes
-rw-r--r--platform/ios/docs/img/data-driven-styling/citibikes.pngbin0 -> 152843 bytes
-rw-r--r--platform/ios/docs/img/data-driven-styling/exponential-function-1.pngbin0 -> 69991 bytes
-rw-r--r--platform/ios/docs/img/data-driven-styling/exponential-function.pngbin0 -> 70066 bytes
-rw-r--r--platform/ios/docs/img/data-driven-styling/exponential.pngbin0 -> 86910 bytes
-rw-r--r--platform/ios/docs/img/data-driven-styling/identity.pngbin0 -> 68837 bytes
-rw-r--r--platform/ios/docs/img/data-driven-styling/interval.pngbin0 -> 83927 bytes
-rw-r--r--platform/ios/docs/img/data-driven-styling/polylineExample.pngbin0 -> 156800 bytes
-rw-r--r--platform/ios/framework/Settings.bundle/ca.lproj/Root.strings3
-rw-r--r--platform/ios/framework/Settings.bundle/fi.lproj/Root.strings3
-rw-r--r--platform/ios/framework/Settings.bundle/nl.lproj/Root.strings3
-rw-r--r--platform/ios/ios.xcodeproj/project.pbxproj49
-rw-r--r--platform/ios/jazzy.yml1
-rw-r--r--platform/ios/resources/Base.lproj/Localizable.strings4
-rw-r--r--platform/ios/resources/ca.lproj/Localizable.strings75
-rw-r--r--platform/ios/resources/ca.lproj/Localizable.stringsdict23
-rw-r--r--platform/ios/resources/ja.lproj/Localizable.strings3
-rw-r--r--platform/ios/resources/ru.lproj/Localizable.strings8
-rw-r--r--platform/ios/resources/ru.lproj/Localizable.stringsdict27
-rwxr-xr-xplatform/ios/scripts/deploy-packages.sh2
-rw-r--r--platform/ios/src/MGLAnnotationView.mm5
-rw-r--r--platform/ios/src/MGLMapView.h110
-rw-r--r--platform/ios/src/MGLMapView.mm71
-rw-r--r--platform/ios/src/MGLMapViewDelegate.h20
-rw-r--r--platform/ios/src/MGLSDKUpdateChecker.h13
-rw-r--r--platform/ios/src/MGLSDKUpdateChecker.mm39
-rw-r--r--platform/ios/vendor/Fabric/Fabric.h2
-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
155 files changed, 4578 insertions, 743 deletions
diff --git a/platform/android/CHANGELOG.md b/platform/android/CHANGELOG.md
index 1186d392d0..d8338347c2 100644
--- a/platform/android/CHANGELOG.md
+++ b/platform/android/CHANGELOG.md
@@ -2,6 +2,83 @@
Mapbox welcomes participation and contributions from everyone. If you'd like to do so please see the [`Contributing Guide`](https://github.com/mapbox/mapbox-gl-native/blob/master/CONTRIBUTING.md) first to get started.
+## 5.0.0 - March 17th, 2017
+
+5.0.0 final release contains:
+
+* Support for data-driven styles [#7752](https://github.com/mapbox/mapbox-gl-native/pull/7752)
+* Additional APIs to manage runtime styling layers [#8195](https://github.com/mapbox/mapbox-gl-native/pull/8195)
+* Allow query all features in sources (`querySourceFeatures`) [#5792](https://github.com/mapbox/mapbox-gl-native/issues/5792)
+* Improve accessibility TalkBack support by including content description in views [#8230](https://github.com/mapbox/mapbox-gl-native/pull/8230)
+* Consistent double tap zoom acceleration [#7514](https://github.com/mapbox/mapbox-gl-native/issues/7514)
+* Allow zooming/scaling to use `AnimationOptions` [#8181](https://github.com/mapbox/mapbox-gl-native/pull/8181)
+* Cleanup inconsistencies `float` vs `double` [#4445](https://github.com/mapbox/mapbox-gl-native/issues/4445)
+* Add `mapbox_` prefix to attributes [#6482](https://github.com/mapbox/mapbox-gl-native/issues/6482)
+* Update LOST to 2.x [#6573](https://github.com/mapbox/mapbox-gl-native/issues/6537)
+* MAS submodules (`geojson`, `telemetry`) are now smaller to reduce the overall method count [#7642](https://github.com/mapbox/mapbox-gl-native/pull/7642)
+* Telemetry Service is now include automatically via Manifest merge to simplify set up [#8338](https://github.com/mapbox/mapbox-gl-native/pull/8338)
+* Support for Android Nougat [#5910](5910-move-listener-logic-for-nougat)
+ - Move location listening logic to `onStart`/`onStop` activity lifecylce methods
+* Removal of `accessToken` on `MapView` and `MapboxMap` [#5621](https://github.com/mapbox/mapbox-gl-native/issues/5621)
+* Introduction of new make targets [#5940](https://github.com/mapbox/mapbox-gl-native/issues/5940)
+ - Targets for testing, running and using external tools directly from the command line
+* Cleanup Gradle files [#6009](https://github.com/mapbox/mapbox-gl-native/issues/6009)
+ - Introducing single purpose `.gradle` files
+* Checkstyle integration [#7442](https://github.com/mapbox/mapbox-gl-native/pull/7442)
+* Transform refactor [#6532](https://github.com/mapbox/mapbox-gl-native/issues/6532)
+ - All camera related code is moved to a dedicated transform class cfr. core architecture
+* Encapsulate gestures [#6557](https://github.com/mapbox/mapbox-gl-native/issues/6557)
+ - All gesture event code is encapsulated in `MapGestureDetector`
+ - All key event code is encapsulated in `MapKeyListener`
+* Transparent background for `MyLocationView` [#7116](https://github.com/mapbox/mapbox-gl-native/issues/7116)
+* Correctly scale accuracy circle for `MyLocationView` [#8255](https://github.com/mapbox/mapbox-gl-native/pull/8255)
+* Update documentation on generate sanity tests [#7147](https://github.com/mapbox/mapbox-gl-native/issues/7147)
+* Update documentation on style templates [#7157](https://github.com/mapbox/mapbox-gl-native/issues/7157)
+* Fix `NullPointerException` during save instance state [#7157](https://github.com/mapbox/mapbox-gl-native/issues/7157)
+* Move management style to core [#7275](https://github.com/mapbox/mapbox-gl-native/issues/7275)
+* Fix `OnCameraChange` not called for the final position of animation bug [#7350](https://github.com/mapbox/mapbox-gl-native/issues/7350)
+* `MapboxAccountManager` refactor [#6534](https://github.com/mapbox/mapbox-gl-native/issues/6534)
+ - Consolidating the location where tokens are set
+ - Rename to reflect the increased responsibilities introduced in prior releases
+* AnnotationManager refactor [#6067](https://github.com/mapbox/mapbox-gl-native/issues/6067)
+ - Extracting all business logic related to annotations into a separate class cfr. to core and the iOS codebase
+* Gesture handling improvements:
+ - Fix missing call to `onFling` when while pinch zooming [#7666](https://github.com/mapbox/mapbox-gl-native/issues/7666)
+ - Round tap-zoom gestures to nearest integer [#8027](https://github.com/mapbox/mapbox-gl-native/pull/8027)
+* Support for style-wide transition animation duration and delay [#6779](https://github.com/mapbox/mapbox-gl-native/issues/6779)
+* Allow callback parameter for style setting [#8262](https://github.com/mapbox/mapbox-gl-native/issues/8262)
+* Support for all animated camera changes to configure dismissing tracking modes [#7854](https://github.com/mapbox/mapbox-gl-native/issues/7854)
+* Avoid disabling location tracking on all gestures [#7878](https://github.com/mapbox/mapbox-gl-native/issues/7878)
+* `LatLng` objects produced by the SDK are wrapped by default [#4522](https://github.com/mapbox/mapbox-gl-native/issues/4522)
+* Proguard update for new SDK packages [#8437](https://github.com/mapbox/mapbox-gl-native/pull/8437)
+* Javadoc cleanup [#8438](https://github.com/mapbox/mapbox-gl-native/pull/8438)
+* MarkerViewClickListener and MapClickListener called simultaneously [#8447](https://github.com/mapbox/mapbox-gl-native/pull/8447)
+* Fix LOST v2.0.0 integration [#8445](https://github.com/mapbox/mapbox-gl-native/pull/8445)
+* Crash with OnMapChangeListener [#8380](https://github.com/mapbox/mapbox-gl-native/pull/8380)
+* Feature query crash [#8374](https://github.com/mapbox/mapbox-gl-native/pull/8374)
+* flyTo fix [#8302](https://github.com/mapbox/mapbox-gl-native/pull/8302)
+* Don't dispatch MarkerView motion event up to MapView [#8447](https://github.com/mapbox/mapbox-gl-native/pull/8447)
+
+## 5.0.0-beta.3 - March 10th, 2017
+
+5.0.0-beta.3 focuses on addressing stability issues and bug fixes. It also includes:
+
+* Allow query all features in sources (`querySourceFeatures`) [#5792](https://github.com/mapbox/mapbox-gl-native/issues/5792)
+* Improve accessibility TalkBack support by including content description in views [#8230](https://github.com/mapbox/mapbox-gl-native/pull/8230)
+* Allow zooming/scaling to use `AnimationOptions` [#8181](https://github.com/mapbox/mapbox-gl-native/pull/8181)
+* Telemetry Service is now include automatically via Manifest merge to simplify set up [#8338](https://github.com/mapbox/mapbox-gl-native/pull/8338)
+* Correctly scale accuracy circle for `MyLocationView` [#8255](https://github.com/mapbox/mapbox-gl-native/pull/8255)
+* Round tap-zoom gestures to nearest integer [#8027](https://github.com/mapbox/mapbox-gl-native/pull/8027)
+* Allow callback parameter for style setting [#8262](https://github.com/mapbox/mapbox-gl-native/issues/8262)
+* Avoid disabling location tracking on all gestures [#7878](https://github.com/mapbox/mapbox-gl-native/issues/7878)
+
+## 5.0.0-beta.2 - March 1st, 2017
+
+5.0.0-beta.2 focuses on addressing stability issues and bug fixes. It also includes:
+
+* Data-driven styling for `{text,icon}-{color,opacity,halo-color,halo-blur,halo-width}` [#7939](https://github.com/mapbox/mapbox-gl-native/pull/7939)
+* Additional APIs to manage runtime styling layers [#8195](https://github.com/mapbox/mapbox-gl-native/pull/8195)
+
## 5.0.0-beta.1 - February 14th, 2017
* Support for data-driven styles [#7752](https://github.com/mapbox/mapbox-gl-native/pull/7752)
diff --git a/platform/android/MapboxGLAndroidSDK/build.gradle b/platform/android/MapboxGLAndroidSDK/build.gradle
index dd25a8d7b4..f2d28e53d1 100644
--- a/platform/android/MapboxGLAndroidSDK/build.gradle
+++ b/platform/android/MapboxGLAndroidSDK/build.gradle
@@ -27,6 +27,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
buildConfigField "String", "GIT_REVISION_SHORT", String.format("\"%s\"", getGitRevision())
+ buildConfigField "String", "MAPBOX_VERSION_STRING", String.format("\"Mapbox/%s\"", project.VERSION_NAME)
+ buildConfigField "String", "MAPBOX_EVENTS_USER_AGENT", String.format("\"MapboxEventsAndroid/%s\"", project.VERSION_NAME)
}
defaultPublishConfig project.hasProperty("mapbox.buildtype") ? project.getProperty("mapbox.buildtype") : "debug"
diff --git a/platform/android/MapboxGLAndroidSDK/gradle.properties b/platform/android/MapboxGLAndroidSDK/gradle.properties
index 13a5f1032a..9f555da5f8 100644
--- a/platform/android/MapboxGLAndroidSDK/gradle.properties
+++ b/platform/android/MapboxGLAndroidSDK/gradle.properties
@@ -1,5 +1,5 @@
GROUP=com.mapbox.mapboxsdk
-VERSION_NAME=5.0.0-SNAPSHOT
+VERSION_NAME=5.1.0-SNAPSHOT
POM_DESCRIPTION=Mapbox GL Android SDK
POM_URL=https://github.com/mapbox/mapbox-gl-native
diff --git a/platform/android/MapboxGLAndroidSDK/proguard-rules.pro b/platform/android/MapboxGLAndroidSDK/proguard-rules.pro
index 92ef05df68..baecd80e50 100644
--- a/platform/android/MapboxGLAndroidSDK/proguard-rules.pro
+++ b/platform/android/MapboxGLAndroidSDK/proguard-rules.pro
@@ -17,10 +17,10 @@
# Package camera
-keep class com.mapbox.mapboxsdk.camera.** { *; }
-# Package: geometry
+# Package geometry
-keep class com.mapbox.mapboxsdk.geometry.** { *; }
-# Package: http
+# Package http
-keep class com.mapbox.mapboxsdk.http.** { *; }
# Package maps
@@ -32,9 +32,13 @@
# Package offline
-keep class com.mapbox.mapboxsdk.offline.** { *; }
+# Package storage
+-keep class com.mapbox.mapboxsdk.storage.** { *; }
+
# Package style
-keep class com.mapbox.mapboxsdk.style.layers.** { *; }
-keep class com.mapbox.mapboxsdk.style.sources.** { *; }
+-keep class com.mapbox.mapboxsdk.style.functions.** { *; }
# Package telemetry
-keep class com.mapbox.mapboxsdk.telemetry.** { *; }
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/AndroidManifest.xml b/platform/android/MapboxGLAndroidSDK/src/main/AndroidManifest.xml
index c848e61e6c..231e36e092 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/AndroidManifest.xml
+++ b/platform/android/MapboxGLAndroidSDK/src/main/AndroidManifest.xml
@@ -8,4 +8,9 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
+ <application>
+ <!-- Include the telemetry service to simplify set up (https://www.mapbox.com/telemetry) -->
+ <service android:name="com.mapbox.services.android.telemetry.service.TelemetryService"/>
+ </application>
+
</manifest>
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java
index 296d93d0ca..83d04e7023 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java
@@ -37,7 +37,8 @@ public final class Mapbox {
INSTANCE = new Mapbox(appContext, accessToken);
LocationEngine locationEngine = new LocationSource(appContext);
locationEngine.setPriority(LocationEnginePriority.NO_POWER);
- MapboxTelemetry.getInstance().initialize(appContext, accessToken, locationEngine);
+ MapboxTelemetry.getInstance().initialize(
+ appContext, accessToken, BuildConfig.MAPBOX_EVENTS_USER_AGENT, locationEngine);
ConnectivityReceiver.instance(appContext);
}
return INSTANCE;
@@ -106,4 +107,4 @@ public final class Mapbox {
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
return (activeNetwork != null && activeNetwork.isConnected());
}
-}
+} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Annotation.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Annotation.java
index 831c1db5a3..a588ff6d23 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Annotation.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Annotation.java
@@ -6,10 +6,12 @@ import com.mapbox.mapboxsdk.maps.MapView;
import com.mapbox.mapboxsdk.maps.MapboxMap;
/**
- * Annotation is an overlay on top of a {@link MapView},
- * from which {@link Polygon}, {@link Polyline} and {@link Marker} are derived.
+ * Annotation is an overlay on top of a Map.
* <p>
- * it manages attachment to a map and identification, but does not require
+ * Known subclasses are {@link Polygon}, {@link Polyline} and {@link Marker}.
+ * </p>
+ * <p>
+ * This class manages attachment to a map and identification, but does not require
* content to be placed at a geographical point.
* </p>
*/
@@ -96,6 +98,12 @@ public abstract class Annotation implements Comparable<Annotation> {
return mapView;
}
+ /**
+ * Compares this Annotation object with another Annotation.
+ *
+ * @param annotation Another Annotation to compare with this object.
+ * @return returns 0 if id's match, 1 if id is lower, -1 if id is higher of another Annotation
+ */
@Override
public int compareTo(@NonNull Annotation annotation) {
if (id < annotation.getId()) {
@@ -107,12 +115,10 @@ public abstract class Annotation implements Comparable<Annotation> {
}
/**
- * Compares this {@link PolylineOptions} object with another {@link PolylineOptions} and
- * determines if their color, alpha, width, and vertices match.
+ * Checks if this Annotation object is equal to another Annotation.
*
- * @param object Another {@link PolylineOptions} to compare with this object.
- * @return True if color, alpha, width, and vertices match this {@link PolylineOptions} object.
- * Else, false.
+ * @param object Another Annotation to check equality with this object.
+ * @return returns true both id's match else returns false.
*/
@Override
public boolean equals(Object object) {
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MultiPoint.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BasePointCollection.java
index 2bd3c82786..e57821b541 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MultiPoint.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BasePointCollection.java
@@ -8,12 +8,12 @@ import java.util.List;
/**
* Multipoint is an abstract annotation for combining geographical locations.
*/
-public abstract class MultiPoint extends Annotation {
+public abstract class BasePointCollection extends Annotation {
private List<LatLng> points;
private float alpha = 1.0f;
- protected MultiPoint() {
+ protected BasePointCollection() {
super();
points = new ArrayList<>();
}
@@ -58,7 +58,7 @@ public abstract class MultiPoint extends Annotation {
}
/**
- * Set this {@link MultiPoint}s alpha.
+ * Set this {@link BasePointCollection}s alpha.
*
* @param alpha float value between 0 and 1.
*/
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BubbleLayout.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BubbleLayout.java
index 2e6445170f..07e038c08c 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BubbleLayout.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/BubbleLayout.java
@@ -14,7 +14,7 @@ import com.mapbox.mapboxsdk.R;
/**
* Bubble View for Android with custom stroke width and color, arrow size, position and direction.
*/
-class BubbleLayout extends LinearLayout {
+public class BubbleLayout extends LinearLayout {
public static final float DEFAULT_STROKE_WIDTH = -1;
private ArrowDirection arrowDirection;
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewContainer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewContainer.java
new file mode 100644
index 0000000000..d590582f09
--- /dev/null
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewContainer.java
@@ -0,0 +1,34 @@
+package com.mapbox.mapboxsdk.annotations;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+import android.view.ViewGroup;
+import android.widget.FrameLayout;
+
+/**
+ * ViewGroup that dispatches TouchEvents to the parent ViewGroup.
+ * <p>
+ * This allows to dispatch touch events that occur on MarkerView to MapView.
+ * https://github.com/mapbox/mapbox-gl-native/issues/5388
+ * </p>
+ */
+public class MarkerViewContainer extends FrameLayout {
+
+ public MarkerViewContainer(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ setTag(false);
+ }
+
+ @Override
+ public boolean dispatchTouchEvent(MotionEvent ev) {
+ super.dispatchTouchEvent(ev);
+ boolean actionUp = (boolean) getTag();
+ if (!actionUp) {
+ ((ViewGroup) getParent()).onTouchEvent(ev);
+ } else {
+ setTag(false);
+ }
+ return true;
+ }
+}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewManager.java
index 315e12d280..0f1298eeaf 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewManager.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewManager.java
@@ -8,6 +8,7 @@ import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.util.LongSparseArray;
import android.view.LayoutInflater;
+import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
@@ -503,6 +504,26 @@ public class MarkerViewManager implements MapView.OnMapChangedListener {
}
}
+ adaptedView.setOnTouchListener(new View.OnTouchListener() {
+
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ if (event.getAction() == MotionEvent.ACTION_UP) {
+ boolean clickHandled = false;
+ if (onMarkerViewClickListener != null) {
+ clickHandled = onMarkerViewClickListener.onMarkerClick(marker, v, adapter);
+ markerViewContainer.setTag(true);
+ }
+
+ if (!clickHandled) {
+ ensureInfoWindowOffset(marker);
+ select(marker, v, adapter);
+ }
+ }
+ return true;
+ }
+ });
+
marker.setMapboxMap(mapboxMap);
markerViewMap.put(marker, adaptedView);
if (convertView == null) {
@@ -531,34 +552,6 @@ public class MarkerViewManager implements MapView.OnMapChangedListener {
}
/**
- * When the provided {@link MarkerView} is clicked on by a user, we check if a custom click
- * event has been created and if not, display a {@link InfoWindow}.
- *
- * @param markerView that the click event occurred.
- */
- public boolean onClickMarkerView(MarkerView markerView) {
- boolean clickHandled = false;
-
- MapboxMap.MarkerViewAdapter adapter = getViewAdapter(markerView);
- View view = getView(markerView);
- if (adapter == null || view == null) {
- // not a valid state
- return true;
- }
-
- if (onMarkerViewClickListener != null) {
- clickHandled = onMarkerViewClickListener.onMarkerClick(markerView, view, adapter);
- }
-
- if (!clickHandled) {
- ensureInfoWindowOffset(markerView);
- select(markerView, view, adapter);
- }
-
- return clickHandled;
- }
-
- /**
* Handles the {@link MarkerView}'s info window offset.
*
* @param marker that we are ensuring info window offset.
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Polygon.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Polygon.java
index 7b9de86bc4..4a72cb7d89 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Polygon.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Polygon.java
@@ -7,7 +7,7 @@ import com.mapbox.mapboxsdk.maps.MapboxMap;
/**
* Polygon is a geometry annotation that's a closed loop of coordinates.
*/
-public final class Polygon extends MultiPoint {
+public final class Polygon extends BasePointCollection {
private int fillColor = Color.BLACK; // default fillColor is black
private int strokeColor = Color.BLACK; // default strokeColor is black
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Polyline.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Polyline.java
index a430d11009..6cea29ef81 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Polyline.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/Polyline.java
@@ -7,7 +7,7 @@ import com.mapbox.mapboxsdk.maps.MapboxMap;
/**
* Polyline is a geometry feature with an unclosed list of coordinates drawn as a line
*/
-public final class Polyline extends MultiPoint {
+public final class Polyline extends BasePointCollection {
private int color = Color.BLACK; // default color is black
private float width = 10; // As specified by Google API Docs (in pixels)
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/ConversionException.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/ConversionException.java
index be2b586683..0d16c53b86 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/ConversionException.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/ConversionException.java
@@ -1,22 +1,11 @@
package com.mapbox.mapboxsdk.exceptions;
/**
- * Thrown on conversion errors
+ * A ConversionException is thrown when a conversion failed to execute.
*/
public class ConversionException extends RuntimeException {
- public ConversionException() {
- }
-
public ConversionException(String detailMessage) {
super(detailMessage);
}
-
- public ConversionException(String detailMessage, Throwable throwable) {
- super(detailMessage, throwable);
- }
-
- public ConversionException(Throwable throwable) {
- super(throwable);
- }
}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/InvalidMarkerPositionException.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/InvalidMarkerPositionException.java
index bd24379af3..f0f9b9236b 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/InvalidMarkerPositionException.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/exceptions/InvalidMarkerPositionException.java
@@ -1,5 +1,8 @@
package com.mapbox.mapboxsdk.exceptions;
+/**
+ * A InvalidMarkerPositionException is thrown when a Marker object is created with an invalid LatLng position.
+ */
public class InvalidMarkerPositionException extends RuntimeException {
public InvalidMarkerPositionException() {
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java
index cedc5fe46c..9c8cda5544 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java
@@ -183,7 +183,7 @@ class HTTPRequest implements Callback {
return USER_AGENT_STRING = Util.toHumanReadableAscii(
String.format("%s %s (%s) Android/%s (%s)",
getApplicationIdentifier(),
- com.mapbox.services.android.telemetry.BuildConfig.MAPBOX_VERSION_STRING,
+ BuildConfig.MAPBOX_VERSION_STRING,
BuildConfig.GIT_REVISION_SHORT,
Build.VERSION.SDK_INT,
Build.CPU_ABI)
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationSource.java
index 5a87f6384f..f41a022fa2 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationSource.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationSource.java
@@ -102,6 +102,7 @@ public class LocationSource extends LocationEngine implements
public void requestLocationUpdates() {
// Common params
LocationRequest request = LocationRequest.create()
+ .setInterval(1000)
.setFastestInterval(1000)
.setSmallestDisplacement(3.0f);
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationManager.java
index 0c77723354..e91779dfd1 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationManager.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationManager.java
@@ -10,6 +10,7 @@ import com.mapbox.mapboxsdk.annotations.Annotation;
import com.mapbox.mapboxsdk.annotations.BaseMarkerOptions;
import com.mapbox.mapboxsdk.annotations.BaseMarkerViewOptions;
import com.mapbox.mapboxsdk.annotations.Icon;
+import com.mapbox.mapboxsdk.annotations.IconFactory;
import com.mapbox.mapboxsdk.annotations.Marker;
import com.mapbox.mapboxsdk.annotations.MarkerView;
import com.mapbox.mapboxsdk.annotations.MarkerViewManager;
@@ -256,7 +257,11 @@ class AnnotationManager {
private MarkerView prepareViewMarker(BaseMarkerViewOptions markerViewOptions) {
MarkerView marker = markerViewOptions.getMarker();
- iconManager.loadIconForMarkerView(marker);
+ Icon icon = markerViewOptions.getIcon();
+ if (icon == null) {
+ icon = IconFactory.getInstance(mapView.getContext()).defaultMarkerView();
+ }
+ marker.setIcon(icon);
return marker;
}
@@ -660,24 +665,16 @@ class AnnotationManager {
if (annotation.getId() == newSelectedMarkerId) {
Marker marker = (Marker) annotation;
- if (marker instanceof MarkerView) {
- handledDefaultClick = markerViewManager.onClickMarkerView((MarkerView) marker);
- } else {
+ if (!(marker instanceof MarkerView)) {
if (onMarkerClickListener != null) {
// end developer has provided a custom click listener
handledDefaultClick = onMarkerClickListener.onMarkerClick(marker);
}
- }
-
- if (annotation instanceof MarkerView) {
- markerViewManager.onClickMarkerView((MarkerView) annotation);
- } else {
if (!handledDefaultClick) {
// only select marker if user didn't handle the click event themselves
selectMarker(marker);
}
}
-
return true;
}
}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/IconManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/IconManager.java
index c9d81a88bc..c152630278 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/IconManager.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/IconManager.java
@@ -71,27 +71,6 @@ class IconManager {
return icon;
}
- Icon loadIconForMarkerView(MarkerView marker) {
- Icon icon = marker.getIcon();
- int iconSize = icons.size() + 1;
- if (icon == null) {
- icon = IconFactory.getInstance(nativeMapView.getContext()).defaultMarkerView();
- marker.setIcon(icon);
- }
- Bitmap bitmap = icon.getBitmap();
- averageIconHeight = averageIconHeight + (bitmap.getHeight() - averageIconHeight) / iconSize;
- averageIconWidth = averageIconWidth + (bitmap.getWidth() - averageIconWidth) / iconSize;
- if (!icons.contains(icon)) {
- icons.add(icon);
- } else {
- Icon oldIcon = icons.get(icons.indexOf(icon));
- if (!oldIcon.getBitmap().sameAs(icon.getBitmap())) {
- throw new IconBitmapChangedException();
- }
- }
- return icon;
- }
-
int getTopOffsetPixelsForIcon(Icon icon) {
return (int) (nativeMapView.getTopOffsetPixelsForAnnotationSymbol(icon.getId()) * nativeMapView.getPixelRatio());
}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java
index 0f4d3197cc..67e55352f4 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapGestureDetector.java
@@ -4,13 +4,13 @@ import android.content.Context;
import android.graphics.PointF;
import android.location.Location;
import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
import android.support.v4.view.GestureDetectorCompat;
import android.support.v4.view.ScaleGestureDetectorCompat;
import android.view.InputDevice;
import android.view.MotionEvent;
import android.view.ScaleGestureDetector;
import android.view.ViewConfiguration;
-import android.widget.ZoomButtonsController;
import com.almeros.android.multitouch.gesturedetectors.RotateGestureDetector;
import com.almeros.android.multitouch.gesturedetectors.ShoveGestureDetector;
@@ -93,6 +93,20 @@ final class MapGestureDetector {
}
/**
+ * Get the current active gesture focal point.
+ * <p>
+ * This could be either the user provided focal point in {@link UiSettings#setFocalPoint(PointF)} or the focal point
+ * defined as a result of {@link TrackingSettings#setMyLocationEnabled(boolean)}.
+ * </p>
+ *
+ * @return the current active gesture focal point.
+ */
+ @Nullable
+ PointF getFocalPoint() {
+ return focalPoint;
+ }
+
+ /**
* Given coordinates from a gesture, use the current projection to translate it into
* a Location object.
*
@@ -159,10 +173,10 @@ final class MapGestureDetector {
if (twoTap && isTap && !inProgress) {
if (focalPoint != null) {
- transform.zoom(false, focalPoint.x, focalPoint.y);
+ transform.zoom(false, focalPoint);
} else {
PointF focalPoint = TwoFingerGestureDetector.determineFocalPoint(event);
- transform.zoom(false, focalPoint.x, focalPoint.y);
+ transform.zoom(false, focalPoint);
}
twoTap = false;
return true;
@@ -262,10 +276,10 @@ final class MapGestureDetector {
// Single finger double tap
if (focalPoint != null) {
// User provided focal point
- transform.zoom(true, focalPoint.x, focalPoint.y);
+ transform.zoom(true, focalPoint);
} else {
// Zoom in on gesture
- transform.zoom(true, e.getX(), e.getY());
+ transform.zoom(true, new PointF(e.getX(), e.getY()));
}
break;
}
@@ -636,34 +650,6 @@ final class MapGestureDetector {
}
}
- // This class handles input events from the zoom control buttons
- // Zoom controls allow single touch only devices to zoom in and out
- private static class OnZoomListener implements ZoomButtonsController.OnZoomListener {
-
- private UiSettings uiSettings;
- private Transform transform;
-
- OnZoomListener(UiSettings uiSettings, Transform transform) {
- this.uiSettings = uiSettings;
- this.transform = transform;
- }
-
- // Not used
- @Override
- public void onVisibilityChanged(boolean visible) {
- // Ignore
- }
-
- // Called when user pushes a zoom button
- @Override
- public void onZoom(boolean zoomIn) {
- if (!uiSettings.isZoomGesturesEnabled()) {
- return;
- }
- transform.zoom(zoomIn);
- }
- }
-
void setOnMapClickListener(MapboxMap.OnMapClickListener onMapClickListener) {
this.onMapClickListener = onMapClickListener;
}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapKeyListener.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapKeyListener.java
index c993cd3ec6..7175242282 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapKeyListener.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapKeyListener.java
@@ -1,5 +1,6 @@
package com.mapbox.mapboxsdk.maps;
+import android.graphics.PointF;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.view.KeyEvent;
@@ -125,7 +126,8 @@ final class MapKeyListener {
}
// Zoom out
- transform.zoom(false, uiSettings.getWidth() / 2, uiSettings.getHeight() / 2);
+ PointF focalPoint = new PointF(uiSettings.getWidth() / 2, uiSettings.getHeight() / 2);
+ transform.zoom(false, focalPoint);
return true;
default:
@@ -160,7 +162,8 @@ final class MapKeyListener {
}
// Zoom in
- transform.zoom(true, uiSettings.getWidth() / 2, uiSettings.getHeight() / 2);
+ PointF focalPoint = new PointF(uiSettings.getWidth() / 2, uiSettings.getHeight() / 2);
+ transform.zoom(true, focalPoint);
return true;
}
@@ -214,7 +217,8 @@ final class MapKeyListener {
// Only handle if we have not already long pressed
if (currentTrackballLongPressTimeOut != null) {
// Zoom in
- transform.zoom(true, uiSettings.getWidth() / 2, uiSettings.getHeight() / 2);
+ PointF focalPoint = new PointF(uiSettings.getWidth() / 2, uiSettings.getHeight() / 2);
+ transform.zoom(true, focalPoint);
}
return true;
@@ -255,7 +259,8 @@ final class MapKeyListener {
// Check if the trackball is still pressed
if (!cancelled) {
// Zoom out
- transform.zoom(false, uiSettings.getWidth() / 2, uiSettings.getHeight() / 2);
+ PointF pointF = new PointF(uiSettings.getWidth() / 2, uiSettings.getHeight() / 2);
+ transform.zoom(false, pointF);
// Ensure the up action is not run
currentTrackballLongPressTimeOut = null;
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java
index 8fa2d0b152..8c8b70d788 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java
@@ -31,6 +31,7 @@ import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.FrameLayout;
import android.widget.ImageView;
+import android.widget.ZoomButtonsController;
import com.mapbox.mapboxsdk.Mapbox;
import com.mapbox.mapboxsdk.R;
@@ -147,7 +148,9 @@ public class MapView extends FrameLayout {
// user input
mapGestureDetector = new MapGestureDetector(context, transform, proj, uiSettings, trackingSettings, annotations);
mapKeyListener = new MapKeyListener(transform, trackingSettings, uiSettings);
- mapZoomButtonController = new MapZoomButtonController(this, uiSettings, transform);
+
+ MapZoomControllerListener zoomListener = new MapZoomControllerListener(mapGestureDetector, uiSettings, transform);
+ mapZoomButtonController = new MapZoomButtonController(this, uiSettings, zoomListener);
// inject widgets with MapboxMap
compassView.setMapboxMap(mapboxMap);
@@ -508,7 +511,7 @@ public class MapView extends FrameLayout {
if (destroyed) {
return;
}
- mapboxMap.onUpdate();
+ mapboxMap.onUpdateRegionChange();
}
}
@@ -521,13 +524,15 @@ public class MapView extends FrameLayout {
@CallSuper
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
- mapZoomButtonController.setVisible(false);
+ if (mapZoomButtonController != null) {
+ mapZoomButtonController.setVisible(false);
+ }
}
// Called when view is hidden and shown
@Override
protected void onVisibilityChanged(@NonNull View changedView, int visibility) {
- if (isInEditMode()) {
+ if (isInEditMode() || mapZoomButtonController == null) {
return;
}
mapZoomButtonController.setVisible(visibility == View.VISIBLE);
@@ -801,7 +806,7 @@ public class MapView extends FrameLayout {
public static final int DID_FINISH_RENDERING_FRAME = 9;
/**
- * This event is triggered when the map finished rendeirng the frame fully.
+ * This event is triggered when the map finished rendering the frame fully.
* <p>
* Register to {@link MapChange} events with {@link MapView#addOnMapChangedListener(OnMapChangedListener)}.
* </p>
@@ -937,12 +942,59 @@ public class MapView extends FrameLayout {
}
}
+ private class MapZoomControllerListener implements ZoomButtonsController.OnZoomListener {
+
+ private final MapGestureDetector mapGestureDetector;
+ private final UiSettings uiSettings;
+ private final Transform transform;
+
+ MapZoomControllerListener(MapGestureDetector detector, UiSettings uiSettings, Transform transform) {
+ this.mapGestureDetector = detector;
+ this.uiSettings = uiSettings;
+ this.transform = transform;
+ }
+
+ // Not used
+ @Override
+ public void onVisibilityChanged(boolean visible) {
+ // Ignore
+ }
+
+ // Called when user pushes a zoom button on the ZoomButtonController
+ @Override
+ public void onZoom(boolean zoomIn) {
+ if (uiSettings.isZoomGesturesEnabled()) {
+ onZoom(zoomIn, mapGestureDetector.getFocalPoint());
+ }
+ }
+
+ private void onZoom(boolean zoomIn, @Nullable PointF focalPoint) {
+ if (focalPoint != null) {
+ transform.zoom(zoomIn, focalPoint);
+ } else {
+ PointF centerPoint = new PointF(getMeasuredWidth() / 2, getMeasuredHeight() / 2);
+ transform.zoom(zoomIn, centerPoint);
+ }
+ }
+ }
+
private class CameraZoomInvalidator implements TrackingSettings.CameraZoomInvalidator {
+
@Override
public void zoomTo(double zoomLevel) {
- double currentZoomLevel = mapboxMap.getCameraPosition().zoom;
+ Transform transform = mapboxMap.getTransform();
+ double currentZoomLevel = transform.getCameraPosition().zoom;
if (currentZoomLevel < zoomLevel) {
- mapboxMap.getTransform().setZoom(zoomLevel);
+ setZoom(zoomLevel, mapGestureDetector.getFocalPoint(), transform);
+ }
+ }
+
+ private void setZoom(double zoomLevel, @Nullable PointF focalPoint, @NonNull Transform transform) {
+ if (focalPoint != null) {
+ transform.setZoom(zoomLevel, focalPoint);
+ } else {
+ PointF centerPoint = new PointF(getMeasuredWidth() / 2, getMeasuredHeight() / 2);
+ transform.setZoom(zoomLevel, centerPoint);
}
}
}
@@ -969,8 +1021,10 @@ public class MapView extends FrameLayout {
mapboxMap.onPostMapReady();
}
});
+ } else if (change == DID_FINISH_RENDERING_FRAME || change == DID_FINISH_RENDERING_FRAME_FULLY_RENDERED) {
+ mapboxMap.onUpdateFullyRendered();
} else if (change == REGION_IS_CHANGING || change == REGION_DID_CHANGE || change == DID_FINISH_LOADING_MAP) {
- mapboxMap.onUpdate();
+ mapboxMap.onUpdateRegionChange();
}
}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapZoomButtonController.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapZoomButtonController.java
index 06084d906e..16513904c5 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapZoomButtonController.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapZoomButtonController.java
@@ -16,11 +16,11 @@ final class MapZoomButtonController extends ZoomButtonsController {
private UiSettings uiSettings;
- MapZoomButtonController(@NonNull View ownerView, @NonNull UiSettings uiSettings, @NonNull Transform transform) {
+ MapZoomButtonController(@NonNull View ownerView, @NonNull UiSettings uiSettings, @NonNull OnZoomListener listener) {
super(ownerView);
this.uiSettings = uiSettings;
setZoomSpeed(MapboxConstants.ANIMATION_DURATION);
- setOnZoomListener(new OnZoomListener(uiSettings, transform));
+ setOnZoomListener(listener);
}
@Override
@@ -29,31 +29,4 @@ final class MapZoomButtonController extends ZoomButtonsController {
super.setVisible(visible);
}
}
-
- // Zoom controls allow single touch only devices to zoom in and out
- private static class OnZoomListener implements ZoomButtonsController.OnZoomListener {
-
- private final UiSettings uiSettings;
- private final Transform transform;
-
- OnZoomListener(UiSettings uiSettings, Transform transform) {
- this.uiSettings = uiSettings;
- this.transform = transform;
- }
-
- // Not used
- @Override
- public void onVisibilityChanged(boolean visible) {
- // Ignore
- }
-
- // Called when user pushes a zoom button
- @Override
- public void onZoom(boolean zoomIn) {
- if (!uiSettings.isZoomGesturesEnabled()) {
- return;
- }
- transform.zoom(zoomIn);
- }
- }
}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java
index 46c5e269c0..6edae8b944 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java
@@ -96,6 +96,9 @@ public final class MapboxMap {
setStyleUrl(options);
}
+ /**
+ * Called when the hosting Activity/Fragment onStart() method is called.
+ */
void onStart() {
nativeMapView.update();
trackingSettings.onStart();
@@ -105,10 +108,18 @@ public final class MapboxMap {
}
}
+ /**
+ * Called when the hosting Activity/Fragment onStop() method is called.
+ */
void onStop() {
trackingSettings.onStop();
}
+ /**
+ * Called when the hosting Activity/Fragment is going to be destroyed and map state needs to be saved.
+ *
+ * @param outState the bundle to save the state to.
+ */
void onSaveInstanceState(Bundle outState) {
outState.putParcelable(MapboxConstants.STATE_CAMERA_POSITION, transform.getCameraPosition());
outState.putBoolean(MapboxConstants.STATE_DEBUG_ACTIVE, nativeMapView.getDebug());
@@ -117,6 +128,11 @@ public final class MapboxMap {
uiSettings.onSaveInstanceState(outState);
}
+ /**
+ * Called when the hosting Activity/Fragment is recreated and map state needs to be restored.
+ *
+ * @param savedInstanceState the bundle containing the saved state
+ */
void onRestoreInstanceState(Bundle savedInstanceState) {
final CameraPosition cameraPosition = savedInstanceState.getParcelable(MapboxConstants.STATE_CAMERA_POSITION);
if (cameraPosition != null) {
@@ -153,16 +169,23 @@ public final class MapboxMap {
}
/**
- * Called when the user
+ * Called when the region is changing or has changed.
*/
- void onUpdate() {
- CameraPosition cameraPosition = transform.invalidateCameraPosition();
- uiSettings.update(cameraPosition);
- // FIXME introduce update method with camera position
+ void onUpdateRegionChange() {
trackingSettings.update();
annotationManager.update();
}
+ /**
+ * Called when the map frame is fully rendered.
+ */
+ void onUpdateFullyRendered() {
+ CameraPosition cameraPosition = transform.invalidateCameraPosition();
+ if (cameraPosition != null) {
+ uiSettings.update(cameraPosition);
+ }
+ }
+
// Style
/**
@@ -815,10 +838,20 @@ public final class MapboxMap {
transform.setBearing(bearing, focalX, focalY, duration);
}
+ /**
+ * Returns the measured height of the Map.
+ *
+ * @return the height of the map
+ */
public float getHeight() {
return nativeMapView.getHeight();
}
+ /**
+ * Returns the measured width of the Map.
+ *
+ * @return the width of the map
+ */
public float getWidth() {
return nativeMapView.getWidth();
}
@@ -881,35 +914,80 @@ public final class MapboxMap {
/**
* <p>
- * Loads a new map style from the specified URL.
+ * Loads a new map style asynchronous from the specified URL.
* </p>
* {@code url} can take the following forms:
* <ul>
* <li>{@code Style.*}: load one of the bundled styles in {@link Style}.</li>
* <li>{@code mapbox://styles/<user>/<style>}:
- * retrieves the style from a <a href="https://www.mapbox.com/account/">Mapbox account.</a>
+ * loads the style from a <a href="https://www.mapbox.com/account/">Mapbox account.</a>
* {@code user} is your username. {@code style} is the ID of your custom
* style created in <a href="https://www.mapbox.com/studio">Mapbox Studio</a>.</li>
* <li>{@code http://...} or {@code https://...}:
- * retrieves the style over the Internet from any web server.</li>
+ * loads the style over the Internet from any web server.</li>
* <li>{@code asset://...}:
- * reads the style from the APK {@code assets/} directory.
+ * loads the style from the APK {@code assets/} directory.
* This is used to load a style bundled with your app.</li>
* <li>{@code null}: loads the default {@link Style#MAPBOX_STREETS} style.</li>
* </ul>
* <p>
- * This method is asynchronous and will return immediately before the style finishes loading.
- * If you wish to wait for the map to finish loading listen for the {@link MapView#DID_FINISH_LOADING_MAP} event.
+ * This method is asynchronous and will return before the style finishes loading.
+ * If you wish to wait for the map to finish loading, listen for the {@link MapView#DID_FINISH_LOADING_MAP} event
+ * or use the {@link #setStyleUrl(String, OnStyleLoadedListener)} method instead.
* </p>
* If the style fails to load or an invalid style URL is set, the map view will become blank.
* An error message will be logged in the Android logcat and {@link MapView#DID_FAIL_LOADING_MAP} event will be
- * sent.
+ * emitted.
*
* @param url The URL of the map style
* @see Style
*/
@UiThread
public void setStyleUrl(@NonNull String url) {
+ setStyleUrl(url, null);
+ }
+
+ /**
+ * <p>
+ * Loads a new map style asynchronous from the specified URL.
+ * </p>
+ * {@code url} can take the following forms:
+ * <ul>
+ * <li>{@code Style.*}: load one of the bundled styles in {@link Style}.</li>
+ * <li>{@code mapbox://styles/<user>/<style>}:
+ * loads the style from a <a href="https://www.mapbox.com/account/">Mapbox account.</a>
+ * {@code user} is your username. {@code style} is the ID of your custom
+ * style created in <a href="https://www.mapbox.com/studio">Mapbox Studio</a>.</li>
+ * <li>{@code http://...} or {@code https://...}:
+ * loads the style over the Internet from any web server.</li>
+ * <li>{@code asset://...}:
+ * loads the style from the APK {@code assets/} directory.
+ * This is used to load a style bundled with your app.</li>
+ * <li>{@code null}: loads the default {@link Style#MAPBOX_STREETS} style.</li>
+ * </ul>
+ * <p>
+ * If the style fails to load or an invalid style URL is set, the map view will become blank.
+ * An error message will be logged in the Android logcat and {@link MapView#DID_FAIL_LOADING_MAP} event will be
+ * emitted.
+ * <p>
+ *
+ * @param url The URL of the map style
+ * @param callback The callback that is invoked when the style has loaded.
+ * @see Style
+ */
+ @UiThread
+ public void setStyleUrl(@NonNull final String url, @Nullable final OnStyleLoadedListener callback) {
+ if (callback != null) {
+ nativeMapView.addOnMapChangedListener(new MapView.OnMapChangedListener() {
+ @Override
+ public void onMapChanged(@MapView.MapChange int change) {
+ if (change == MapView.DID_FINISH_LOADING_STYLE) {
+ callback.onStyleLoaded(url);
+ nativeMapView.removeOnMapChangedListener(this);
+ }
+ }
+ });
+ }
nativeMapView.setStyleUrl(url);
}
@@ -918,8 +996,9 @@ public final class MapboxMap {
* Loads a new map style from the specified bundled style.
* </p>
* <p>
- * This method is asynchronous and will return immediately before the style finishes loading.
- * If you wish to wait for the map to finish loading listen for the {@link MapView#DID_FINISH_LOADING_MAP} event.
+ * This method is asynchronous and will return before the style finishes loading.
+ * If you wish to wait for the map to finish loading, listen for the {@link MapView#DID_FINISH_LOADING_MAP} event
+ * or use the {@link #setStyle(String, OnStyleLoadedListener)} method instead.
* </p>
* If the style fails to load or an invalid style URL is set, the map view will become blank.
* An error message will be logged in the Android logcat and {@link MapView#DID_FAIL_LOADING_MAP} event will be
@@ -927,7 +1006,6 @@ public final class MapboxMap {
*
* @param style The bundled style. Accepts one of the values from {@link Style}.
* @see Style
- * @deprecated use {@link #setStyleUrl(String)} instead with versioned url methods from {@link Style}
*/
@UiThread
public void setStyle(@Style.StyleUrl String style) {
@@ -935,6 +1013,22 @@ public final class MapboxMap {
}
/**
+ * <p>
+ * Loads a new map style from the specified bundled style.
+ * </p>
+ * If the style fails to load or an invalid style URL is set, the map view will become blank.
+ * An error message will be logged in the Android logcat and {@link MapView#DID_FAIL_LOADING_MAP} event will be
+ * sent.
+ *
+ * @param style The bundled style. Accepts one of the values from {@link Style}.
+ * @see Style
+ */
+ @UiThread
+ public void setStyle(@Style.StyleUrl String style, @Nullable OnStyleLoadedListener callback) {
+ setStyleUrl(style, callback);
+ }
+
+ /**
* Loads a new map style from MapboxMapOptions if available.
*
* @param options the object containing the style url
@@ -942,20 +1036,17 @@ public final class MapboxMap {
private void setStyleUrl(@NonNull MapboxMapOptions options) {
String style = options.getStyle();
if (!TextUtils.isEmpty(style)) {
- setStyleUrl(style);
+ setStyleUrl(style, null);
}
}
/**
- * <p>
* Returns the map style currently displayed in the map view.
- * </p>
- * If the default style is currently displayed, a URL will be returned instead of null.
*
- * @return The URL of the map style.
+ * @return The URL of the map style
*/
@UiThread
- @NonNull
+ @Nullable
public String getStyleUrl() {
return nativeMapView.getStyleUrl();
}
@@ -971,8 +1062,8 @@ public final class MapboxMap {
* The marker's icon is rendered on the map at the location {@code Marker.position}.
* If {@code Marker.title} is defined, the map shows an info box with the marker's title and snippet.
*
- * @param markerOptions A marker options object that defines how to render the marker.
- * @return The {@code Marker} that was added to the map.
+ * @param markerOptions A marker options object that defines how to render the marker
+ * @return The {@code Marker} that was added to the map
*/
@UiThread
@NonNull
@@ -987,8 +1078,8 @@ public final class MapboxMap {
* The marker's icon is rendered on the map at the location {@code Marker.position}.
* If {@code Marker.title} is defined, the map shows an info box with the marker's title and snippet.
*
- * @param markerOptions A marker options object that defines how to render the marker.
- * @return The {@code Marker} that was added to the map.
+ * @param markerOptions A marker options object that defines how to render the marker
+ * @return The {@code Marker} that was added to the map
*/
@UiThread
@NonNull
@@ -1003,8 +1094,8 @@ public final class MapboxMap {
* The marker's icon is rendered on the map at the location {@code Marker.position}.
* If {@code Marker.title} is defined, the map shows an info box with the marker's title and snippet.
*
- * @param markerOptions A marker options object that defines how to render the marker.
- * @return The {@code Marker} that was added to the map.
+ * @param markerOptions A marker options object that defines how to render the marker
+ * @return The {@code Marker} that was added to the map
*/
@UiThread
@NonNull
@@ -1012,7 +1103,6 @@ public final class MapboxMap {
return annotationManager.addMarker(markerOptions, this, null);
}
-
/**
* <p>
* Adds a marker to this map.
@@ -1020,9 +1110,9 @@ public final class MapboxMap {
* The marker's icon is rendered on the map at the location {@code Marker.position}.
* If {@code Marker.title} is defined, the map shows an info box with the marker's title and snippet.
*
- * @param markerOptions A marker options object that defines how to render the marker.
- * @param onMarkerViewAddedListener Callback invoked when the View has been added to the map.
- * @return The {@code Marker} that was added to the map.
+ * @param markerOptions A marker options object that defines how to render the marker
+ * @param onMarkerViewAddedListener Callback invoked when the View has been added to the map
+ * @return The {@code Marker} that was added to the map
*/
@UiThread
@NonNull
@@ -1032,7 +1122,14 @@ public final class MapboxMap {
}
/**
- * FIXME javadoc
+ * Adds multiple markersViews to this map.
+ * <p>
+ * The marker's icon is rendered on the map at the location {@code Marker.position}.
+ * If {@code Marker.title} is defined, the map shows an info box with the marker's title and snippet.
+ * </p>
+ *
+ * @param markerViewOptions A list of markerView options objects that defines how to render the markers
+ * @return A list of the {@code MarkerView}s that were added to the map
*/
@UiThread
@NonNull
@@ -1042,7 +1139,10 @@ public final class MapboxMap {
}
/**
- * FIXME javadoc
+ * Returns markerViews found inside of a rectangle on this map.
+ *
+ * @param rect the rectangular area on the map to query for markerViews
+ * @return A list of the markerViews that were found in the rectangle
*/
@UiThread
@NonNull
@@ -1057,8 +1157,8 @@ public final class MapboxMap {
* The marker's icon is rendered on the map at the location {@code Marker.position}.
* If {@code Marker.title} is defined, the map shows an info box with the marker's title and snippet.
*
- * @param markerOptionsList A list of marker options objects that defines how to render the markers.
- * @return A list of the {@code Marker}s that were added to the map.
+ * @param markerOptionsList A list of marker options objects that defines how to render the markers
+ * @return A list of the {@code Marker}s that were added to the map
*/
@UiThread
@NonNull
@@ -1072,7 +1172,7 @@ public final class MapboxMap {
* Updates a marker on this map. Does nothing if the marker isn't already added.
* </p>
*
- * @param updatedMarker An updated marker object.
+ * @param updatedMarker An updated marker object
*/
@UiThread
public void updateMarker(@NonNull Marker updatedMarker) {
@@ -1082,8 +1182,8 @@ public final class MapboxMap {
/**
* Adds a polyline to this map.
*
- * @param polylineOptions A polyline options object that defines how to render the polyline.
- * @return The {@code Polyine} that was added to the map.
+ * @param polylineOptions A polyline options object that defines how to render the polyline
+ * @return The {@code Polyine} that was added to the map
*/
@UiThread
@NonNull
@@ -1128,8 +1228,8 @@ public final class MapboxMap {
/**
* Adds multiple polygons to this map.
*
- * @param polygonOptionsList A list of polygon options objects that defines how to render the polygons.
- * @return A list of the {@code Polygon}s that were added to the map.
+ * @param polygonOptionsList A list of polygon options objects that defines how to render the polygons
+ * @return A list of the {@code Polygon}s that were added to the map
*/
@UiThread
@NonNull
@@ -1137,11 +1237,10 @@ public final class MapboxMap {
return annotationManager.addPolygons(polygonOptionsList, this);
}
-
/**
* Update a polygon on this map.
*
- * @param polygon An updated polygon object.
+ * @param polygon An updated polygon object
*/
@UiThread
public void updatePolygon(Polygon polygon) {
@@ -1152,7 +1251,7 @@ public final class MapboxMap {
* <p>
* Convenience method for removing a Marker from the map.
* </p>
- * Calls removeAnnotation() internally
+ * Calls removeAnnotation() internally.
*
* @param marker Marker to remove
*/
@@ -1165,7 +1264,7 @@ public final class MapboxMap {
* <p>
* Convenience method for removing a Polyline from the map.
* </p>
- * Calls removeAnnotation() internally
+ * Calls removeAnnotation() internally.
*
* @param polyline Polyline to remove
*/
@@ -1178,7 +1277,7 @@ public final class MapboxMap {
* <p>
* Convenience method for removing a Polygon from the map.
* </p>
- * Calls removeAnnotation() internally
+ * Calls removeAnnotation() internally.
*
* @param polygon Polygon to remove
*/
@@ -1558,6 +1657,11 @@ public final class MapboxMap {
return annotationManager.getInfoWindowManager().getOnInfoWindowLongClickListener();
}
+ /**
+ * Set an callback to be invoked when an InfoWindow closes.
+ *
+ * @param listener callback invoked when an InfoWindow closes
+ */
public void setOnInfoWindowCloseListener(@Nullable OnInfoWindowCloseListener listener) {
annotationManager.getInfoWindowManager().setOnInfoWindowCloseListener(listener);
}
@@ -1657,7 +1761,6 @@ public final class MapboxMap {
* Takes a snapshot of the map.
*
* @param callback Callback method invoked when the snapshot is taken.
- * @param bitmap A pre-allocated bitmap.
*/
@UiThread
public void snapshot(@NonNull SnapshotReadyCallback callback) {
@@ -2104,6 +2207,16 @@ public final class MapboxMap {
void onSnapshotReady(Bitmap snapshot);
}
+ /**
+ * Interface definintion for a callback to be invoked when the style has finished loading.
+ */
+ public interface OnStyleLoadedListener {
+ /**
+ * Invoked when the style has finished loading.
+ */
+ void onStyleLoaded(String style);
+ }
+
//
// Used for instrumentation testing
//
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java
index bf3bd1f224..c5eaf2deb9 100755
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java
@@ -378,18 +378,11 @@ final class NativeMapView {
return nativeGetScale();
}
- public void setZoom(double zoom) {
+ public void setZoom(double zoom, PointF focalPoint, long duration) {
if (isDestroyedOn("setZoom")) {
return;
}
- setZoom(zoom, 0);
- }
-
- public void setZoom(double zoom, long duration) {
- if (isDestroyedOn("setZoom")) {
- return;
- }
- nativeSetZoom(zoom, duration);
+ nativeSetZoom(zoom, focalPoint.x / pixelRatio, focalPoint.y / pixelRatio, duration);
}
public double getZoom() {
@@ -1023,7 +1016,7 @@ final class NativeMapView {
private native double nativeGetScale();
- private native void nativeSetZoom(double zoom, long duration);
+ private native void nativeSetZoom(double zoom, double cx, double cy, long duration);
private native double nativeGetZoom();
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TrackingSettings.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TrackingSettings.java
index 38f307f149..476f4554c1 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TrackingSettings.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/TrackingSettings.java
@@ -281,7 +281,7 @@ public final class TrackingSettings {
*/
void resetTrackingModesIfRequired(CameraPosition cameraPosition) {
if (isDismissTrackingModesForCameraPositionChange()) {
- resetTrackingModesIfRequired(cameraPosition.target != null, cameraPosition.bearing != -1);
+ resetTrackingModesIfRequired(cameraPosition.target != null, false);
}
}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java
index 0f6b146907..ec4b903a74 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java
@@ -1,5 +1,6 @@
package com.mapbox.mapboxsdk.maps;
+import android.graphics.PointF;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.UiThread;
@@ -174,23 +175,23 @@ final class Transform implements MapView.OnMapChangedListener {
return cameraPosition.zoom;
}
- void zoom(boolean zoomIn) {
- zoom(zoomIn, -1.0f, -1.0f);
- }
-
- void zoom(boolean zoomIn, float x, float y) {
+ void zoom(boolean zoomIn, @NonNull PointF focalPoint) {
// Cancel any animation
cancelTransitions();
- if (zoomIn) {
- mapView.scaleBy(2.0, x, y, MapboxConstants.ANIMATION_DURATION);
- } else {
- mapView.scaleBy(0.5, x, y, MapboxConstants.ANIMATION_DURATION);
+ CameraPosition cameraPosition = invalidateCameraPosition();
+ if (cameraPosition != null) {
+ int newZoom = (int) Math.round(cameraPosition.zoom + (zoomIn ? 1 : -1));
+ setZoom(newZoom, focalPoint, MapboxConstants.ANIMATION_DURATION);
}
}
- void setZoom(double zoom) {
- mapView.setZoom(zoom);
+ void setZoom(double zoom, @NonNull PointF focalPoint) {
+ setZoom(zoom, focalPoint, 0);
+ }
+
+ void setZoom(double zoom, @NonNull PointF focalPoint, long duration) {
+ mapView.setZoom(zoom, focalPoint, duration);
}
// Direction
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java
index 2c3685b862..663202eacc 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java
@@ -257,9 +257,7 @@ public class MyLocationView extends View {
final PointF pointF = screenLocation;
float metersPerPixel = (float) projection.getMetersPerPixelAtLatitude(location.getLatitude());
- float accuracyPixels = (Float) accuracyAnimator.getAnimatedValue() / metersPerPixel / 2;
- float maxRadius = getWidth() / 2;
- accuracyPixels = accuracyPixels <= maxRadius ? accuracyPixels : maxRadius;
+ float accuracyPixels = (Float) accuracyAnimator.getAnimatedValue() / metersPerPixel;
// reset
matrix.reset();
@@ -435,10 +433,12 @@ public class MyLocationView extends View {
}
locationEngine.addLocationEngineListener(userLocationListener);
+ locationEngine.activate();
} else {
// Disable location and user dot
location = null;
locationEngine.removeLocationEngineListener(userLocationListener);
+ locationEngine.deactivate();
}
locationEngine.setPriority(LocationEnginePriority.HIGH_ACCURACY);
@@ -573,8 +573,10 @@ public class MyLocationView extends View {
public void onConnected() {
MyLocationView locationView = userLocationView.get();
if (locationView != null) {
- Location location = LocationSource.getLocationEngine(locationView.getContext()).getLastLocation();
+ LocationEngine locationSource = LocationSource.getLocationEngine(locationView.getContext());
+ Location location = locationSource.getLastLocation();
locationView.setLocation(location);
+ locationSource.requestLocationUpdates();
}
}
@@ -730,7 +732,7 @@ public class MyLocationView extends View {
accuracyAnimator.end();
}
- accuracyAnimator = ValueAnimator.ofFloat(accuracy * 10, location.getAccuracy() * 10);
+ accuracyAnimator = ValueAnimator.ofFloat(accuracy, location.getAccuracy());
accuracyAnimator.setDuration(750);
accuracyAnimator.start();
accuracy = location.getAccuracy();
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/storage/package-info.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/storage/package-info.java
new file mode 100644
index 0000000000..85950735ef
--- /dev/null
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/storage/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * Contains the Mapbox Maps Android Storage API classes.
+ */
+package com.mapbox.mapboxsdk.storage;
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonOptions.java
index 27a3d5c898..1a1711e547 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonOptions.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonOptions.java
@@ -3,8 +3,9 @@ package com.mapbox.mapboxsdk.style.sources;
import java.util.HashMap;
/**
- * Options for the {@link GeoJsonSource}
+ * Builder class for composing GeoJsonSource objects.
*
+ * @see GeoJsonSource
* @see <a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources-geojson">The online documentation</a>
*/
public class GeoJsonOptions extends HashMap<String, Object> {
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java
index 9f957e7727..b253595713 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java
@@ -15,7 +15,7 @@ import java.util.HashMap;
import java.util.List;
/**
- * A GeoJson source. Exposes a {@link FeatureCollection} from Json.
+ * GeoJson source, allows using FeatureCollections from Json.
*
* @see <a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources-geojson">the style specification</a>
*/
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/RasterSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/RasterSource.java
index eabbdb8395..98b74afcff 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/RasterSource.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/RasterSource.java
@@ -3,7 +3,7 @@ package com.mapbox.mapboxsdk.style.sources;
import java.net.URL;
/**
- * Raster Source enables the use of raster tiles.
+ * Raster source, allows using raster tiles as source.
*
* @see <a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources-raster">The style specification</a>
*/
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/TileSet.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/TileSet.java
index 9f403c2fb9..54e4e5f5d3 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/TileSet.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/TileSet.java
@@ -8,7 +8,7 @@ import java.util.HashMap;
import java.util.Map;
/**
- * Tile set
+ * Tile set, allows using TileJson specification as source.
*
* @see <a href="https://github.com/mapbox/tilejson-spec/tree/master/2.1.0">The tileset specification</a>
*/
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java
index 68eb81b7f4..cff5ab6353 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java
@@ -14,7 +14,7 @@ import java.util.Arrays;
import java.util.List;
/**
- * Vector source enables the use of vector tiles.
+ * Vector source, allows the use of vector tiles.
*
* @see <a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources-vector">the style specification</a>
*/
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_mapview_internal.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_mapview_internal.xml
index e6a2677785..7a38437fee 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_mapview_internal.xml
+++ b/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_mapview_internal.xml
@@ -8,7 +8,7 @@
android:contentDescription="@null"
android:visibility="gone"/>
- <FrameLayout
+ <com.mapbox.mapboxsdk.annotations.MarkerViewContainer
android:id="@+id/markerViewContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/resources/fabric/com.mapbox.mapboxsdk.mapbox-android-sdk.properties b/platform/android/MapboxGLAndroidSDK/src/main/resources/fabric/com.mapbox.mapboxsdk.mapbox-android-sdk.properties
index 63cccc00ef..1d436f1291 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/resources/fabric/com.mapbox.mapboxsdk.mapbox-android-sdk.properties
+++ b/platform/android/MapboxGLAndroidSDK/src/main/resources/fabric/com.mapbox.mapboxsdk.mapbox-android-sdk.properties
@@ -1,3 +1,3 @@
fabric-identifier=com.mapbox.mapboxsdk.mapbox-android-sdk
-fabric-version=4.1.1
+fabric-version=5.0.0
fabric-build-type=binary
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml
index 59131d89fc..e6d118692e 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml
@@ -2,10 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mapbox.mapboxsdk.testapp">
- <uses-permission android:name="android.permission.INTERNET"/>
- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
- <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
@@ -617,8 +614,6 @@
<!-- <meta-data -->
<!-- android:name="com.mapbox.SetStorageExternal" -->
<!-- android:value="true" /> -->
-
- <service android:name="com.mapbox.services.android.telemetry.service.TelemetryService"/>
</application>
</manifest>
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java
index f2f82865d1..b8a008e592 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java
@@ -196,6 +196,13 @@ public class MarkerViewActivity extends AppCompatActivity {
// open infowindow offscreen markers
mapboxMap.selectMarker(markerRightOffScreen);
mapboxMap.selectMarker(markerRightBottomOffScreen);
+
+ mapboxMap.setOnMapClickListener(new MapboxMap.OnMapClickListener() {
+ @Override
+ public void onMapClick(@NonNull LatLng point) {
+ Toast.makeText(MarkerViewActivity.this, point.toString(), Toast.LENGTH_SHORT).show();
+ }
+ });
}
});
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/MaxMinZoomActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/MaxMinZoomActivity.java
index 86d5b47275..014743df96 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/MaxMinZoomActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/MaxMinZoomActivity.java
@@ -1,13 +1,18 @@
package com.mapbox.mapboxsdk.testapp.activity.camera;
import android.os.Bundle;
+import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
+import com.mapbox.mapboxsdk.constants.Style;
+import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.maps.MapView;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
import com.mapbox.mapboxsdk.testapp.R;
+import timber.log.Timber;
+
public class MaxMinZoomActivity extends AppCompatActivity implements OnMapReadyCallback {
private MapView mapView;
@@ -25,10 +30,21 @@ public class MaxMinZoomActivity extends AppCompatActivity implements OnMapReadyC
}
@Override
- public void onMapReady(MapboxMap map) {
+ public void onMapReady(final MapboxMap map) {
mapboxMap = map;
mapboxMap.setMinZoomPreference(3);
mapboxMap.setMaxZoomPreference(5);
+ mapboxMap.setOnMapClickListener(new MapboxMap.OnMapClickListener() {
+ @Override
+ public void onMapClick(@NonNull LatLng point) {
+ map.setStyle(Style.OUTDOORS, new MapboxMap.OnStyleLoadedListener() {
+ @Override
+ public void onStyleLoaded(String style) {
+ Timber.d("Style Loaded %s", style);
+ }
+ });
+ }
+ });
}
@Override
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java
index 6ec0ccc11f..18d6fadcb8 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java
@@ -5,7 +5,9 @@ import android.support.annotation.NonNull;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
+import android.widget.TextView;
+import com.mapbox.mapboxsdk.camera.CameraPosition;
import com.mapbox.mapboxsdk.constants.Style;
import com.mapbox.mapboxsdk.maps.MapView;
import com.mapbox.mapboxsdk.maps.MapboxMap;
@@ -47,9 +49,21 @@ public class DebugModeActivity extends AppCompatActivity {
@Override
public void onMapReady(@NonNull MapboxMap map) {
mapboxMap = map;
+
+ mapboxMap.getUiSettings().setZoomControlsEnabled(true);
+
+ // show current zoom level on screen
+ final TextView textView = (TextView) findViewById(R.id.textZoom);
+ mapboxMap.setOnCameraChangeListener(new MapboxMap.OnCameraChangeListener() {
+ @Override
+ public void onCameraChange(CameraPosition position) {
+ textView.setText(String.format(getString(R.string.debug_zoom), position.zoom));
+ }
+ });
}
});
+
FloatingActionButton fabDebug = (FloatingActionButton) findViewById(R.id.fabDebug);
fabDebug.setOnClickListener(new View.OnClickListener() {
@Override
@@ -70,7 +84,12 @@ public class DebugModeActivity extends AppCompatActivity {
if (currentStyleIndex == STYLES.length) {
currentStyleIndex = 0;
}
- mapboxMap.setStyleUrl(STYLES[currentStyleIndex]);
+ mapboxMap.setStyleUrl(STYLES[currentStyleIndex], new MapboxMap.OnStyleLoadedListener() {
+ @Override
+ public void onStyleLoaded(String style) {
+ Timber.d("Style loaded %s", style);
+ }
+ });
}
}
});
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_debug_mode.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_debug_mode.xml
index ffbf2e30a1..6db8b073d9 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_debug_mode.xml
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_debug_mode.xml
@@ -10,7 +10,18 @@
<com.mapbox.mapboxsdk.maps.MapView
android:id="@+id/mapView"
android:layout_width="match_parent"
- android:layout_height="match_parent"/>
+ android:layout_height="match_parent"
+ app:mapbox_uiAttribution="false"
+ app:mapbox_uiCompass="false"
+ app:mapbox_uiLogo="false"/>
+
+ <TextView
+ android:id="@+id/textZoom"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom|start"
+ android:layout_margin="8dp"
+ android:textSize="14sp"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fabDebug"
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/strings.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/strings.xml
index 56ac712cf8..f15ee20be6 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/strings.xml
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/strings.xml
@@ -162,4 +162,5 @@
<string name="dynamic_marker_chelsea_snippet">Stamford Bridge</string>
<string name="dynamic_marker_arsenal_title">Arsenal</string>
<string name="dynamic_marker_arsenal_snippet">Emirates Stadium</string>
+ <string name="debug_zoom">Zoom: %s</string>
</resources>
diff --git a/platform/android/bitrise.yml b/platform/android/bitrise.yml
index 6e1f9a0d19..53637fd498 100644
--- a/platform/android/bitrise.yml
+++ b/platform/android/bitrise.yml
@@ -164,8 +164,7 @@ workflows:
mkdir -p "${ANDROID_HOME}/licenses"
echo "8933bad161af4178b1185d1a37fbf41ea5269c55" > "${ANDROID_HOME}/licenses/android-sdk-license"
echo "Compile libmapbox-gl.so for all supportd abi's:"
- export BUILDTYPE=Release
- make apackage
+ export BUILDTYPE=Release make apackage
- script:
title: Publish to maven
inputs:
diff --git a/platform/android/dependencies.gradle b/platform/android/dependencies.gradle
index 3eb28452c6..c4ace641c3 100644
--- a/platform/android/dependencies.gradle
+++ b/platform/android/dependencies.gradle
@@ -16,9 +16,9 @@ ext {
dep = [
// mapbox
- mapboxJavaServices : 'com.mapbox.mapboxsdk:mapbox-java-services:2.0.0-beta.2@jar',
- mapboxJavaGeoJSON : 'com.mapbox.mapboxsdk:mapbox-java-geojson:2.0.0-beta.2@jar',
- mapboxAndroidTelemetry : 'com.mapbox.mapboxsdk:mapbox-android-telemetry:2.0.0-beta.2@aar',
+ mapboxJavaServices : 'com.mapbox.mapboxsdk:mapbox-java-services:2.0.0@jar',
+ mapboxJavaGeoJSON : 'com.mapbox.mapboxsdk:mapbox-java-geojson:2.0.0@jar',
+ mapboxAndroidTelemetry : 'com.mapbox.mapboxsdk:mapbox-android-telemetry:2.0.0@aar',
// mapzen lost
lost : 'com.mapzen.android:lost:2.1.2',
diff --git a/platform/android/src/native_map_view.cpp b/platform/android/src/native_map_view.cpp
index 1bdba67000..af8ae16bf6 100755
--- a/platform/android/src/native_map_view.cpp
+++ b/platform/android/src/native_map_view.cpp
@@ -459,8 +459,8 @@ jni::jdouble NativeMapView::getScale(jni::JNIEnv&) {
return map->getScale();
}
-void NativeMapView::setZoom(jni::JNIEnv&, jni::jdouble zoom, jni::jlong duration) {
- map->setZoom(zoom, mbgl::AnimationOptions{mbgl::Milliseconds(duration)});
+void NativeMapView::setZoom(jni::JNIEnv&, jni::jdouble zoom, jni::jdouble x, jni::jdouble y, jni::jlong duration) {
+ map->setZoom(zoom, mbgl::ScreenCoordinate{x,y}, mbgl::AnimationOptions{mbgl::Milliseconds(duration)});
}
jni::jdouble NativeMapView::getZoom(jni::JNIEnv&) {
diff --git a/platform/android/src/native_map_view.hpp b/platform/android/src/native_map_view.hpp
index c762c04df3..fbfe69040e 100755
--- a/platform/android/src/native_map_view.hpp
+++ b/platform/android/src/native_map_view.hpp
@@ -133,7 +133,7 @@ public:
jni::jdouble getScale(jni::JNIEnv&);
- void setZoom(jni::JNIEnv&, jni::jdouble, jni::jlong);
+ void setZoom(jni::JNIEnv&, jni::jdouble, jni::jdouble, jni::jdouble, jni::jlong);
jni::jdouble getZoom(jni::JNIEnv&);
diff --git a/platform/darwin/docs/guides/Data-Driven Styling.md.ejs b/platform/darwin/docs/guides/Data-Driven Styling.md.ejs
new file mode 100644
index 0000000000..820f71f594
--- /dev/null
+++ b/platform/darwin/docs/guides/Data-Driven Styling.md.ejs
@@ -0,0 +1,160 @@
+
+<%
+ const os = locals.os;
+ const iOS = os === 'iOS';
+ const macOS = os === 'macOS';
+ const cocoaPrefix = iOS ? 'UI' : 'NS';
+-%>
+<!--
+ This file is generated.
+ Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
+-->
+
+# Data-Driven Styling
+
+Mapbox’s data-driven styling features allow you to use data properties to style your maps. You can style map features automatically based on their individual attributes.
+
+Vary POI icons, transit route line colors, city polygon opacity, and more based on any attribute in your data. Need to visualize hotel data by price? You can have your map’s point radii and colors change automatically with your data.
+
+![available bikes](img/data-driven-styling/citibikes.png) ![subway lines](img/data-driven-styling/polylineExample.png)
+
+# How to use Data-Driven Styling
+This guide uses earthquake data from the [U.S. Geological Survey](https://earthquake.usgs.gov/earthquakes/feed/v1.0/geojson.php) to style a map based on attributes. For more information about how to work with GeoJSON data in our iOS SDK, please see our [working with GeoJSON data](working-with-geojson-data.html) guide.
+
+`MGLStyleFunction`
+
+There are three subclasses of `MGLStyleFunction`:
+
+* `MGLCameraStyleFunction` - For a style value that changes with zoom level. For example, you can make the radius of a circle increase according to zoom level.
+* `MGLSourceStyleFunction` - For a style value that changes with the attributes of a feature. For example, you can adjust the radius of a circle based on the magnitude of an earthquake.
+* `MGLCompositeStyleFunction` - For a style value that changes with both zoom level and attribute values. For example, you can add a circle layer where each circle has a radius based on both zoom level and the magnitude of an earthquake.
+
+The documentation for individual style properties will note which style functions are enabled for that property.
+
+## Stops
+
+Stops are key-value pairs that that determine a style value. With a `MGLCameraSourceFunction` stop, you can use a dictionary with a zoom level for a key and a `MGLStyleValue` for the value. For example, you can use a stops dictionary with zoom levels 0, 10, and 20 as keys, and yellow, orange, and red as the values. A `MGLSourceStyleFunction` uses the relevant attribute value as the key.
+
+```swift
+let stops = [0: MGLStyleValue(rawValue: UIColor.yellow),
+ 2.5: MGLStyleValue(rawValue: UIColor.orange),
+ 5: MGLStyleValue(rawValue: UIColor.red),
+ 7.5: MGLStyleValue(rawValue: UIColor.blue),
+ 10: MGLStyleValue(rawValue: UIColor.white)]
+```
+
+## Interpolation Mode
+
+The effect a key has on the style value is determined by the interpolation mode. There are four interpolation modes that can be used with a source style function: exponential, interval, categorical, and identity. You can also use exponential and interval interpolation modes with a camera style function.
+
+### Linear
+
+`MGLInterpolationModelExponential` interpolates linearly or exponentially between style function stop values. By default, the `MGLStyleFunction` options parameter `MGLStyleFunctionOptionInterpolationBase` equals `1`, which represents linear interpolation, and doesn’t need to be included in the options dictionary.
+
+The stops dictionary below, for example, shows colors that continuously shift from yellow to orange to red to blue to white based on the attribute value.
+
+``` swift
+let url = URL(string: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_week.geojson")
+let symbolSource = MGLSource(identifier: "source")
+let symbolLayer = MGLSymbolStyleLayer(identifier: "place-city-sm", source: symbolSource)
+
+let source = MGLShapeSource(identifier: "earthquakes", url: url, options: nil)
+style.addSource(source)
+
+let stops = [0: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.yellow),
+ 2.5: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.orange),
+ 5: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.red),
+ 7.5: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.blue),
+ 10: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.white)]
+
+let layer = MGLCircleStyleLayer(identifier: "circles", source: source)
+layer.circleColor = MGLStyleValue(interpolationMode: .exponential,
+ sourceStops: stops,
+ attributeName: "mag",
+ options: [.defaultValue: MGLStyleValue<<%- cocoaPrefix %>Color>(rawValue: .green)])
+layer.circleRadius = MGLStyleValue(rawValue: 10)
+style.insertLayer(layer, below: symbolLayer)
+```
+
+![exponential mode](img/data-driven-styling/exponential.png)
+
+### Exponential
+
+`MGLInterpolationModelExponential` combined with any `MGLStyleFunctionOptionInterpolationBase` greater than `0`, you can interpolate between values exponentially, create an accelerated ramp effect.
+
+Here’s a visualization from Mapbox Studio (see [Working with Mapbox Studio](working-with-mapbox-studio.html)) comparing interpolation base values of `1.5` and `0.5` based on zoom.
+
+<img src="img/data-driven-styling/exponential-function.png" height=344/>
+<img src="img/data-driven-styling/exponential-function-1.png" height=344/>
+
+The example below increases a layer’s `circleRadius` exponentially based on a map’s zoom level. The `MGLStyleFunctionOptionInterpolationBase` is `1.5`.
+
+```swift
+let stops = [12: MGLStyleValue(rawValue: 0.5),
+ 14: MGLStyleValue(rawValue: 2),
+ 18: MGLStyleValue(rawValue: 18)]
+
+layer.circleRadius = MGLStyleValue(interpolationMode: .exponential,
+ cameraStops: stops,
+ options: [.interpolationBase: 1.5])
+```
+
+### Interval
+
+`MGLInterpolationModeInterval` creates a range using the keys from the stops dictionary. The range is from the given key to just less than the next key. The attribute values that fall into that range are then styled using the style value assigned to that key.
+
+When we use the stops dictionary given above with an interval interpolation mode, we create ranges where earthquakes with a magnitude of 0 to just less than 2.5 would be yellow, 2.5 to just less than 5 would be orange, and so on.
+
+``` swift
+let stops = [0: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.yellow),
+ 2.5: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.orange),
+ 5: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.red),
+ 7.5: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.blue),
+ 10: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.white)]
+
+layer.circleColor = MGLStyleValue(interpolationMode: .interval,
+ sourceStops: stops,
+ attributeName: "mag",
+ options: [.defaultValue: MGLStyleValue<<%- cocoaPrefix %>Color>(rawValue: .green)])
+```
+
+![interval mode](img/data-driven-styling/interval.png)
+
+### Categorical
+
+Returns the output value that is equal to the stop for the function input. We’re going to use a different stops dictionary than we did for the previous two modes.
+
+There are three main types of events in the dataset: earthquakes, explosions, and quarry blasts. In this case, the color of the circle layer will be determined by the type of event, with a default value of green to catch any events that do not fall into any of those categories.
+
+``` swift
+let categoricalStops = ["earthquake": MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.orange),
+ "explosion": MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.red),
+ "quarry blast": MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.yellow)]
+
+layer.circleColor = MGLStyleValue(interpolationMode: .categorical,
+ sourceStops: categoricalStops,
+ attributeName: "type",
+ options: [.defaultValue: MGLStyleValue(rawValue: <%- cocoaPrefix %>Color.blue)])
+
+```
+
+![categorical mode](img/data-driven-styling/categorical1.png) ![categorical mode](img/data-driven-styling/categorical2.png)
+
+### Identity
+
+`MGLInterpolationModeIdentity` uses the attribute’s value as the style value. For example, you can set the `circleRadius` to the earthquake’s magnitude. Since the attribute value itself will be used as the style value, `sourceStops` should be set to `nil`.
+
+``` swift
+layer.circleRadius = MGLStyleValue(interpolationMode: .identity,
+ sourceStops: nil,
+ attributeName: "mag",
+ options: [.defaultValue: MGLStyleValue<NSNumber>(rawValue: 0)])
+
+```
+
+![identity mode](img/data-driven-styling/identity.png)
+
+##Resources
+
+* [USGS](https://earthquake.usgs.gov/earthquakes/feed/v1.0/geojson.php)
+* [For Style Authors](for-style-authors.html)
diff --git a/platform/darwin/docs/guides/For Style Authors.md.ejs b/platform/darwin/docs/guides/For Style Authors.md.ejs
index 254a7cf219..92ce4c1594 100644
--- a/platform/darwin/docs/guides/For Style Authors.md.ejs
+++ b/platform/darwin/docs/guides/For Style Authors.md.ejs
@@ -8,7 +8,7 @@
-%>
<!--
This file is generated.
- Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+ Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
-->
# Information for Style Authors
@@ -41,7 +41,7 @@ underneath.
<% if (iOS) { -%>
The user location annotation view, the attribution button, any buttons in
callout views, and any items in the navigation bar are influenced by your
-application’s tint color, so choose a tint color that constrasts well with your
+application’s tint color, so choose a tint color that contrasts well with your
map style.
<% } -%>
If you intend your style to be used in the dark, consider the impact that Night
@@ -160,6 +160,7 @@ In the style specification | In the SDK
---------------------------|---------
class | style class
filter | predicate
+function type | interpolation mode
id | identifier
image | style image
layer | style layer
@@ -239,6 +240,30 @@ whose names differ from the style specification are listed below:
<% for (const type in renamedProperties) { -%>
<% if (renamedProperties.hasOwnProperty(type)) { -%>
+### <%- camelize(type) %> style functions
+
+The runtime styling API introduces `MGLStyleFunction` to the <%- os %> SDK.
+[Data-driven styling](data-driven-styling.html) expands `MGLStyleFunction`.
+Individual style property documentation includes which subclasses of
+`MGLStyleFunction` are enabled for that property. You can use `MGLStyleValue`
+methods to create a `MGLStyleFunction`.
+
+In style specification | In the SDK | [MGLStyleValue valueWithInterpolationMode:...]
+-----------------------|-------------------------------|-------------
+`zoom function` | `MGLCameraStyleFunction` | `cameraStops:options:`
+`property function` | `MGLSourceStyleFunction` | `sourceStops:attributeName:options:`
+`zoom-and-property functions`| `MGLCompositeStyleFunction` | `compositeStops:attributeName:options:`
+
+Data-driven styling also introduces interpolation mode, which defines the
+relationship between style values and attributes or zoom levels.
+
+In style specification | In the SDK
+-----------------------------|-----------
+`exponential` | `MGLInterpolationModeExponential`
+`interval` | `MGLInterpolationModeInterval`
+`categorical` | `MGLInterpolationModeCategorical`
+`identity` | `MGLInterpolationModeIdentity`
+
### <%- camelize(type) %> style layers
In style JSON | In Objective-C | In Swift
@@ -254,7 +279,7 @@ In style JSON | In Objective-C | In Swift
## Setting attribute values
Each property representing a layout or paint attribute is set to an
-`MGLStyleValue` object, which is either an `MGLStyleConstantValue` object (for
+`MGLStyleValue` object, which is either an `MGLConstantStyleValue` object (for
constant values) or an `MGLStyleFunction` object (for zoom level functions). The
style value object is a container for the raw value or function parameters that
you want the attribute to be set to.
diff --git a/platform/darwin/resources/ca.lproj/Foundation.strings b/platform/darwin/resources/ca.lproj/Foundation.strings
new file mode 100644
index 0000000000..e36ea9ed8a
--- /dev/null
+++ b/platform/darwin/resources/ca.lproj/Foundation.strings
@@ -0,0 +1,291 @@
+/* Clock position format, long: {hours} o’clock */
+"CLOCK_FMT_LONG" = "%@ en punt";
+
+/* Clock position format, medium: {hours} o’clock */
+"CLOCK_FMT_MEDIUM" = "%@ en punt";
+
+/* Clock position format, short: {hours}:00 */
+"CLOCK_FMT_SHORT" = "%@:00";
+
+/* East, long */
+"COMPASS_E_LONG" = "est";
+
+/* East, short */
+"COMPASS_E_SHORT" = "E";
+
+/* East by north, long */
+"COMPASS_EbN_LONG" = "est per nord";
+
+/* East by north, short */
+"COMPASS_EbN_SHORT" = "EpN";
+
+/* East by south, long */
+"COMPASS_EbS_LONG" = "est per sud";
+
+/* East by south, short */
+"COMPASS_EbS_SHORT" = "EpS";
+
+/* East-northeast, long */
+"COMPASS_ENE_LONG" = "est-nord-est";
+
+/* East-northeast, short */
+"COMPASS_ENE_SHORT" = "ENE";
+
+/* East-southeast, long */
+"COMPASS_ESE_LONG" = "est-sud-est";
+
+/* East-southeast, short */
+"COMPASS_ESE_SHORT" = "ESE";
+
+/* North, long */
+"COMPASS_N_LONG" = "nord";
+
+/* North, short */
+"COMPASS_N_SHORT" = "N";
+
+/* North by east, long */
+"COMPASS_NbE_LONG" = "nord per est";
+
+/* North by east, short */
+"COMPASS_NbE_SHORT" = "NpE";
+
+/* North by west, long */
+"COMPASS_NbW_LONG" = "nord per oest";
+
+/* North by west, short */
+"COMPASS_NbW_SHORT" = "NpO";
+
+/* Northeast, long */
+"COMPASS_NE_LONG" = "nord-est";
+
+/* Northeast, short */
+"COMPASS_NE_SHORT" = "NE";
+
+/* Northeast by east, long */
+"COMPASS_NEbE_LONG" = "nord-est per est";
+
+/* Northeast by east, short */
+"COMPASS_NEbE_SHORT" = "NEpE";
+
+/* Northeast by north, long */
+"COMPASS_NEbN_LONG" = "nord-est per nord";
+
+/* Northeast by north, short */
+"COMPASS_NEbN_SHORT" = "NEpN";
+
+/* North-northeast, long */
+"COMPASS_NNE_LONG" = "nord-nord-est";
+
+/* North-northeast, short */
+"COMPASS_NNE_SHORT" = "NNE";
+
+/* North-northwest, long */
+"COMPASS_NNW_LONG" = "nord-nord-oest";
+
+/* North-northwest, short */
+"COMPASS_NNW_SHORT" = "NNO";
+
+/* Northwest, long */
+"COMPASS_NW_LONG" = "nord-oest";
+
+/* Northwest, short */
+"COMPASS_NW_SHORT" = "NO";
+
+/* Northwest by north, long */
+"COMPASS_NWbN_LONG" = "nord-oest per nord";
+
+/* Northwest by north, short */
+"COMPASS_NWbN_SHORT" = "NOpN";
+
+/* Northwest by west, long */
+"COMPASS_NWbW_LONG" = "nord-oest per oest";
+
+/* Northwest by west, short */
+"COMPASS_NWbW_SHORT" = "NOpO";
+
+/* South, long */
+"COMPASS_S_LONG" = "sud";
+
+/* South, short */
+"COMPASS_S_SHORT" = "S";
+
+/* South by east, long */
+"COMPASS_SbE_LONG" = "sud per est";
+
+/* South by east, short */
+"COMPASS_SbE_SHORT" = "SpE";
+
+/* South by west, long */
+"COMPASS_SbW_LONG" = "sud per oest";
+
+/* South by west, short */
+"COMPASS_SbW_SHORT" = "SpO";
+
+/* Southeast, long */
+"COMPASS_SE_LONG" = "sud-est";
+
+/* Southeast, short */
+"COMPASS_SE_SHORT" = "SE";
+
+/* Southeast by east, long */
+"COMPASS_SEbE_LONG" = "sud-est per est";
+
+/* Southeast by east, short */
+"COMPASS_SEbE_SHORT" = "SEpE";
+
+/* Southeast by south, long */
+"COMPASS_SEbS_LONG" = "sud-est per sud";
+
+/* Southeast by south, short */
+"COMPASS_SEbS_SHORT" = "SEpS";
+
+/* South-southeast, long */
+"COMPASS_SSE_LONG" = "sud-sud-est";
+
+/* South-southeast, short */
+"COMPASS_SSE_SHORT" = "SSE";
+
+/* South-southwest, long */
+"COMPASS_SSW_LONG" = "sud-sud-oest";
+
+/* South-southwest, short */
+"COMPASS_SSW_SHORT" = "SSO";
+
+/* Southwest, long */
+"COMPASS_SW_LONG" = "sud-oest";
+
+/* Southwest, short */
+"COMPASS_SW_SHORT" = "SO";
+
+/* Southwest by south, long */
+"COMPASS_SWbS_LONG" = "sud-oest per sud";
+
+/* Southwest by south, short */
+"COMPASS_SWbS_SHORT" = "SOpS";
+
+/* Southwest by west, long */
+"COMPASS_SWbW_LONG" = "sud-oest per oest";
+
+/* Southwest by west, short */
+"COMPASS_SWbW_SHORT" = "SOpO";
+
+/* West, long */
+"COMPASS_W_LONG" = "oest";
+
+/* West, short */
+"COMPASS_W_SHORT" = "O";
+
+/* West by north, long */
+"COMPASS_WbN_LONG" = "oest per nord";
+
+/* West by north, short */
+"COMPASS_WbN_SHORT" = "OpN";
+
+/* West by south, long */
+"COMPASS_WbS_LONG" = "oest per sud";
+
+/* West by south, short */
+"COMPASS_WbS_SHORT" = "OpS";
+
+/* West-northwest, long */
+"COMPASS_WNW_LONG" = "oest-nord-oest";
+
+/* West-northwest, short */
+"COMPASS_WNW_SHORT" = "ONO";
+
+/* West-southwest, long */
+"COMPASS_WSW_LONG" = "oest-sud-oest";
+
+/* West-southwest, short */
+"COMPASS_WSW_SHORT" = "OSO";
+
+/* Degrees format, long */
+"COORD_DEG_LONG" = "%d grau(s)";
+
+/* Degrees format, medium: {degrees} */
+"COORD_DEG_MEDIUM" = "%d°";
+
+/* Degrees format, short: {degrees} */
+"COORD_DEG_SHORT" = "%d°";
+
+/* Coordinate format, long: {degrees}{minutes} */
+"COORD_DM_LONG" = "%1$@ i %2$@";
+
+/* Coordinate format, medium: {degrees}{minutes} */
+"COORD_DM_MEDIUM" = "%1$@%2$@";
+
+/* Coordinate format, short: {degrees}{minutes} */
+"COORD_DM_SHORT" = "%1$@%2$@";
+
+/* Coordinate format, long: {degrees}{minutes}{seconds} */
+"COORD_DMS_LONG" = "%1$@, %2$@, i %3$@";
+
+/* Coordinate format, medium: {degrees}{minutes}{seconds} */
+"COORD_DMS_MEDIUM" = "%1$@%2$@%3$@";
+
+/* Coordinate format, short: {degrees}{minutes}{seconds} */
+"COORD_DMS_SHORT" = "%1$@%2$@%3$@";
+
+/* East longitude format, long: {longitude} */
+"COORD_E_LONG" = "%@ est";
+
+/* East longitude format, medium: {longitude} */
+"COORD_E_MEDIUM" = "%@ est";
+
+/* East longitude format, short: {longitude} */
+"COORD_E_SHORT" = "%@E";
+
+/* Coordinate pair format, long: {latitude}, {longitude} */
+"COORD_FMT_LONG" = "%1$@ per %2$@";
+
+/* Coordinate pair format, medium: {latitude}, {longitude} */
+"COORD_FMT_MEDIUM" = "%1$@, %2$@";
+
+/* Coordinate pair format, short: {latitude}, {longitude} */
+"COORD_FMT_SHORT" = "%1$@, %2$@";
+
+/* Minutes format, long */
+"COORD_MIN_LONG" = "%d minut(s)";
+
+/* Minutes format, medium: {minutes} */
+"COORD_MIN_MEDIUM" = "%d′";
+
+/* Minutes format, short: {minutes} */
+"COORD_MIN_SHORT" = "%d′";
+
+/* North latitude format, long: {latitude} */
+"COORD_N_LONG" = "%@ nord";
+
+/* North latitude format, medium: {latitude} */
+"COORD_N_MEDIUM" = "%@ nord";
+
+/* North latitude format, short: {latitude} */
+"COORD_N_SHORT" = "%@N";
+
+/* South latitude format, long: {latitude} */
+"COORD_S_LONG" = "%@ sud";
+
+/* South latitude format, medium: {latitude} */
+"COORD_S_MEDIUM" = "%@ sud";
+
+/* South latitude format, short: {latitude} */
+"COORD_S_SHORT" = "%@S";
+
+/* Seconds format, long */
+"COORD_SEC_LONG" = "%d segon(s)";
+
+/* Seconds format, medium: {seconds} */
+"COORD_SEC_MEDIUM" = "%d″";
+
+/* Seconds format, short: {seconds} */
+"COORD_SEC_SHORT" = "%d″";
+
+/* West longitude format, long: {longitude} */
+"COORD_W_LONG" = "%@ oest";
+
+/* West longitude format, medium: {longitude} */
+"COORD_W_MEDIUM" = "%@ oest";
+
+/* West longitude format, short: {longitude} */
+"COORD_W_SHORT" = "%@O";
+
diff --git a/platform/darwin/resources/ca.lproj/Foundation.stringsdict b/platform/darwin/resources/ca.lproj/Foundation.stringsdict
new file mode 100644
index 0000000000..8bacec946f
--- /dev/null
+++ b/platform/darwin/resources/ca.lproj/Foundation.stringsdict
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>COORD_DEG_LONG</key>
+ <dict>
+ <key>NSStringLocalizedFormatKey</key>
+ <string>%#@degrees@</string>
+ <key>degrees</key>
+ <dict>
+ <key>NSStringFormatSpecTypeKey</key>
+ <string>NSStringPluralRuleType</string>
+ <key>NSStringFormatValueTypeKey</key>
+ <string>d</string>
+ <key>one</key>
+ <string>%d grau</string>
+ <key>other</key>
+ <string>%d graus</string>
+ </dict>
+ </dict>
+ <key>COORD_MIN_LONG</key>
+ <dict>
+ <key>NSStringLocalizedFormatKey</key>
+ <string>%#@minutes@</string>
+ <key>minutes</key>
+ <dict>
+ <key>NSStringFormatSpecTypeKey</key>
+ <string>NSStringPluralRuleType</string>
+ <key>NSStringFormatValueTypeKey</key>
+ <string>d</string>
+ <key>one</key>
+ <string>%d minut</string>
+ <key>other</key>
+ <string>%d minuts</string>
+ </dict>
+ </dict>
+ <key>COORD_SEC_LONG</key>
+ <dict>
+ <key>NSStringLocalizedFormatKey</key>
+ <string>%#@seconds@</string>
+ <key>seconds</key>
+ <dict>
+ <key>NSStringFormatSpecTypeKey</key>
+ <string>NSStringPluralRuleType</string>
+ <key>NSStringFormatValueTypeKey</key>
+ <string>d</string>
+ <key>one</key>
+ <string>%d segon</string>
+ <key>other</key>
+ <string>%d segons</string>
+ </dict>
+ </dict>
+</dict>
+</plist>
diff --git a/platform/darwin/resources/lt.lproj/Foundation.strings b/platform/darwin/resources/lt.lproj/Foundation.strings
new file mode 100644
index 0000000000..68e7e14bda
--- /dev/null
+++ b/platform/darwin/resources/lt.lproj/Foundation.strings
@@ -0,0 +1,291 @@
+/* Clock position format, long: {hours} o’clock */
+"CLOCK_FMT_LONG" = "Laikas: %@";
+
+/* Clock position format, medium: {hours} o’clock */
+"CLOCK_FMT_MEDIUM" = "Laikas: %@";
+
+/* Clock position format, short: {hours}:00 */
+"CLOCK_FMT_SHORT" = "%@:00";
+
+/* East, long */
+"COMPASS_E_LONG" = "rytai";
+
+/* East, short */
+"COMPASS_E_SHORT" = "R";
+
+/* East by north, long */
+"COMPASS_EbN_LONG" = "rytai į šiaurę";
+
+/* East by north, short */
+"COMPASS_EbN_SHORT" = "RįŠ";
+
+/* East by south, long */
+"COMPASS_EbS_LONG" = "rytai į pietus";
+
+/* East by south, short */
+"COMPASS_EbS_SHORT" = "RįP";
+
+/* East-northeast, long */
+"COMPASS_ENE_LONG" = "rytai - šiaurės rytai";
+
+/* East-northeast, short */
+"COMPASS_ENE_SHORT" = "R-ŠR";
+
+/* East-southeast, long */
+"COMPASS_ESE_LONG" = "rytai - pietryčiai";
+
+/* East-southeast, short */
+"COMPASS_ESE_SHORT" = "R-PR";
+
+/* North, long */
+"COMPASS_N_LONG" = "šiaurė";
+
+/* North, short */
+"COMPASS_N_SHORT" = "Š";
+
+/* North by east, long */
+"COMPASS_NbE_LONG" = "šiaurė į rytus";
+
+/* North by east, short */
+"COMPASS_NbE_SHORT" = "ŠįR";
+
+/* North by west, long */
+"COMPASS_NbW_LONG" = "šiaurė į vakarus";
+
+/* North by west, short */
+"COMPASS_NbW_SHORT" = "ŠįV";
+
+/* Northeast, long */
+"COMPASS_NE_LONG" = "šiaurės rytai";
+
+/* Northeast, short */
+"COMPASS_NE_SHORT" = "ŠR";
+
+/* Northeast by east, long */
+"COMPASS_NEbE_LONG" = "šiaurės rytai į rytus";
+
+/* Northeast by east, short */
+"COMPASS_NEbE_SHORT" = "ŠRįR";
+
+/* Northeast by north, long */
+"COMPASS_NEbN_LONG" = "šiaurės rytai į šiaurę";
+
+/* Northeast by north, short */
+"COMPASS_NEbN_SHORT" = "ŠRįŠ";
+
+/* North-northeast, long */
+"COMPASS_NNE_LONG" = "šiaurė - šiaurės rytai";
+
+/* North-northeast, short */
+"COMPASS_NNE_SHORT" = "ŠŠR";
+
+/* North-northwest, long */
+"COMPASS_NNW_LONG" = "šiaurė - šiaurės vakarai";
+
+/* North-northwest, short */
+"COMPASS_NNW_SHORT" = "ŠŠV";
+
+/* Northwest, long */
+"COMPASS_NW_LONG" = "šiaurės vakarai";
+
+/* Northwest, short */
+"COMPASS_NW_SHORT" = "ŠV";
+
+/* Northwest by north, long */
+"COMPASS_NWbN_LONG" = "šiaurės vakarai į šiaurę";
+
+/* Northwest by north, short */
+"COMPASS_NWbN_SHORT" = "ŠVįŠ";
+
+/* Northwest by west, long */
+"COMPASS_NWbW_LONG" = "šiaurės vakarai į vakarus";
+
+/* Northwest by west, short */
+"COMPASS_NWbW_SHORT" = "ŠVįV";
+
+/* South, long */
+"COMPASS_S_LONG" = "pietūs";
+
+/* South, short */
+"COMPASS_S_SHORT" = "P";
+
+/* South by east, long */
+"COMPASS_SbE_LONG" = "pietūs į rytus";
+
+/* South by east, short */
+"COMPASS_SbE_SHORT" = "PįR";
+
+/* South by west, long */
+"COMPASS_SbW_LONG" = "pietūs į vakarus";
+
+/* South by west, short */
+"COMPASS_SbW_SHORT" = "PįV";
+
+/* Southeast, long */
+"COMPASS_SE_LONG" = "pietryčiai";
+
+/* Southeast, short */
+"COMPASS_SE_SHORT" = "PR";
+
+/* Southeast by east, long */
+"COMPASS_SEbE_LONG" = "pietryčiai į rytus";
+
+/* Southeast by east, short */
+"COMPASS_SEbE_SHORT" = "PRįR";
+
+/* Southeast by south, long */
+"COMPASS_SEbS_LONG" = "pietryčiai į pietus";
+
+/* Southeast by south, short */
+"COMPASS_SEbS_SHORT" = "PRįP";
+
+/* South-southeast, long */
+"COMPASS_SSE_LONG" = "pietūs - pietryčiai";
+
+/* South-southeast, short */
+"COMPASS_SSE_SHORT" = "PPR";
+
+/* South-southwest, long */
+"COMPASS_SSW_LONG" = "pietūs - pietvakariai";
+
+/* South-southwest, short */
+"COMPASS_SSW_SHORT" = "PPV";
+
+/* Southwest, long */
+"COMPASS_SW_LONG" = "pietvakariai";
+
+/* Southwest, short */
+"COMPASS_SW_SHORT" = "PV";
+
+/* Southwest by south, long */
+"COMPASS_SWbS_LONG" = "pietvakariai į pietus";
+
+/* Southwest by south, short */
+"COMPASS_SWbS_SHORT" = "PVįP";
+
+/* Southwest by west, long */
+"COMPASS_SWbW_LONG" = "pietvakariai į vakarus";
+
+/* Southwest by west, short */
+"COMPASS_SWbW_SHORT" = "PVįV";
+
+/* West, long */
+"COMPASS_W_LONG" = "vakarai";
+
+/* West, short */
+"COMPASS_W_SHORT" = "V";
+
+/* West by north, long */
+"COMPASS_WbN_LONG" = "vakarai į šiaurę";
+
+/* West by north, short */
+"COMPASS_WbN_SHORT" = "VįŠ";
+
+/* West by south, long */
+"COMPASS_WbS_LONG" = "vakarai į pietus";
+
+/* West by south, short */
+"COMPASS_WbS_SHORT" = "VįP";
+
+/* West-northwest, long */
+"COMPASS_WNW_LONG" = "vakarai - šiaurės vakarai";
+
+/* West-northwest, short */
+"COMPASS_WNW_SHORT" = "VŠV";
+
+/* West-southwest, long */
+"COMPASS_WSW_LONG" = "vakarai - pietvakariai";
+
+/* West-southwest, short */
+"COMPASS_WSW_SHORT" = "VPV";
+
+/* Degrees format, long */
+"COORD_DEG_LONG" = "%d laipsniai(-ių)";
+
+/* Degrees format, medium: {degrees} */
+"COORD_DEG_MEDIUM" = "%d°";
+
+/* Degrees format, short: {degrees} */
+"COORD_DEG_SHORT" = "%d°";
+
+/* Coordinate format, long: {degrees}{minutes} */
+"COORD_DM_LONG" = "%1$@ ir %2$@";
+
+/* Coordinate format, medium: {degrees}{minutes} */
+"COORD_DM_MEDIUM" = "%1$@%2$@";
+
+/* Coordinate format, short: {degrees}{minutes} */
+"COORD_DM_SHORT" = "%1$@%2$@";
+
+/* Coordinate format, long: {degrees}{minutes}{seconds} */
+"COORD_DMS_LONG" = "%1$@, %2$@ ir %3$@";
+
+/* Coordinate format, medium: {degrees}{minutes}{seconds} */
+"COORD_DMS_MEDIUM" = "%1$@%2$@%3$@";
+
+/* Coordinate format, short: {degrees}{minutes}{seconds} */
+"COORD_DMS_SHORT" = "%1$@%2$@%3$@";
+
+/* East longitude format, long: {longitude} */
+"COORD_E_LONG" = "%@ ritų ilgumos";
+
+/* East longitude format, medium: {longitude} */
+"COORD_E_MEDIUM" = "%@ į rytus";
+
+/* East longitude format, short: {longitude} */
+"COORD_E_SHORT" = "%@R";
+
+/* Coordinate pair format, long: {latitude}, {longitude} */
+"COORD_FMT_LONG" = "%1$@, %2$@";
+
+/* Coordinate pair format, medium: {latitude}, {longitude} */
+"COORD_FMT_MEDIUM" = "%1$@, %2$@";
+
+/* Coordinate pair format, short: {latitude}, {longitude} */
+"COORD_FMT_SHORT" = "%1$@, %2$@";
+
+/* Minutes format, long */
+"COORD_MIN_LONG" = "%d minutė(s)";
+
+/* Minutes format, medium: {minutes} */
+"COORD_MIN_MEDIUM" = "%d′";
+
+/* Minutes format, short: {minutes} */
+"COORD_MIN_SHORT" = "%d′";
+
+/* North latitude format, long: {latitude} */
+"COORD_N_LONG" = "%@ šiaurės platumos";
+
+/* North latitude format, medium: {latitude} */
+"COORD_N_MEDIUM" = "%@ į šiaurę";
+
+/* North latitude format, short: {latitude} */
+"COORD_N_SHORT" = "%@Š";
+
+/* South latitude format, long: {latitude} */
+"COORD_S_LONG" = "%@ pietų platumos";
+
+/* South latitude format, medium: {latitude} */
+"COORD_S_MEDIUM" = "%@ į pietus";
+
+/* South latitude format, short: {latitude} */
+"COORD_S_SHORT" = "%@P";
+
+/* Seconds format, long */
+"COORD_SEC_LONG" = "%d sekundės(-ių)";
+
+/* Seconds format, medium: {seconds} */
+"COORD_SEC_MEDIUM" = "%d″";
+
+/* Seconds format, short: {seconds} */
+"COORD_SEC_SHORT" = "%d″";
+
+/* West longitude format, long: {longitude} */
+"COORD_W_LONG" = "%@ vakarų ilgumos";
+
+/* West longitude format, medium: {longitude} */
+"COORD_W_MEDIUM" = "%@ į vakarus";
+
+/* West longitude format, short: {longitude} */
+"COORD_W_SHORT" = "%@V";
+
diff --git a/platform/darwin/resources/lt.lproj/Foundation.stringsdict b/platform/darwin/resources/lt.lproj/Foundation.stringsdict
new file mode 100644
index 0000000000..e3bb31838a
--- /dev/null
+++ b/platform/darwin/resources/lt.lproj/Foundation.stringsdict
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>COORD_DEG_LONG</key>
+ <dict>
+ <key>NSStringLocalizedFormatKey</key>
+ <string>%#@degrees@</string>
+ <key>degrees</key>
+ <dict>
+ <key>NSStringFormatSpecTypeKey</key>
+ <string>NSStringPluralRuleType</string>
+ <key>NSStringFormatValueTypeKey</key>
+ <string>d</string>
+ <key>one</key>
+ <string>%d laipsniai</string>
+ <key>few</key>
+ <string>%d laipsniai</string>
+ <key>many</key>
+ <string>%d laipsniai</string>
+ <key>other</key>
+ <string>%d laipsnių</string>
+ </dict>
+ </dict>
+ <key>COORD_MIN_LONG</key>
+ <dict>
+ <key>NSStringLocalizedFormatKey</key>
+ <string>%#@minutes@</string>
+ <key>minutes</key>
+ <dict>
+ <key>NSStringFormatSpecTypeKey</key>
+ <string>NSStringPluralRuleType</string>
+ <key>NSStringFormatValueTypeKey</key>
+ <string>d</string>
+ <key>one</key>
+ <string>%d minutė</string>
+ <key>few</key>
+ <string>%d minutės</string>
+ <key>many</key>
+ <string>%d minutės</string>
+ <key>other</key>
+ <string>%d minučių</string>
+ </dict>
+ </dict>
+ <key>COORD_SEC_LONG</key>
+ <dict>
+ <key>NSStringLocalizedFormatKey</key>
+ <string>%#@seconds@</string>
+ <key>seconds</key>
+ <dict>
+ <key>NSStringFormatSpecTypeKey</key>
+ <string>NSStringPluralRuleType</string>
+ <key>NSStringFormatValueTypeKey</key>
+ <string>d</string>
+ <key>one</key>
+ <string>%d sekundė</string>
+ <key>few</key>
+ <string>%d sekundės</string>
+ <key>many</key>
+ <string>%d sekundės</string>
+ <key>other</key>
+ <string>%d sekundžių</string>
+ </dict>
+ </dict>
+</dict>
+</plist>
diff --git a/platform/darwin/resources/pl.lproj/Foundation.stringsdict b/platform/darwin/resources/pl.lproj/Foundation.stringsdict
index 016ba06b81..5a4f208562 100644
--- a/platform/darwin/resources/pl.lproj/Foundation.stringsdict
+++ b/platform/darwin/resources/pl.lproj/Foundation.stringsdict
@@ -18,6 +18,8 @@
<string>%d stopnie</string>
<key>many</key>
<string>%d stopni</string>
+ <key>other</key>
+ <string>%d stopnia</string>
</dict>
</dict>
<key>COORD_MIN_LONG</key>
@@ -36,6 +38,8 @@
<string>%d minuty</string>
<key>many</key>
<string>%d minut</string>
+ <key>other</key>
+ <string>%d minuty</string>
</dict>
</dict>
<key>COORD_SEC_LONG</key>
@@ -54,6 +58,8 @@
<string>%d sekundy</string>
<key>many</key>
<string>%d sekund</string>
+ <key>other</key>
+ <string>%d sekundy</string>
</dict>
</dict>
</dict>
diff --git a/platform/darwin/resources/ru.lproj/Foundation.stringsdict b/platform/darwin/resources/ru.lproj/Foundation.stringsdict
index b2d7467fd4..337cea0164 100644
--- a/platform/darwin/resources/ru.lproj/Foundation.stringsdict
+++ b/platform/darwin/resources/ru.lproj/Foundation.stringsdict
@@ -18,6 +18,8 @@
<string>%d градуса</string>
<key>many</key>
<string>%d градусов</string>
+ <key>other</key>
+ <string>%d градуса</string>
</dict>
</dict>
<key>COORD_MIN_LONG</key>
@@ -36,6 +38,8 @@
<string>%d минуты</string>
<key>many</key>
<string>%d минут</string>
+ <key>other</key>
+ <string>%d минуты</string>
</dict>
</dict>
<key>COORD_SEC_LONG</key>
@@ -54,6 +58,8 @@
<string>%d секунды</string>
<key>many</key>
<string>%d секунд</string>
+ <key>other</key>
+ <string>%d секунды</string>
</dict>
</dict>
</dict>
diff --git a/platform/darwin/resources/uk.lproj/Foundation.stringsdict b/platform/darwin/resources/uk.lproj/Foundation.stringsdict
index 76dbbfc5e9..f35f0516e1 100644
--- a/platform/darwin/resources/uk.lproj/Foundation.stringsdict
+++ b/platform/darwin/resources/uk.lproj/Foundation.stringsdict
@@ -18,6 +18,8 @@
<string>%d градуси</string>
<key>many</key>
<string>%d градусів</string>
+ <key>other</key>
+ <string>%d градуса</string>
</dict>
</dict>
<key>COORD_MIN_LONG</key>
@@ -31,11 +33,13 @@
<key>NSStringFormatValueTypeKey</key>
<string>d</string>
<key>one</key>
- <string>%d хвилина</string>
+ <string>%d мінута</string>
<key>few</key>
- <string>%d хвилини</string>
+ <string>%d мінути</string>
<key>many</key>
- <string>%d хвилин</string>
+ <string>%d мінут</string>
+ <key>other</key>
+ <string>%d мінути</string>
</dict>
</dict>
<key>COORD_SEC_LONG</key>
@@ -54,6 +58,8 @@
<string>%d секунди</string>
<key>many</key>
<string>%d секунд</string>
+ <key>other</key>
+ <string>%d секунди</string>
</dict>
</dict>
</dict>
diff --git a/platform/darwin/scripts/generate-style-code.js b/platform/darwin/scripts/generate-style-code.js
index cacca57700..9c4569709d 100644
--- a/platform/darwin/scripts/generate-style-code.js
+++ b/platform/darwin/scripts/generate-style-code.js
@@ -184,7 +184,7 @@ global.testGetterImplementation = function (property, layerType, isFunction) {
if (isFunction) {
return `XCTAssertEqualObjects(gLayer.${objCName(property)}, ${value});`;
}
- return `XCTAssert([gLayer.${objCName(property)} isKindOfClass:[MGLStyleConstantValue class]]);
+ return `XCTAssert([gLayer.${objCName(property)} isKindOfClass:[MGLConstantStyleValue class]]);
XCTAssertEqualObjects(gLayer.${objCName(property)}, ${value});`;
}
return `XCTAssertEqualObjects(gLayer.${objCName(property)}, ${value});`;
@@ -281,7 +281,7 @@ global.propertyDoc = function (propertyName, property, layerType, kind) {
doc += `\n\nThis attribute corresponds to the <a href="https://www.mapbox.com/mapbox-gl-style-spec/#${anchor}"><code>${property.original}</code></a> layout property in the Mapbox Style Specification.`;
}
doc += '\n\nYou can set this property to an instance of:\n\n' +
- '* `MGLStyleConstantValue`\n';
+ '* `MGLConstantStyleValue`\n';
if (property["property-function"]) {
doc += '* `MGLCameraStyleFunction` with an interpolation mode of:\n' +
' * `MGLInterpolationModeExponential`\n' +
@@ -528,6 +528,7 @@ const layerH = ejs.compile(fs.readFileSync('platform/darwin/src/MGLStyleLayer.h.
const layerM = ejs.compile(fs.readFileSync('platform/darwin/src/MGLStyleLayer.mm.ejs', 'utf8'), { strict: true});
const testLayers = ejs.compile(fs.readFileSync('platform/darwin/test/MGLStyleLayerTests.mm.ejs', 'utf8'), { strict: true});
const guideMD = ejs.compile(fs.readFileSync('platform/darwin/docs/guides/For Style Authors.md.ejs', 'utf8'), { strict: true });
+const ddsGuideMD = ejs.compile(fs.readFileSync('platform/darwin/docs/guides/Data-Driven Styling.md.ejs', 'utf8'), { strict: true });
const layers = _(spec.layer.type.values).map((value, layerType) => {
const layoutProperties = Object.keys(spec[`layout_${layerType}`]).reduce((memo, name) => {
@@ -614,3 +615,9 @@ fs.writeFileSync(`platform/macos/docs/guides/For Style Authors.md`, guideMD({
renamedProperties: renamedPropertiesByLayerType,
layers: layers,
}));
+fs.writeFileSync(`platform/ios/docs/guides/Data-Driven Styling.md`, ddsGuideMD({
+ os: 'iOS',
+}));
+fs.writeFileSync(`platform/macos/docs/guides/Data-Driven Styling.md`, ddsGuideMD({
+ os: 'macOS',
+}));
diff --git a/platform/darwin/src/MGLAttributionInfo_Private.h b/platform/darwin/src/MGLAttributionInfo_Private.h
index 4b28fa5266..08bc6bfc4d 100644
--- a/platform/darwin/src/MGLAttributionInfo_Private.h
+++ b/platform/darwin/src/MGLAttributionInfo_Private.h
@@ -30,7 +30,6 @@ NS_ASSUME_NONNULL_BEGIN
redundant to the given object is replaced by the given object.
@param info The info object to add to the receiver.
- @return True if the given info object was added to the receiver.
*/
- (void)growArrayByAddingAttributionInfo:(MGLAttributionInfo *)info;
diff --git a/platform/darwin/src/MGLBackgroundStyleLayer.h b/platform/darwin/src/MGLBackgroundStyleLayer.h
index c6fd6113cb..cd218d9fb4 100644
--- a/platform/darwin/src/MGLBackgroundStyleLayer.h
+++ b/platform/darwin/src/MGLBackgroundStyleLayer.h
@@ -1,5 +1,5 @@
// This file is generated.
-// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLFoundation.h"
#import "MGLStyleValue.h"
@@ -41,7 +41,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -60,7 +60,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -69,6 +69,13 @@ MGL_EXPORT
#endif
/**
+ The transition affecting any changes to this layer’s `backgroundColor` property.
+
+ This property corresponds to the `background-color-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition backgroundColorTransition;
+
+/**
The opacity at which the background will be drawn.
The default value of this property is an `MGLStyleValue` object containing an
@@ -77,7 +84,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -85,18 +92,32 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *backgroundOpacity;
/**
+ The transition affecting any changes to this layer’s `backgroundOpacity` property.
+
+ This property corresponds to the `background-opacity-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition backgroundOpacityTransition;
+
+/**
Name of image in style images to use for drawing an image background. For
seamless patterns, image width and height must be a factor of two (2, 4, 8,
..., 512).
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSString *> *backgroundPattern;
+/**
+ The transition affecting any changes to this layer’s `backgroundPattern` property.
+
+ This property corresponds to the `background-pattern-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition backgroundPatternTransition;
+
@end
NS_ASSUME_NONNULL_END
diff --git a/platform/darwin/src/MGLBackgroundStyleLayer.mm b/platform/darwin/src/MGLBackgroundStyleLayer.mm
index bcad0aa11b..8f416a0ea2 100644
--- a/platform/darwin/src/MGLBackgroundStyleLayer.mm
+++ b/platform/darwin/src/MGLBackgroundStyleLayer.mm
@@ -4,6 +4,7 @@
#import "MGLSource.h"
#import "MGLMapView_Private.h"
#import "NSPredicate+MGLAdditions.h"
+#import "NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#import "MGLStyleValue_Private.h"
#import "MGLBackgroundStyleLayer.h"
@@ -101,6 +102,24 @@
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toStyleValue(propertyValue);
}
+- (void)setBackgroundColorTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setBackgroundColorTransition(options);
+}
+
+- (MGLTransition)backgroundColorTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getBackgroundColorTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setBackgroundOpacity:(MGLStyleValue<NSNumber *> *)backgroundOpacity {
MGLAssertStyleLayerIsValid();
@@ -118,6 +137,24 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
+- (void)setBackgroundOpacityTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setBackgroundOpacityTransition(options);
+}
+
+- (MGLTransition)backgroundOpacityTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getBackgroundOpacityTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setBackgroundPattern:(MGLStyleValue<NSString *> *)backgroundPattern {
MGLAssertStyleLayerIsValid();
@@ -135,5 +172,22 @@
return MGLStyleValueTransformer<std::string, NSString *>().toStyleValue(propertyValue);
}
+- (void)setBackgroundPatternTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setBackgroundPatternTransition(options);
+}
+
+- (MGLTransition)backgroundPatternTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getBackgroundPatternTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
@end
diff --git a/platform/darwin/src/MGLCircleStyleLayer.h b/platform/darwin/src/MGLCircleStyleLayer.h
index b3e9ee7161..69c823a868 100644
--- a/platform/darwin/src/MGLCircleStyleLayer.h
+++ b/platform/darwin/src/MGLCircleStyleLayer.h
@@ -1,5 +1,5 @@
// This file is generated.
-// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLFoundation.h"
#import "MGLStyleValue.h"
@@ -91,7 +91,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -107,6 +107,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *circleBlur;
+/**
+ The transition affecting any changes to this layer’s `circleBlur` property.
+
+ This property corresponds to the `circle-blur-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition circleBlurTransition;
+
#if TARGET_OS_IPHONE
/**
The fill color of the circle.
@@ -117,7 +124,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -142,7 +149,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -160,6 +167,13 @@ MGL_EXPORT
#endif
/**
+ The transition affecting any changes to this layer’s `circleColor` property.
+
+ This property corresponds to the `circle-color-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition circleColorTransition;
+
+/**
The opacity at which the circle will be drawn.
The default value of this property is an `MGLStyleValue` object containing an
@@ -168,7 +182,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -185,6 +199,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *circleOpacity;
/**
+ The transition affecting any changes to this layer’s `circleOpacity` property.
+
+ This property corresponds to the `circle-opacity-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition circleOpacityTransition;
+
+/**
Circle radius.
This property is measured in points.
@@ -195,7 +216,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -212,6 +233,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *circleRadius;
/**
+ The transition affecting any changes to this layer’s `circleRadius` property.
+
+ This property corresponds to the `circle-radius-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition circleRadiusTransition;
+
+/**
Controls the scaling behavior of the circle when the map is pitched.
The default value of this property is an `MGLStyleValue` object containing an
@@ -224,7 +252,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -242,7 +270,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -267,7 +295,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -285,6 +313,13 @@ MGL_EXPORT
#endif
/**
+ The transition affecting any changes to this layer’s `circleStrokeColor` property.
+
+ This property corresponds to the `circle-stroke-color-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition circleStrokeColorTransition;
+
+/**
The opacity of the circle's stroke.
The default value of this property is an `MGLStyleValue` object containing an
@@ -293,7 +328,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -310,6 +345,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *circleStrokeOpacity;
/**
+ The transition affecting any changes to this layer’s `circleStrokeOpacity` property.
+
+ This property corresponds to the `circle-stroke-opacity-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition circleStrokeOpacityTransition;
+
+/**
The width of the circle's stroke. Strokes are placed outside of the
`circleRadius`.
@@ -321,7 +363,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -337,6 +379,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *circleStrokeWidth;
+/**
+ The transition affecting any changes to this layer’s `circleStrokeWidth` property.
+
+ This property corresponds to the `circle-stroke-width-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition circleStrokeWidthTransition;
+
#if TARGET_OS_IPHONE
/**
The geometry's offset.
@@ -353,7 +402,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -375,7 +424,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -383,6 +432,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *circleTranslation;
#endif
+/**
+ The transition affecting any changes to this layer’s `circleTranslation` property.
+
+ This property corresponds to the `circle-translate-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition circleTranslationTransition;
+
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *circleTranslate __attribute__((unavailable("Use circleTranslation instead.")));
/**
@@ -401,7 +457,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
diff --git a/platform/darwin/src/MGLCircleStyleLayer.mm b/platform/darwin/src/MGLCircleStyleLayer.mm
index 808e00bc38..330b9cdac0 100644
--- a/platform/darwin/src/MGLCircleStyleLayer.mm
+++ b/platform/darwin/src/MGLCircleStyleLayer.mm
@@ -4,6 +4,7 @@
#import "MGLSource.h"
#import "MGLMapView_Private.h"
#import "NSPredicate+MGLAdditions.h"
+#import "NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#import "MGLStyleValue_Private.h"
#import "MGLCircleStyleLayer.h"
@@ -151,6 +152,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setCircleBlurTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setCircleBlurTransition(options);
+}
+
+- (MGLTransition)circleBlurTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getCircleBlurTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setCircleColor:(MGLStyleValue<MGLColor *> *)circleColor {
MGLAssertStyleLayerIsValid();
@@ -168,6 +187,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setCircleColorTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setCircleColorTransition(options);
+}
+
+- (MGLTransition)circleColorTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getCircleColorTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setCircleOpacity:(MGLStyleValue<NSNumber *> *)circleOpacity {
MGLAssertStyleLayerIsValid();
@@ -185,6 +222,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setCircleOpacityTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setCircleOpacityTransition(options);
+}
+
+- (MGLTransition)circleOpacityTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getCircleOpacityTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setCircleRadius:(MGLStyleValue<NSNumber *> *)circleRadius {
MGLAssertStyleLayerIsValid();
@@ -202,6 +257,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setCircleRadiusTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setCircleRadiusTransition(options);
+}
+
+- (MGLTransition)circleRadiusTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getCircleRadiusTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setCircleScaleAlignment:(MGLStyleValue<NSValue *> *)circleScaleAlignment {
MGLAssertStyleLayerIsValid();
@@ -243,6 +316,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setCircleStrokeColorTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setCircleStrokeColorTransition(options);
+}
+
+- (MGLTransition)circleStrokeColorTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getCircleStrokeColorTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setCircleStrokeOpacity:(MGLStyleValue<NSNumber *> *)circleStrokeOpacity {
MGLAssertStyleLayerIsValid();
@@ -260,6 +351,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setCircleStrokeOpacityTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setCircleStrokeOpacityTransition(options);
+}
+
+- (MGLTransition)circleStrokeOpacityTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getCircleStrokeOpacityTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setCircleStrokeWidth:(MGLStyleValue<NSNumber *> *)circleStrokeWidth {
MGLAssertStyleLayerIsValid();
@@ -277,6 +386,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setCircleStrokeWidthTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setCircleStrokeWidthTransition(options);
+}
+
+- (MGLTransition)circleStrokeWidthTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getCircleStrokeWidthTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setCircleTranslation:(MGLStyleValue<NSValue *> *)circleTranslation {
MGLAssertStyleLayerIsValid();
@@ -294,6 +421,24 @@ namespace mbgl {
return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
+- (void)setCircleTranslationTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setCircleTranslateTransition(options);
+}
+
+- (MGLTransition)circleTranslationTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getCircleTranslateTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setCircleTranslate:(MGLStyleValue<NSValue *> *)circleTranslate {
}
@@ -325,7 +470,6 @@ namespace mbgl {
return self.circleTranslationAnchor;
}
-
@end
@implementation NSValue (MGLCircleStyleLayerAdditions)
diff --git a/platform/darwin/src/MGLFeature.h b/platform/darwin/src/MGLFeature.h
index 2380a817e3..491c89b608 100644
--- a/platform/darwin/src/MGLFeature.h
+++ b/platform/darwin/src/MGLFeature.h
@@ -229,6 +229,12 @@ MGL_EXPORT
/**
An `MGLShapeCollectionFeature` object associates a shape collection with an
optional identifier and attributes.
+
+ `MGLShapeCollectionFeature` is most commonly used to add multiple shapes to a single
+ `MGLShapeSource`. Configure the appearance of an `MGLSource`’s shape collection
+ collectively using an `MGLSymbolStyleLayer` object, or use multiple instances of
+ `MGLCircleStyleLayer`, `MGLFillStyleLayer`, and `MGLLineStyleLayer` to
+ configure the appearance of each kind of shape inside the collection.
A shape collection feature is known as a
<a href="https://tools.ietf.org/html/rfc7946#section-3.3">feature collection</a>
diff --git a/platform/darwin/src/MGLFillStyleLayer.h b/platform/darwin/src/MGLFillStyleLayer.h
index a5baf2308c..1f3cfc8af5 100644
--- a/platform/darwin/src/MGLFillStyleLayer.h
+++ b/platform/darwin/src/MGLFillStyleLayer.h
@@ -1,5 +1,5 @@
// This file is generated.
-// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLFoundation.h"
#import "MGLStyleValue.h"
@@ -67,7 +67,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -88,7 +88,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -116,7 +116,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -134,6 +134,13 @@ MGL_EXPORT
#endif
/**
+ The transition affecting any changes to this layer’s `fillColor` property.
+
+ This property corresponds to the `fill-color-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition fillColorTransition;
+
+/**
The opacity of the entire fill layer. In contrast to the `fillColor`, this
value will also affect the 1pt stroke around the fill, if the stroke is used.
@@ -143,7 +150,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -159,6 +166,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *fillOpacity;
+/**
+ The transition affecting any changes to this layer’s `fillOpacity` property.
+
+ This property corresponds to the `fill-opacity-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition fillOpacityTransition;
+
#if TARGET_OS_IPHONE
/**
The outline color of the fill. Matches the value of `fillColor` if unspecified.
@@ -169,7 +183,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -194,7 +208,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -212,17 +226,31 @@ MGL_EXPORT
#endif
/**
+ The transition affecting any changes to this layer’s `fillOutlineColor` property.
+
+ This property corresponds to the `fill-outline-color-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition fillOutlineColorTransition;
+
+/**
Name of image in sprite to use for drawing image fills. For seamless patterns,
image width and height must be a factor of two (2, 4, 8, ..., 512).
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSString *> *fillPattern;
+/**
+ The transition affecting any changes to this layer’s `fillPattern` property.
+
+ This property corresponds to the `fill-pattern-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition fillPatternTransition;
+
#if TARGET_OS_IPHONE
/**
The geometry's offset.
@@ -239,7 +267,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -261,7 +289,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -269,6 +297,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *fillTranslation;
#endif
+/**
+ The transition affecting any changes to this layer’s `fillTranslation` property.
+
+ This property corresponds to the `fill-translate-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition fillTranslationTransition;
+
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *fillTranslate __attribute__((unavailable("Use fillTranslation instead.")));
/**
@@ -287,7 +322,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
diff --git a/platform/darwin/src/MGLFillStyleLayer.mm b/platform/darwin/src/MGLFillStyleLayer.mm
index 6716e0efb1..1322a7a0b6 100644
--- a/platform/darwin/src/MGLFillStyleLayer.mm
+++ b/platform/darwin/src/MGLFillStyleLayer.mm
@@ -4,6 +4,7 @@
#import "MGLSource.h"
#import "MGLMapView_Private.h"
#import "NSPredicate+MGLAdditions.h"
+#import "NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#import "MGLStyleValue_Private.h"
#import "MGLFillStyleLayer.h"
@@ -170,6 +171,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setFillColorTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setFillColorTransition(options);
+}
+
+- (MGLTransition)fillColorTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getFillColorTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setFillOpacity:(MGLStyleValue<NSNumber *> *)fillOpacity {
MGLAssertStyleLayerIsValid();
@@ -187,6 +206,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setFillOpacityTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setFillOpacityTransition(options);
+}
+
+- (MGLTransition)fillOpacityTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getFillOpacityTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setFillOutlineColor:(MGLStyleValue<MGLColor *> *)fillOutlineColor {
MGLAssertStyleLayerIsValid();
@@ -204,6 +241,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setFillOutlineColorTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setFillOutlineColorTransition(options);
+}
+
+- (MGLTransition)fillOutlineColorTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getFillOutlineColorTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setFillPattern:(MGLStyleValue<NSString *> *)fillPattern {
MGLAssertStyleLayerIsValid();
@@ -221,6 +276,24 @@ namespace mbgl {
return MGLStyleValueTransformer<std::string, NSString *>().toStyleValue(propertyValue);
}
+- (void)setFillPatternTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setFillPatternTransition(options);
+}
+
+- (MGLTransition)fillPatternTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getFillPatternTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setFillTranslation:(MGLStyleValue<NSValue *> *)fillTranslation {
MGLAssertStyleLayerIsValid();
@@ -238,6 +311,24 @@ namespace mbgl {
return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
+- (void)setFillTranslationTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setFillTranslateTransition(options);
+}
+
+- (MGLTransition)fillTranslationTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getFillTranslateTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setFillTranslate:(MGLStyleValue<NSValue *> *)fillTranslate {
}
@@ -269,7 +360,6 @@ namespace mbgl {
return self.fillTranslationAnchor;
}
-
@end
@implementation NSValue (MGLFillStyleLayerAdditions)
diff --git a/platform/darwin/src/MGLLineStyleLayer.h b/platform/darwin/src/MGLLineStyleLayer.h
index 23a1f8f131..e03f3e347e 100644
--- a/platform/darwin/src/MGLLineStyleLayer.h
+++ b/platform/darwin/src/MGLLineStyleLayer.h
@@ -1,5 +1,5 @@
// This file is generated.
-// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLFoundation.h"
#import "MGLStyleValue.h"
@@ -118,7 +118,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -133,7 +133,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -152,7 +152,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -172,7 +172,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -192,7 +192,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -208,6 +208,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *lineBlur;
+/**
+ The transition affecting any changes to this layer’s `lineBlur` property.
+
+ This property corresponds to the `line-blur-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition lineBlurTransition;
+
#if TARGET_OS_IPHONE
/**
The color with which the line will be drawn.
@@ -221,7 +228,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -249,7 +256,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -267,6 +274,13 @@ MGL_EXPORT
#endif
/**
+ The transition affecting any changes to this layer’s `lineColor` property.
+
+ This property corresponds to the `line-color-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition lineColorTransition;
+
+/**
Specifies the lengths of the alternating dashes and gaps that form the dash
pattern. The lengths are later scaled by the line width. To convert a dash
length to points, multiply the length by the current line width.
@@ -282,12 +296,19 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSArray<NSNumber *> *> *lineDashPattern;
+/**
+ The transition affecting any changes to this layer’s `lineDashPattern` property.
+
+ This property corresponds to the `line-dasharray-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition lineDashPatternTransition;
+
@property (nonatomic, null_resettable) MGLStyleValue<NSArray<NSNumber *> *> *lineDasharray __attribute__((unavailable("Use lineDashPattern instead.")));
/**
@@ -302,7 +323,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -319,6 +340,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *lineGapWidth;
/**
+ The transition affecting any changes to this layer’s `lineGapWidth` property.
+
+ This property corresponds to the `line-gap-width-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition lineGapWidthTransition;
+
+/**
The line's offset. For linear features, a positive value offsets the line to
the right, relative to the direction of the line, and a negative value to the
left. For polygon features, a positive value results in an inset, and a
@@ -332,7 +360,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -349,6 +377,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *lineOffset;
/**
+ The transition affecting any changes to this layer’s `lineOffset` property.
+
+ This property corresponds to the `line-offset-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition lineOffsetTransition;
+
+/**
The opacity at which the line will be drawn.
The default value of this property is an `MGLStyleValue` object containing an
@@ -357,7 +392,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -374,17 +409,31 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *lineOpacity;
/**
+ The transition affecting any changes to this layer’s `lineOpacity` property.
+
+ This property corresponds to the `line-opacity-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition lineOpacityTransition;
+
+/**
Name of image in style images to use for drawing image lines. For seamless
patterns, image width must be a factor of two (2, 4, 8, ..., 512).
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSString *> *linePattern;
+/**
+ The transition affecting any changes to this layer’s `linePattern` property.
+
+ This property corresponds to the `line-pattern-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition linePatternTransition;
+
#if TARGET_OS_IPHONE
/**
The geometry's offset.
@@ -401,7 +450,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -423,7 +472,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -431,6 +480,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *lineTranslation;
#endif
+/**
+ The transition affecting any changes to this layer’s `lineTranslation` property.
+
+ This property corresponds to the `line-translate-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition lineTranslationTransition;
+
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *lineTranslate __attribute__((unavailable("Use lineTranslation instead.")));
/**
@@ -449,7 +505,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -468,13 +524,20 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *lineWidth;
+/**
+ The transition affecting any changes to this layer’s `lineWidth` property.
+
+ This property corresponds to the `line-width-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition lineWidthTransition;
+
@end
/**
diff --git a/platform/darwin/src/MGLLineStyleLayer.mm b/platform/darwin/src/MGLLineStyleLayer.mm
index 80b1e907e6..e37489cf0b 100644
--- a/platform/darwin/src/MGLLineStyleLayer.mm
+++ b/platform/darwin/src/MGLLineStyleLayer.mm
@@ -4,6 +4,7 @@
#import "MGLSource.h"
#import "MGLMapView_Private.h"
#import "NSPredicate+MGLAdditions.h"
+#import "NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#import "MGLStyleValue_Private.h"
#import "MGLLineStyleLayer.h"
@@ -228,6 +229,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setLineBlurTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setLineBlurTransition(options);
+}
+
+- (MGLTransition)lineBlurTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLineBlurTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setLineColor:(MGLStyleValue<MGLColor *> *)lineColor {
MGLAssertStyleLayerIsValid();
@@ -245,6 +264,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setLineColorTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setLineColorTransition(options);
+}
+
+- (MGLTransition)lineColorTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLineColorTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setLineDashPattern:(MGLStyleValue<NSArray<NSNumber *> *> *)lineDashPattern {
MGLAssertStyleLayerIsValid();
@@ -262,6 +299,24 @@ namespace mbgl {
return MGLStyleValueTransformer<std::vector<float>, NSArray<NSNumber *> *, float>().toStyleValue(propertyValue);
}
+- (void)setLineDashPatternTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setLineDasharrayTransition(options);
+}
+
+- (MGLTransition)lineDashPatternTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLineDasharrayTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setLineDasharray:(MGLStyleValue<NSArray<NSNumber *> *> *)lineDasharray {
}
@@ -286,6 +341,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setLineGapWidthTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setLineGapWidthTransition(options);
+}
+
+- (MGLTransition)lineGapWidthTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLineGapWidthTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setLineOffset:(MGLStyleValue<NSNumber *> *)lineOffset {
MGLAssertStyleLayerIsValid();
@@ -303,6 +376,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setLineOffsetTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setLineOffsetTransition(options);
+}
+
+- (MGLTransition)lineOffsetTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLineOffsetTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setLineOpacity:(MGLStyleValue<NSNumber *> *)lineOpacity {
MGLAssertStyleLayerIsValid();
@@ -320,6 +411,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setLineOpacityTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setLineOpacityTransition(options);
+}
+
+- (MGLTransition)lineOpacityTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLineOpacityTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setLinePattern:(MGLStyleValue<NSString *> *)linePattern {
MGLAssertStyleLayerIsValid();
@@ -337,6 +446,24 @@ namespace mbgl {
return MGLStyleValueTransformer<std::string, NSString *>().toStyleValue(propertyValue);
}
+- (void)setLinePatternTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setLinePatternTransition(options);
+}
+
+- (MGLTransition)linePatternTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLinePatternTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setLineTranslation:(MGLStyleValue<NSValue *> *)lineTranslation {
MGLAssertStyleLayerIsValid();
@@ -354,6 +481,24 @@ namespace mbgl {
return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
+- (void)setLineTranslationTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setLineTranslateTransition(options);
+}
+
+- (MGLTransition)lineTranslationTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLineTranslateTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setLineTranslate:(MGLStyleValue<NSValue *> *)lineTranslate {
}
@@ -402,6 +547,23 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
+- (void)setLineWidthTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setLineWidthTransition(options);
+}
+
+- (MGLTransition)lineWidthTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getLineWidthTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
@end
diff --git a/platform/darwin/src/MGLOfflineStorage.mm b/platform/darwin/src/MGLOfflineStorage.mm
index b65932c6e8..195ef3c36a 100644
--- a/platform/darwin/src/MGLOfflineStorage.mm
+++ b/platform/darwin/src/MGLOfflineStorage.mm
@@ -31,6 +31,7 @@ NSString * const MGLOfflinePackMaximumCountUserInfoKey = MGLOfflinePackUserInfoK
@property (nonatomic, strong, readwrite) NS_MUTABLE_ARRAY_OF(MGLOfflinePack *) *packs;
@property (nonatomic) mbgl::DefaultFileSource *mbglFileSource;
+@property (nonatomic, getter=isPaused) BOOL paused;
@end
@@ -53,11 +54,19 @@ NSString * const MGLOfflinePackMaximumCountUserInfoKey = MGLOfflinePackUserInfoK
#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
- (void)pauseFileSource:(__unused NSNotification *)notification {
+ if (self.isPaused) {
+ return;
+ }
_mbglFileSource->pause();
+ self.paused = YES;
}
- (void)unpauseFileSource:(__unused NSNotification *)notification {
+ if (!self.isPaused) {
+ return;
+ }
_mbglFileSource->resume();
+ self.paused = NO;
}
#endif
diff --git a/platform/darwin/src/MGLPolyline.mm b/platform/darwin/src/MGLPolyline.mm
index 454a1b964b..ae4fbe61de 100644
--- a/platform/darwin/src/MGLPolyline.mm
+++ b/platform/darwin/src/MGLPolyline.mm
@@ -48,6 +48,10 @@
@"coordinates": self.mgl_coordinates};
}
+- (BOOL)isEqual:(id)other {
+ return self == other || ([other isKindOfClass:[MGLPolyline class]] && [super isEqual:other]);
+}
+
@end
@interface MGLMultiPolyline ()
diff --git a/platform/darwin/src/MGLRasterStyleLayer.h b/platform/darwin/src/MGLRasterStyleLayer.h
index 9e876a6e3c..377b7f45cd 100644
--- a/platform/darwin/src/MGLRasterStyleLayer.h
+++ b/platform/darwin/src/MGLRasterStyleLayer.h
@@ -1,5 +1,5 @@
// This file is generated.
-// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLFoundation.h"
#import "MGLStyleValue.h"
@@ -52,13 +52,20 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *maximumRasterBrightness;
+/**
+ The transition affecting any changes to this layer’s `maximumRasterBrightness` property.
+
+ This property corresponds to the `raster-brightness-max-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition maximumRasterBrightnessTransition;
+
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterBrightnessMax __attribute__((unavailable("Use maximumRasterBrightness instead.")));
/**
@@ -75,13 +82,20 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *minimumRasterBrightness;
+/**
+ The transition affecting any changes to this layer’s `minimumRasterBrightness` property.
+
+ This property corresponds to the `raster-brightness-min-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition minimumRasterBrightnessTransition;
+
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterBrightnessMin __attribute__((unavailable("Use minimumRasterBrightness instead.")));
/**
@@ -93,7 +107,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -101,6 +115,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterContrast;
/**
+ The transition affecting any changes to this layer’s `rasterContrast` property.
+
+ This property corresponds to the `raster-contrast-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition rasterContrastTransition;
+
+/**
Fade duration when a new tile is added.
This property is measured in milliseconds.
@@ -111,7 +132,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -119,6 +140,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterFadeDuration;
/**
+ The transition affecting any changes to this layer’s `rasterFadeDuration` property.
+
+ This property corresponds to the `raster-fade-duration-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition rasterFadeDurationTransition;
+
+/**
Rotates hues around the color wheel.
This property is measured in degrees.
@@ -133,13 +161,20 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterHueRotation;
+/**
+ The transition affecting any changes to this layer’s `rasterHueRotation` property.
+
+ This property corresponds to the `raster-hue-rotate-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition rasterHueRotationTransition;
+
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterHueRotate __attribute__((unavailable("Use rasterHueRotation instead.")));
/**
@@ -151,7 +186,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -159,6 +194,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterOpacity;
/**
+ The transition affecting any changes to this layer’s `rasterOpacity` property.
+
+ This property corresponds to the `raster-opacity-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition rasterOpacityTransition;
+
+/**
Increase or reduce the saturation of the image.
The default value of this property is an `MGLStyleValue` object containing an
@@ -167,13 +209,20 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *rasterSaturation;
+/**
+ The transition affecting any changes to this layer’s `rasterSaturation` property.
+
+ This property corresponds to the `raster-saturation-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition rasterSaturationTransition;
+
@end
NS_ASSUME_NONNULL_END
diff --git a/platform/darwin/src/MGLRasterStyleLayer.mm b/platform/darwin/src/MGLRasterStyleLayer.mm
index 2108a5a0c8..80508e4e70 100644
--- a/platform/darwin/src/MGLRasterStyleLayer.mm
+++ b/platform/darwin/src/MGLRasterStyleLayer.mm
@@ -4,6 +4,7 @@
#import "MGLSource.h"
#import "MGLMapView_Private.h"
#import "NSPredicate+MGLAdditions.h"
+#import "NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#import "MGLStyleValue_Private.h"
#import "MGLRasterStyleLayer.h"
@@ -108,6 +109,24 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
+- (void)setMaximumRasterBrightnessTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setRasterBrightnessMaxTransition(options);
+}
+
+- (MGLTransition)maximumRasterBrightnessTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getRasterBrightnessMaxTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setRasterBrightnessMax:(MGLStyleValue<NSNumber *> *)rasterBrightnessMax {
}
@@ -132,6 +151,24 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
+- (void)setMinimumRasterBrightnessTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setRasterBrightnessMinTransition(options);
+}
+
+- (MGLTransition)minimumRasterBrightnessTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getRasterBrightnessMinTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setRasterBrightnessMin:(MGLStyleValue<NSNumber *> *)rasterBrightnessMin {
}
@@ -156,6 +193,24 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
+- (void)setRasterContrastTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setRasterContrastTransition(options);
+}
+
+- (MGLTransition)rasterContrastTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getRasterContrastTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setRasterFadeDuration:(MGLStyleValue<NSNumber *> *)rasterFadeDuration {
MGLAssertStyleLayerIsValid();
@@ -173,6 +228,24 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
+- (void)setRasterFadeDurationTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setRasterFadeDurationTransition(options);
+}
+
+- (MGLTransition)rasterFadeDurationTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getRasterFadeDurationTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setRasterHueRotation:(MGLStyleValue<NSNumber *> *)rasterHueRotation {
MGLAssertStyleLayerIsValid();
@@ -190,6 +263,24 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
+- (void)setRasterHueRotationTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setRasterHueRotateTransition(options);
+}
+
+- (MGLTransition)rasterHueRotationTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getRasterHueRotateTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setRasterHueRotate:(MGLStyleValue<NSNumber *> *)rasterHueRotate {
}
@@ -214,6 +305,24 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
+- (void)setRasterOpacityTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setRasterOpacityTransition(options);
+}
+
+- (MGLTransition)rasterOpacityTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getRasterOpacityTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setRasterSaturation:(MGLStyleValue<NSNumber *> *)rasterSaturation {
MGLAssertStyleLayerIsValid();
@@ -231,5 +340,22 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
+- (void)setRasterSaturationTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setRasterSaturationTransition(options);
+}
+
+- (MGLTransition)rasterSaturationTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getRasterSaturationTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
@end
diff --git a/platform/darwin/src/MGLShapeSource.h b/platform/darwin/src/MGLShapeSource.h
index 07045490bd..d0097f748e 100644
--- a/platform/darwin/src/MGLShapeSource.h
+++ b/platform/darwin/src/MGLShapeSource.h
@@ -211,18 +211,32 @@ MGL_EXPORT
@property (nonatomic, copy, nullable) NSURL *URL;
/**
- Returns an array of map features for this source, filtered by the given predicate.
+ Returns an array of map features for this source, filtered by the given
+ predicate.
Each object in the returned array represents a feature for the current style
- and provides access to attributes specified by the source
+ and provides access to attributes specified via the `shape` property.
Features come from tiled GeoJSON data that is converted to tiles internally,
so feature geometries are clipped at tile boundaries and features
- may appear duplicated across tiles.
-
- @param predicate A predicate to filter the returned features.
+ may appear duplicated across tiles. For example, suppose this source contains a
+ long polyline representing a road. The resulting array includes those parts of
+ the road that lie within the map tiles that the source has loaded, even if the
+ road extends into other tiles. The portion of the road within each map tile is
+ included individually.
+
+ Returned features may not necessarily be visible to the user at the time they
+ are loaded: the style may lack a layer that draws the features in question. To
+ obtain only _visible_ features, use the
+ `-[MGLMapView visibleFeaturesAtPoint:inStyleLayersWithIdentifiers:predicate:]`
+ or
+ `-[MGLMapView visibleFeaturesInRect:inStyleLayersWithIdentifiers:predicate:]`
+ method.
+
+ @param predicate A predicate to filter the returned features. Use `nil` to
+ include all features in the source.
@return An array of objects conforming to the `MGLFeature` protocol that
- represent features in the sources used by the current style.
+ represent features in the source that match the predicate.
*/
- (NS_ARRAY_OF(id <MGLFeature>) *)featuresMatchingPredicate:(nullable NSPredicate *)predicate;
diff --git a/platform/darwin/src/MGLStyle.h b/platform/darwin/src/MGLStyle.h
index 689faf78cf..bd17fdec44 100644
--- a/platform/darwin/src/MGLStyle.h
+++ b/platform/darwin/src/MGLStyle.h
@@ -194,6 +194,12 @@ MGL_EXPORT
@property (nonatomic, strong) NS_SET_OF(__kindof MGLSource *) *sources;
/**
+ Values describing animated transitions to changes on a style's individual
+ paint properties.
+ */
+@property (nonatomic) MGLTransition transition;
+
+/**
Returns a source with the given identifier in the current style.
@note Source identifiers are not guaranteed to exist across styles or different
@@ -442,22 +448,6 @@ MGL_EXPORT
*/
- (void)removeImageForName:(NSString *)name;
-#pragma mark Managing a Style’s Transition Options
-
-/**
- The duration in seconds to animate any changes to the style URL or to layout and paint attributes.
-
- By default, this property is set to zero seconds, so any changes take effect without animation.
- */
-@property (nonatomic) NSTimeInterval transitionDuration;
-
-/**
- The delay in seconds to before applying any changes to the style URL or to layout and paint attributes.
-
- By default, this property is set to zero seconds, so any changes begin to animate immediately.
- */
-@property (nonatomic) NSTimeInterval transitionDelay;
-
@end
NS_ASSUME_NONNULL_END
diff --git a/platform/darwin/src/MGLStyle.mm b/platform/darwin/src/MGLStyle.mm
index bcb8100800..aa493d9ef7 100644
--- a/platform/darwin/src/MGLStyle.mm
+++ b/platform/darwin/src/MGLStyle.mm
@@ -341,10 +341,10 @@ static NSURL *MGLStyleURL_emerald;
styleLayer = [[MGLCircleStyleLayer alloc] initWithIdentifier:identifier source:source];
} else if (mbglLayer->is<mbgl::style::BackgroundLayer>()) {
styleLayer = [[MGLBackgroundStyleLayer alloc] initWithIdentifier:identifier];
- } else if (auto customLayer = mbglLayer->as<mbgl::style::CustomLayer>()) {
+ } else if (mbglLayer->is<mbgl::style::CustomLayer>()) {
styleLayer = self.openGLLayers[identifier];
if (styleLayer) {
- NSAssert(styleLayer.rawLayer == customLayer, @"%@ wraps a CustomLayer that differs from the one associated with the underlying style.", styleLayer);
+ NSAssert(styleLayer.rawLayer == mbglLayer->as<mbgl::style::CustomLayer>(), @"%@ wraps a CustomLayer that differs from the one associated with the underlying style.", styleLayer);
return styleLayer;
}
styleLayer = [[MGLOpenGLStyleLayer alloc] initWithIdentifier:identifier];
@@ -502,7 +502,7 @@ static NSURL *MGLStyleURL_emerald;
newAppliedClasses.push_back([appliedClass UTF8String]);
}
- mbgl::style::TransitionOptions transition { { MGLDurationInSecondsFromTimeInterval(transitionDuration) } };
+ mbgl::style::TransitionOptions transition { { MGLDurationFromTimeInterval(transitionDuration) } };
self.mapView.mbglMap->setTransitionOptions(transition);
self.mapView.mbglMap->setClasses(newAppliedClasses);
}
@@ -572,30 +572,24 @@ static NSURL *MGLStyleURL_emerald;
#pragma mark Style transitions
-- (void)setTransitionDuration:(NSTimeInterval)duration
+- (void)setTransition:(MGLTransition)transition
{
auto transitionOptions = self.mapView.mbglMap->getTransitionOptions();
- transitionOptions.duration = MGLDurationInSecondsFromTimeInterval(duration);
+ transitionOptions.duration = MGLDurationFromTimeInterval(transition.duration);
+ transitionOptions.delay = MGLDurationFromTimeInterval(transition.delay);
+
self.mapView.mbglMap->setTransitionOptions(transitionOptions);
}
-- (NSTimeInterval)transitionDuration
+- (MGLTransition)transition
{
+ MGLTransition transition;
const mbgl::style::TransitionOptions transitionOptions = self.mapView.mbglMap->getTransitionOptions();
- return MGLTimeIntervalFromDurationInSeconds(transitionOptions.duration.value_or(mbgl::Duration::zero()));
-}
-
-- (void)setTransitionDelay:(NSTimeInterval)delay
-{
- auto transitionOptions = self.mapView.mbglMap->getTransitionOptions();
- transitionOptions.delay = MGLDurationInSecondsFromTimeInterval(delay);
- self.mapView.mbglMap->setTransitionOptions(transitionOptions);
-}
-- (NSTimeInterval)transitionDelay
-{
- const mbgl::style::TransitionOptions transitionOptions = self.mapView.mbglMap->getTransitionOptions();
- return MGLTimeIntervalFromDurationInSeconds(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+
+ return transition;
}
- (NSString *)description
diff --git a/platform/darwin/src/MGLStyleLayer.h b/platform/darwin/src/MGLStyleLayer.h
index 55f1a56490..f81643edd7 100644
--- a/platform/darwin/src/MGLStyleLayer.h
+++ b/platform/darwin/src/MGLStyleLayer.h
@@ -18,6 +18,9 @@ NS_ASSUME_NONNULL_BEGIN
subclasses of this class. Instead, create instances of
`MGLBackgroundStyleLayer` and the concrete subclasses of
`MGLForegroundStyleLayer`.
+
+ Do not add `MGLStyleLayer` objects to the `style` property of a `MGLMapView` before
+ `-mapView:didFinishLoadingStyle:` is called.
*/
MGL_EXPORT
@interface MGLStyleLayer : NSObject
diff --git a/platform/darwin/src/MGLStyleLayer.h.ejs b/platform/darwin/src/MGLStyleLayer.h.ejs
index f0a4ba64a3..e6c60a76db 100644
--- a/platform/darwin/src/MGLStyleLayer.h.ejs
+++ b/platform/darwin/src/MGLStyleLayer.h.ejs
@@ -6,7 +6,7 @@
const enumProperties = locals.enumProperties;
-%>
// This file is generated.
-// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLFoundation.h"
#import "MGLStyleValue.h"
@@ -111,6 +111,15 @@ MGL_EXPORT
*/
@property (nonatomic<% if (!property.required) { %>, null_resettable<% } if (property.getter) { %>, getter=<%- objCGetter(property) -%><% } %>) MGLStyleValue<<%- propertyType(property, true) %>> *<%- camelizeWithLeadingLowercase(property.name) %>;
+<% if (property["transition"]) { -%>
+/**
+ The transition affecting any changes to this layer’s `<%- camelizeWithLeadingLowercase(property.name) %>` property.
+
+ This property corresponds to the `<%- originalPropertyName(property) %>-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition <%- camelizeWithLeadingLowercase(property.name) %>Transition;
+
+<% } -%>
<% if (property.original) { -%>
@property (nonatomic<% if (!property.required) { %>, null_resettable<% } %>) MGLStyleValue<<%- propertyType(property, true) %>> *<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %> __attribute__((unavailable("Use <%- camelizeWithLeadingLowercase(property.name) %> instead.")));
diff --git a/platform/darwin/src/MGLStyleLayer.mm.ejs b/platform/darwin/src/MGLStyleLayer.mm.ejs
index 24aff7fca8..1e5f3df160 100644
--- a/platform/darwin/src/MGLStyleLayer.mm.ejs
+++ b/platform/darwin/src/MGLStyleLayer.mm.ejs
@@ -10,6 +10,7 @@
#import "MGLSource.h"
#import "MGLMapView_Private.h"
#import "NSPredicate+MGLAdditions.h"
+#import "NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#import "MGLStyleValue_Private.h"
#import "MGL<%- camelize(type) %>StyleLayer.h"
@@ -228,8 +229,8 @@ namespace mbgl {
<% } -%>
<% if (paintProperties.length) { -%>
#pragma mark - Accessing the Paint Attributes
-
<% for (const property of paintProperties) { -%>
+
- (void)set<%- camelize(property.name) %>:(MGLStyleValue<<%- propertyType(property, true) %>> *)<%- objCName(property) %> {
MGLAssertStyleLayerIsValid();
@@ -270,15 +271,34 @@ namespace mbgl {
<% } -%>
<% } -%>
}
+<% if (property["transition"]) { -%>
+
+- (void)set<%- camelize(property.name) %>Transition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->set<%- camelize(originalPropertyName(property)) %>Transition(options);
+}
+
+- (MGLTransition)<%- objCGetter(property) %>Transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->get<%- camelize(originalPropertyName(property)) %>Transition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+<% } -%>
<% if (property.original) { -%>
+
- (void)set<%- camelize(originalPropertyName(property)) %>:(MGLStyleValue<<%- propertyType(property, true) %>> *)<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %> {
}
- (MGLStyleValue<<%- propertyType(property, true) %>> *)<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %> {
return self.<%- objCGetter(property) %>;
}
-
<% } -%>
<% } -%>
<% } -%>
diff --git a/platform/darwin/src/MGLStyleValue.h b/platform/darwin/src/MGLStyleValue.h
index 2ce2eae89a..70074c8a13 100644
--- a/platform/darwin/src/MGLStyleValue.h
+++ b/platform/darwin/src/MGLStyleValue.h
@@ -17,10 +17,10 @@ typedef NSString *MGLStyleFunctionOption NS_STRING_ENUM;
The exponential interpolation base controls the rate at which the function’s
output values increase. A value of 1 causes the function to increase linearly
- by zoom level. A higher exponential interpolation base causes the function’s
- output values to vary exponentially, increasing more rapidly towards the high
- end of the function’s range. The default value of this property is 1, for a
- linear curve.
+ based on zoom level or attribute value. A higher exponential interpolation base
+ causes the function’s output values to vary exponentially, increasing more rapidly
+ towards the high end of the function’s range. The default value of this property
+ is 1, for a linear curve.
This attribute corresponds to the
<a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#function-base"><code>base</code></a>
@@ -33,7 +33,7 @@ typedef NSString *MGLStyleFunctionOption NS_STRING_ENUM;
extern MGL_EXPORT const MGLStyleFunctionOption MGLStyleFunctionOptionInterpolationBase;
/**
- An `MGLStyleConstantValue` object that specifies a default value that a style
+ An `MGLConstantStyleValue` object that specifies a default value that a style
function can use when it can't otherwise determine a value.
A default value can be used to set the value of a style layer property that
@@ -54,23 +54,30 @@ extern MGL_EXPORT const MGLStyleFunctionOption MGLStyleFunctionOptionDefaultValu
*/
typedef NS_ENUM(NSUInteger, MGLInterpolationMode) {
/**
- Values between two stops are interpolated exponentially or linearly if the
- `MGLStyleFunctionOptionInterpolationBase` is 1.
+ Values between two stops are interpolated linearly, or exponentially based on
+ the `MGLStyleFunctionOptionInterpolationBase`. A higher interpolation base
+ causes the function’s output values to vary exponentially, increasing more rapidly
+ towards the high end of the function’s range. The default interpolation base of 1
+ creates a linear interpolation. Use exponential interpolation mode to show values
+ relative to stop keys.
*/
MGLInterpolationModeExponential = 0,
/**
Values between two stops are not interpolated. Instead, properties are set
- to the value of the stop just less than the function input.
+ to the value of the stop just less than the function input. Use interval
+ interpolation mode to show values that fall within a range.
*/
MGLInterpolationModeInterval,
/**
Values between two stops are not interpolated. Instead, properties are set
- to the value of the stop equal to the function input's key value.
+ to the value of the stop equal to the function input's key value. Use
+ categorical interpolation mode to show values that fit into categories.
*/
MGLInterpolationModeCategorical,
/**
- Values between two stops are not interpolated. Instead, values are set
- to their input value.
+ Values between two stops are not interpolated. Instead, values are set to their
+ input value. Use identity interpolation mode to show attribute values that can be
+ used as style values.
*/
MGLInterpolationModeIdentity
};
@@ -81,7 +88,7 @@ typedef NS_ENUM(NSUInteger, MGLInterpolationMode) {
`MGLStyleValue` objects.
The `MGLStyleValue` class itself represents a class cluster. Under the hood, a
- particular `MGLStyleValue` object may be either an `MGLStyleConstantValue` to
+ particular `MGLStyleValue` object may be either an `MGLConstantStyleValue` to
represent a constant value or one of the concrete subclasses of
`MGLStyleFunction` to represent a value function. Do not initialize an
`MGLStyleValue` object directly; instead, use one of the class factory methods
@@ -104,10 +111,10 @@ MGL_EXPORT
#pragma mark Creating a Style Value
/**
- Creates and returns an `MGLStyleConstantValue` object containing a raw value.
+ Creates and returns an `MGLConstantStyleValue` object containing a raw value.
@param rawValue The constant value contained by the object.
- @return An `MGLStyleConstantValue` object containing `rawValue`, which is
+ @return An `MGLConstantStyleValue` object containing `rawValue`, which is
treated as a constant value.
*/
+ (instancetype)valueWithRawValue:(T)rawValue;
@@ -168,7 +175,8 @@ MGL_EXPORT
@param interpolationMode The mode used to interpolate property values over a
range of feature attribute values for each outer zoom level.
- @param sourceStops A dictionary associating feature attributes with style values.
+ @param compositeStops A dictionary associating feature attributes with style
+ values.
@param attributeName Specifies the feature attribute to take as the function
input.
@param options A dictionary containing `MGLStyleFunctionOption` values that
@@ -181,24 +189,24 @@ MGL_EXPORT
@end
/**
- An `MGLStyleConstantValue` object is a generic container for a style attribute
+ An `MGLConstantStyleValue` object is a generic container for a style attribute
value that remains constant as the zoom level changes. The layout and paint
attribute properties of `MGLStyleLayer` objects can be set to
- `MGLStyleConstantValue` objects.
+ `MGLConstantStyleValue` objects.
- The `MGLStyleConstantValue` class takes a generic parameter `T` that indicates
+ The `MGLConstantStyleValue` class takes a generic parameter `T` that indicates
the Foundation class being wrapped by this class.
*/
MGL_EXPORT
-@interface MGLStyleConstantValue<T> : MGLStyleValue<T>
+@interface MGLConstantStyleValue<T> : MGLStyleValue<T>
#pragma mark Creating a Style Constant Value
/**
- Creates and returns an `MGLStyleConstantValue` object containing a raw value.
+ Creates and returns an `MGLConstantStyleValue` object containing a raw value.
@param rawValue The constant value contained by the object.
- @return An `MGLStyleConstantValue` object containing `rawValue`, which is
+ @return An `MGLConstantStyleValue` object containing `rawValue`, which is
treated as a constant value.
*/
+ (instancetype)valueWithRawValue:(T)rawValue;
@@ -208,10 +216,10 @@ MGL_EXPORT
- (instancetype)init NS_UNAVAILABLE;
/**
- Returns an `MGLStyleConstantValue` object containing a raw value.
+ Returns an `MGLConstantStyleValue` object containing a raw value.
@param rawValue The value contained by the receiver.
- @return An `MGLStyleConstantValue` object containing `rawValue`.
+ @return An `MGLConstantStyleValue` object containing `rawValue`.
*/
- (instancetype)initWithRawValue:(T)rawValue NS_DESIGNATED_INITIALIZER;
@@ -224,6 +232,8 @@ MGL_EXPORT
@end
+@compatibility_alias MGLStyleConstantValue MGLConstantStyleValue;
+
/**
An `MGLStyleFunction` is a is an abstract superclass for functions that are
defined by an `MGLCameraStyleFunction`, `MGLSourceStyleFunction`, or
@@ -378,7 +388,7 @@ MGL_EXPORT
@param interpolationMode The mode used to interpolate property values over a
range of feature attribute values.
- @param sourceStops A dictionary associating feature attributes with style values.
+ @param stops A dictionary associating feature attributes with style values.
@param attributeName Specifies the feature attribute to take as the function
input.
@param options A dictionary containing `MGLStyleFunctionOption` values that
@@ -438,7 +448,7 @@ MGL_EXPORT
@param interpolationMode The mode used to interpolate property values over a
range of feature attribute values for each outer zoom level.
- @param sourceStops A dictionary associating feature attributes with style values.
+ @param stops A dictionary associating feature attributes with style values.
@param attributeName Specifies the feature attribute to take as the function
input.
@param options A dictionary containing `MGLStyleFunctionOption` values that
diff --git a/platform/darwin/src/MGLStyleValue.mm b/platform/darwin/src/MGLStyleValue.mm
index 020dc27d6a..33b6babadf 100644
--- a/platform/darwin/src/MGLStyleValue.mm
+++ b/platform/darwin/src/MGLStyleValue.mm
@@ -6,7 +6,7 @@ const MGLStyleFunctionOption MGLStyleFunctionOptionDefaultValue = @"MGLStyleFunc
@implementation MGLStyleValue
+ (instancetype)valueWithRawValue:(id)rawValue {
- return [MGLStyleConstantValue valueWithRawValue:rawValue];
+ return [MGLConstantStyleValue valueWithRawValue:rawValue];
}
+ (instancetype)valueWithInterpolationBase:(CGFloat)interpolationBase stops:(NSDictionary *)stops {
@@ -31,7 +31,7 @@ const MGLStyleFunctionOption MGLStyleFunctionOptionDefaultValue = @"MGLStyleFunc
@end
-@implementation MGLStyleConstantValue
+@implementation MGLConstantStyleValue
+ (instancetype)valueWithRawValue:(id)rawValue {
return [[self alloc] initWithRawValue:rawValue];
@@ -52,7 +52,7 @@ const MGLStyleFunctionOption MGLStyleFunctionOptionDefaultValue = @"MGLStyleFunc
return [self.rawValue debugDescription];
}
-- (BOOL)isEqual:(MGLStyleConstantValue *)other {
+- (BOOL)isEqual:(MGLConstantStyleValue *)other {
return [other isKindOfClass:[self class]] && [other.rawValue isEqual:self.rawValue];
}
diff --git a/platform/darwin/src/MGLStyleValue_Private.h b/platform/darwin/src/MGLStyleValue_Private.h
index 3a5ce8d474..90d6622c93 100644
--- a/platform/darwin/src/MGLStyleValue_Private.h
+++ b/platform/darwin/src/MGLStyleValue_Private.h
@@ -51,12 +51,12 @@ public:
mbgl::style::PropertyValue<MBGLType> toPropertyValue(MGLStyleValue<ObjCType> *value) {
if ([value isKindOfClass:[MGLSourceStyleFunction class]] || [value isKindOfClass:[MGLCompositeStyleFunction class]]) {
[NSException raise:NSInvalidArgumentException
- format:@"This property can only be set to camera functions. Use +[MGLStyleValue cameraFunctionValueWithinterpolationMode:stops:options:] instead."];
+ format:@"This property can only be set to camera functions. Use +[MGLStyleValue valueWithInterpolationMode:cameraStops:options:] instead."];
return {};
}
- if ([value isKindOfClass:[MGLStyleConstantValue class]]) {
- return toMBGLConstantValue((MGLStyleConstantValue<ObjCType> *)value);
+ if ([value isKindOfClass:[MGLConstantStyleValue class]]) {
+ return toMBGLConstantValue((MGLConstantStyleValue<ObjCType> *)value);
} else if ([value isKindOfClass:[MGLCameraStyleFunction class]]) {
MGLCameraStyleFunction<ObjCType> *cameraStyleFunction = (MGLCameraStyleFunction<ObjCType> *)value;
// Intentionally ignore the stop type set by the developer becuase non interpolatable property values
@@ -82,12 +82,12 @@ public:
mbgl::style::PropertyValue<MBGLType> toInterpolatablePropertyValue(MGLStyleValue<ObjCType> *value) {
if ([value isKindOfClass:[MGLSourceStyleFunction class]] || [value isKindOfClass:[MGLCompositeStyleFunction class]]) {
[NSException raise:NSInvalidArgumentException
- format:@"This property can only be set to camera functions. Use +[MGLStyleValue cameraFunctionValueWithinterpolationMode:stops:options:] instead."];
+ format:@"This property can only be set to camera functions. Use +[MGLStyleValue valueWithInterpolationMode:cameraStops:options:] instead."];
return {};
}
- if ([value isKindOfClass:[MGLStyleConstantValue class]]) {
- return toMBGLConstantValue((MGLStyleConstantValue<ObjCType> *)value);
+ if ([value isKindOfClass:[MGLConstantStyleValue class]]) {
+ return toMBGLConstantValue((MGLConstantStyleValue<ObjCType> *)value);
} else if ([value isMemberOfClass:[MGLStyleFunction class]]) {
MGLStyleFunction<ObjCType> *styleFunction = (MGLStyleFunction<ObjCType> *)value;
return toMBGLExponentialCameraFunction(styleFunction);
@@ -119,8 +119,8 @@ public:
// Convert an mgl style value into a mbgl data driven property value
mbgl::style::DataDrivenPropertyValue<MBGLType> toDataDrivenPropertyValue(MGLStyleValue<ObjCType> *value) {
- if ([value isKindOfClass:[MGLStyleConstantValue class]]) {
- return toMBGLConstantValue((MGLStyleConstantValue<ObjCType> *)value);
+ if ([value isKindOfClass:[MGLConstantStyleValue class]]) {
+ return toMBGLConstantValue((MGLConstantStyleValue<ObjCType> *)value);
} else if ([value isKindOfClass:[MGLStyleFunction class]]) {
auto rawValue = toRawStyleSpecValue((MGLStyleFunction<ObjCType> *) value);
auto result = mbgl::style::conversion::convert<mbgl::style::DataDrivenPropertyValue<MBGLType>>(rawValue);
@@ -139,13 +139,13 @@ public:
mbgl::style::PropertyValue<MBGLEnum> toEnumPropertyValue(MGLStyleValue<ObjCType> *value) {
if ([value isKindOfClass:[MGLSourceStyleFunction class]] || [value isKindOfClass:[MGLCompositeStyleFunction class]]) {
[NSException raise:NSInvalidArgumentException
- format:@"This property can only be set to camera functions. Use +[MGLStyleValue cameraFunctionValueWithinterpolationMode:stops:options:] instead."];
+ format:@"This property can only be set to camera functions. Use +[MGLStyleValue valueWithInterpolationMode:cameraStops:options:] instead."];
return {};
}
- if ([value isKindOfClass:[MGLStyleConstantValue class]]) {
+ if ([value isKindOfClass:[MGLConstantStyleValue class]]) {
MBGLEnum mbglValue;
- getMBGLValue([(MGLStyleConstantValue<ObjCType> *)value rawValue], mbglValue);
+ getMBGLValue([(MGLConstantStyleValue<ObjCType> *)value rawValue], mbglValue);
return mbglValue;
} else if ([value isKindOfClass:[MGLCameraStyleFunction class]]) {
MGLCameraStyleFunction<NSValue *> *cameraStyleFunction = (MGLCameraStyleFunction<NSValue *> *)value;
@@ -175,7 +175,7 @@ public:
private: // Private utilities for converting from mgl to mbgl values
- MBGLType toMBGLConstantValue(MGLStyleConstantValue<ObjCType> *value) {
+ MBGLType toMBGLConstantValue(MGLConstantStyleValue<ObjCType> *value) {
MBGLType mbglValue;
getMBGLValue(value.rawValue, mbglValue);
return mbglValue;
@@ -245,7 +245,7 @@ private: // Private utilities for converting from mgl to mbgl values
if ([styleFunction isKindOfClass:[MGLCameraStyleFunction class]]) {
// zoom-only function (no default value)
__block NSMutableArray *stops = [[NSMutableArray alloc] init];
- [styleFunction.stops enumerateKeysAndObjectsUsingBlock:^(NSNumber * _Nonnull zoomKey, MGLStyleConstantValue<ObjCType> * _Nonnull outputValue, BOOL * _Nonnull stop) {
+ [styleFunction.stops enumerateKeysAndObjectsUsingBlock:^(NSNumber * _Nonnull zoomKey, MGLConstantStyleValue<ObjCType> * _Nonnull outputValue, BOOL * _Nonnull stop) {
MBGLType dummyMbglValue;
NSArray *rawStop = @[zoomKey, toRawStyleSpecValue([outputValue rawValue], dummyMbglValue)];
[stops addObject:rawStop];
@@ -257,7 +257,7 @@ private: // Private utilities for converting from mgl to mbgl values
rawFunction[@"property"] = sourceStyleFunction.attributeName;
// property-only function
__block NSMutableArray *stops = [[NSMutableArray alloc] init];
- [styleFunction.stops enumerateKeysAndObjectsUsingBlock:^(NSObject * _Nonnull propertyKey, MGLStyleConstantValue<ObjCType> * _Nonnull outputValue, BOOL * _Nonnull stop) {
+ [styleFunction.stops enumerateKeysAndObjectsUsingBlock:^(NSObject * _Nonnull propertyKey, MGLConstantStyleValue<ObjCType> * _Nonnull outputValue, BOOL * _Nonnull stop) {
MBGLType dummyMbglValue;
NSArray *rawStop = @[propertyKey, toRawStyleSpecValue([outputValue rawValue], dummyMbglValue)];
[stops addObject:rawStop];
@@ -266,9 +266,9 @@ private: // Private utilities for converting from mgl to mbgl values
// defaultValue => default
if (sourceStyleFunction.defaultValue) {
- NSCAssert([sourceStyleFunction.defaultValue isKindOfClass:[MGLStyleConstantValue class]], @"Default value must be constant");
+ NSCAssert([sourceStyleFunction.defaultValue isKindOfClass:[MGLConstantStyleValue class]], @"Default value must be constant");
MBGLType dummyMbglValue;
- rawFunction[@"default"] = toRawStyleSpecValue([(MGLStyleConstantValue<ObjCType> *)sourceStyleFunction.defaultValue rawValue], dummyMbglValue);
+ rawFunction[@"default"] = toRawStyleSpecValue([(MGLConstantStyleValue<ObjCType> *)sourceStyleFunction.defaultValue rawValue], dummyMbglValue);
}
} else if ([styleFunction isKindOfClass:[MGLCompositeStyleFunction class]]) {
// zoom-and-property function
@@ -282,8 +282,8 @@ private: // Private utilities for converting from mgl to mbgl values
@"zoom": zoomKey,
@"value": valueKey
};
- MGLStyleConstantValue<ObjCType> *outputValue = stopValue[valueKey];
- NSCAssert([outputValue isKindOfClass:[MGLStyleConstantValue<ObjCType> class]], @"Stop outputs should be MGLStyleConstantValues");
+ MGLConstantStyleValue<ObjCType> *outputValue = stopValue[valueKey];
+ NSCAssert([outputValue isKindOfClass:[MGLConstantStyleValue<ObjCType> class]], @"Stop outputs should be MGLConstantStyleValues");
MBGLType dummyMbglValue;
NSArray *rawStop = @[stopKey, toRawStyleSpecValue([outputValue rawValue], dummyMbglValue)];
[stops addObject:rawStop];
@@ -293,9 +293,9 @@ private: // Private utilities for converting from mgl to mbgl values
// defaultValue => default
if (compositeStyleFunction.defaultValue) {
- NSCAssert([compositeStyleFunction.defaultValue isKindOfClass:[MGLStyleConstantValue class]], @"Default value must be constant");
+ NSCAssert([compositeStyleFunction.defaultValue isKindOfClass:[MGLConstantStyleValue class]], @"Default value must be constant");
MBGLType dummyMbglValue;
- rawFunction[@"default"] = toRawStyleSpecValue([(MGLStyleConstantValue<ObjCType> *)compositeStyleFunction.defaultValue rawValue], dummyMbglValue);
+ rawFunction[@"default"] = toRawStyleSpecValue([(MGLConstantStyleValue<ObjCType> *)compositeStyleFunction.defaultValue rawValue], dummyMbglValue);
}
}
@@ -367,9 +367,9 @@ private: // Private utilities for converting from mgl to mbgl values
void setDefaultMBGLValue(MGLSourceStyleFunction<ObjCType> *sourceStyleFunction, mbgl::style::SourceFunction<MBGLType> &sourceFunction) {
if (sourceStyleFunction.defaultValue) {
- NSCAssert([sourceStyleFunction.defaultValue isKindOfClass:[MGLStyleConstantValue class]], @"Default value must be constant");
+ NSCAssert([sourceStyleFunction.defaultValue isKindOfClass:[MGLConstantStyleValue class]], @"Default value must be constant");
MBGLType mbglValue;
- id mglValue = [(MGLStyleConstantValue<ObjCType> *)sourceStyleFunction.defaultValue rawValue];
+ id mglValue = [(MGLConstantStyleValue<ObjCType> *)sourceStyleFunction.defaultValue rawValue];
getMBGLValue(mglValue, mbglValue);
sourceFunction.defaultValue = mbglValue;
}
@@ -518,7 +518,7 @@ private: // Private utilities for converting from mbgl to mgl values
id operator()(const MBGLEnum &value) const {
auto str = mbgl::Enum<MBGLEnum>::toString(value);
MGLEnum mglType = *mbgl::Enum<MGLEnum>::toEnum(str);
- return [MGLStyleConstantValue<ObjCType> valueWithRawValue:[NSValue value:&mglType withObjCType:@encode(MGLEnum)]];
+ return [MGLConstantStyleValue<ObjCType> valueWithRawValue:[NSValue value:&mglType withObjCType:@encode(MGLEnum)]];
}
id operator()(const mbgl::style::CameraFunction<MBGLEnum> &mbglValue) const {
@@ -671,7 +671,7 @@ private: // Private utilities for converting from mbgl to mgl values
id operator()(const MBGLType &value) const {
auto rawValue = toMGLRawStyleValue(value);
- return [MGLStyleConstantValue<ObjCType> valueWithRawValue:rawValue];
+ return [MGLConstantStyleValue<ObjCType> valueWithRawValue:rawValue];
}
id operator()(const mbgl::style::CameraFunction<MBGLType> &mbglValue) const {
diff --git a/platform/darwin/src/MGLSymbolStyleLayer.h b/platform/darwin/src/MGLSymbolStyleLayer.h
index a4850a4e18..c76efe2de7 100644
--- a/platform/darwin/src/MGLSymbolStyleLayer.h
+++ b/platform/darwin/src/MGLSymbolStyleLayer.h
@@ -1,5 +1,5 @@
// This file is generated.
-// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLFoundation.h"
#import "MGLStyleValue.h"
@@ -299,7 +299,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -324,7 +324,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -334,7 +334,8 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *iconIgnorePlacement __attribute__((unavailable("Use iconIgnoresPlacement instead.")));
/**
- A string with {tokens} replaced, referencing the data property to pull from.
+ Name of image in sprite to use for drawing an image background. A string with
+ {tokens} replaced, referencing the data property to pull from.
This attribute corresponds to the <a
href="https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-icon-image"><code>icon-image</code></a>
@@ -342,7 +343,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -364,7 +365,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -392,7 +393,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -422,7 +423,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -443,7 +444,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -468,7 +469,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -500,7 +501,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -522,7 +523,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -544,7 +545,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -567,7 +568,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -590,7 +591,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -617,7 +618,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -646,7 +647,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -674,7 +675,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -702,7 +703,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -728,7 +729,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -746,7 +747,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -767,7 +768,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -788,7 +789,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -824,7 +825,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -845,7 +846,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -877,7 +878,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -904,7 +905,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -930,7 +931,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -955,7 +956,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -978,7 +979,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -999,7 +1000,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1021,7 +1022,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1042,7 +1043,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1063,7 +1064,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -1084,7 +1085,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1103,7 +1104,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -1127,7 +1128,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1150,7 +1151,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -1168,7 +1169,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1200,7 +1201,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1229,7 +1230,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1247,6 +1248,13 @@ MGL_EXPORT
#endif
/**
+ The transition affecting any changes to this layer’s `iconColor` property.
+
+ This property corresponds to the `icon-color-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition iconColorTransition;
+
+/**
Fade out the halo towards the outside.
This property is measured in points.
@@ -1260,7 +1268,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1276,6 +1284,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *iconHaloBlur;
+/**
+ The transition affecting any changes to this layer’s `iconHaloBlur` property.
+
+ This property corresponds to the `icon-halo-blur-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition iconHaloBlurTransition;
+
#if TARGET_OS_IPHONE
/**
The color of the icon’s halo. The `iconImageName` property must be set to a
@@ -1290,7 +1305,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1319,7 +1334,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1337,6 +1352,13 @@ MGL_EXPORT
#endif
/**
+ The transition affecting any changes to this layer’s `iconHaloColor` property.
+
+ This property corresponds to the `icon-halo-color-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition iconHaloColorTransition;
+
+/**
Distance of halo to the icon outline.
This property is measured in points.
@@ -1350,7 +1372,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1367,6 +1389,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *iconHaloWidth;
/**
+ The transition affecting any changes to this layer’s `iconHaloWidth` property.
+
+ This property corresponds to the `icon-halo-width-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition iconHaloWidthTransition;
+
+/**
The opacity at which the icon will be drawn.
The default value of this property is an `MGLStyleValue` object containing an
@@ -1378,7 +1407,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1394,6 +1423,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *iconOpacity;
+/**
+ The transition affecting any changes to this layer’s `iconOpacity` property.
+
+ This property corresponds to the `icon-opacity-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition iconOpacityTransition;
+
#if TARGET_OS_IPHONE
/**
Distance that the icon's anchor is moved from its original placement.
@@ -1413,7 +1449,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1438,7 +1474,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1446,6 +1482,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *iconTranslation;
#endif
+/**
+ The transition affecting any changes to this layer’s `iconTranslation` property.
+
+ This property corresponds to the `icon-translate-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition iconTranslationTransition;
+
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *iconTranslate __attribute__((unavailable("Use iconTranslation instead.")));
/**
@@ -1464,7 +1507,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
@@ -1485,7 +1528,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1513,7 +1556,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1531,6 +1574,13 @@ MGL_EXPORT
#endif
/**
+ The transition affecting any changes to this layer’s `textColor` property.
+
+ This property corresponds to the `text-color-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition textColorTransition;
+
+/**
The halo's fadeout distance towards the outside.
This property is measured in points.
@@ -1544,7 +1594,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1560,6 +1610,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *textHaloBlur;
+/**
+ The transition affecting any changes to this layer’s `textHaloBlur` property.
+
+ This property corresponds to the `text-halo-blur-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition textHaloBlurTransition;
+
#if TARGET_OS_IPHONE
/**
The color of the text's halo, which helps it stand out from backgrounds.
@@ -1573,7 +1630,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1601,7 +1658,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1619,6 +1676,13 @@ MGL_EXPORT
#endif
/**
+ The transition affecting any changes to this layer’s `textHaloColor` property.
+
+ This property corresponds to the `text-halo-color-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition textHaloColorTransition;
+
+/**
Distance of halo to the font outline. Max text halo width is 1/4 of the
font-size.
@@ -1633,7 +1697,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1650,6 +1714,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *textHaloWidth;
/**
+ The transition affecting any changes to this layer’s `textHaloWidth` property.
+
+ This property corresponds to the `text-halo-width-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition textHaloWidthTransition;
+
+/**
The opacity at which the text will be drawn.
The default value of this property is an `MGLStyleValue` object containing an
@@ -1661,7 +1732,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1677,6 +1748,13 @@ MGL_EXPORT
*/
@property (nonatomic, null_resettable) MGLStyleValue<NSNumber *> *textOpacity;
+/**
+ The transition affecting any changes to this layer’s `textOpacity` property.
+
+ This property corresponds to the `text-opacity-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition textOpacityTransition;
+
#if TARGET_OS_IPHONE
/**
Distance that the text's anchor is moved from its original placement.
@@ -1696,7 +1774,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1721,7 +1799,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of:
* `MGLInterpolationModeExponential`
* `MGLInterpolationModeInterval`
@@ -1729,6 +1807,13 @@ MGL_EXPORT
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *textTranslation;
#endif
+/**
+ The transition affecting any changes to this layer’s `textTranslation` property.
+
+ This property corresponds to the `text-translate-transition` property in the style JSON file format.
+*/
+@property (nonatomic) MGLTransition textTranslationTransition;
+
@property (nonatomic, null_resettable) MGLStyleValue<NSValue *> *textTranslate __attribute__((unavailable("Use textTranslation instead.")));
/**
@@ -1747,7 +1832,7 @@ MGL_EXPORT
You can set this property to an instance of:
- * `MGLStyleConstantValue`
+ * `MGLConstantStyleValue`
* `MGLCameraStyleFunction` with an interpolation mode of
`MGLInterpolationModeInterval`
*/
diff --git a/platform/darwin/src/MGLSymbolStyleLayer.mm b/platform/darwin/src/MGLSymbolStyleLayer.mm
index 52648e7a05..8441931685 100644
--- a/platform/darwin/src/MGLSymbolStyleLayer.mm
+++ b/platform/darwin/src/MGLSymbolStyleLayer.mm
@@ -4,6 +4,7 @@
#import "MGLSource.h"
#import "MGLMapView_Private.h"
#import "NSPredicate+MGLAdditions.h"
+#import "NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#import "MGLStyleValue_Private.h"
#import "MGLSymbolStyleLayer.h"
@@ -904,6 +905,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setIconColorTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setIconColorTransition(options);
+}
+
+- (MGLTransition)iconColorTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getIconColorTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setIconHaloBlur:(MGLStyleValue<NSNumber *> *)iconHaloBlur {
MGLAssertStyleLayerIsValid();
@@ -921,6 +940,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setIconHaloBlurTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setIconHaloBlurTransition(options);
+}
+
+- (MGLTransition)iconHaloBlurTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getIconHaloBlurTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setIconHaloColor:(MGLStyleValue<MGLColor *> *)iconHaloColor {
MGLAssertStyleLayerIsValid();
@@ -938,6 +975,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setIconHaloColorTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setIconHaloColorTransition(options);
+}
+
+- (MGLTransition)iconHaloColorTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getIconHaloColorTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setIconHaloWidth:(MGLStyleValue<NSNumber *> *)iconHaloWidth {
MGLAssertStyleLayerIsValid();
@@ -955,6 +1010,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setIconHaloWidthTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setIconHaloWidthTransition(options);
+}
+
+- (MGLTransition)iconHaloWidthTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getIconHaloWidthTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setIconOpacity:(MGLStyleValue<NSNumber *> *)iconOpacity {
MGLAssertStyleLayerIsValid();
@@ -972,6 +1045,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setIconOpacityTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setIconOpacityTransition(options);
+}
+
+- (MGLTransition)iconOpacityTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getIconOpacityTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setIconTranslation:(MGLStyleValue<NSValue *> *)iconTranslation {
MGLAssertStyleLayerIsValid();
@@ -989,6 +1080,24 @@ namespace mbgl {
return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
+- (void)setIconTranslationTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setIconTranslateTransition(options);
+}
+
+- (MGLTransition)iconTranslationTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getIconTranslateTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setIconTranslate:(MGLStyleValue<NSValue *> *)iconTranslate {
}
@@ -1037,6 +1146,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setTextColorTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setTextColorTransition(options);
+}
+
+- (MGLTransition)textColorTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getTextColorTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setTextHaloBlur:(MGLStyleValue<NSNumber *> *)textHaloBlur {
MGLAssertStyleLayerIsValid();
@@ -1054,6 +1181,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setTextHaloBlurTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setTextHaloBlurTransition(options);
+}
+
+- (MGLTransition)textHaloBlurTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getTextHaloBlurTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setTextHaloColor:(MGLStyleValue<MGLColor *> *)textHaloColor {
MGLAssertStyleLayerIsValid();
@@ -1071,6 +1216,24 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::Color, MGLColor *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setTextHaloColorTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setTextHaloColorTransition(options);
+}
+
+- (MGLTransition)textHaloColorTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getTextHaloColorTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setTextHaloWidth:(MGLStyleValue<NSNumber *> *)textHaloWidth {
MGLAssertStyleLayerIsValid();
@@ -1088,6 +1251,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setTextHaloWidthTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setTextHaloWidthTransition(options);
+}
+
+- (MGLTransition)textHaloWidthTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getTextHaloWidthTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setTextOpacity:(MGLStyleValue<NSNumber *> *)textOpacity {
MGLAssertStyleLayerIsValid();
@@ -1105,6 +1286,24 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toDataDrivenStyleValue(propertyValue);
}
+- (void)setTextOpacityTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setTextOpacityTransition(options);
+}
+
+- (MGLTransition)textOpacityTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getTextOpacityTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setTextTranslation:(MGLStyleValue<NSValue *> *)textTranslation {
MGLAssertStyleLayerIsValid();
@@ -1122,6 +1321,24 @@ namespace mbgl {
return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
+- (void)setTextTranslationTransition:(MGLTransition )transition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions options { { MGLDurationFromTimeInterval(transition.duration) }, { MGLDurationFromTimeInterval(transition.delay) } };
+ self.rawLayer->setTextTranslateTransition(options);
+}
+
+- (MGLTransition)textTranslationTransition {
+ MGLAssertStyleLayerIsValid();
+
+ mbgl::style::TransitionOptions transitionOptions = self.rawLayer->getTextTranslateTransition();
+ MGLTransition transition;
+ transition.duration = MGLTimeIntervalFromDuration(transitionOptions.duration.value_or(mbgl::Duration::zero()));
+ transition.delay = MGLTimeIntervalFromDuration(transitionOptions.delay.value_or(mbgl::Duration::zero()));
+
+ return transition;
+}
+
- (void)setTextTranslate:(MGLStyleValue<NSValue *> *)textTranslate {
}
@@ -1153,7 +1370,6 @@ namespace mbgl {
return self.textTranslationAnchor;
}
-
@end
@implementation NSValue (MGLSymbolStyleLayerAdditions)
diff --git a/platform/darwin/src/MGLTileSource.h b/platform/darwin/src/MGLTileSource.h
index bc29b0f95c..54c756332d 100644
--- a/platform/darwin/src/MGLTileSource.h
+++ b/platform/darwin/src/MGLTileSource.h
@@ -135,6 +135,10 @@ typedef NS_ENUM(NSUInteger, MGLTileCoordinateSystem) {
A tile source is added to an `MGLStyle` object along with one or more
`MGLRasterStyleLayer` or `MGLVectorStyleLayer` objects. Use a style layer to
control the appearance of content supplied by the tile source.
+
+ A tile source is also known as a tile set. To learn about the structure of a
+ Mapbox-hosted tile set, view it in
+ <a href="https://www.mapbox.com/studio/tilesets/">Mapbox Studio’s Tilesets editor</a>.
Do not create instances of this class directly, and do not create your own
subclasses of this class. Instead, create instances of `MGLRasterSource` and
diff --git a/platform/darwin/src/MGLTypes.h b/platform/darwin/src/MGLTypes.h
index e4573c285e..c06fd8b0e7 100644
--- a/platform/darwin/src/MGLTypes.h
+++ b/platform/darwin/src/MGLTypes.h
@@ -48,21 +48,6 @@ typedef NS_ENUM(NSInteger, MGLErrorCode) {
MGLErrorCodeLoadStyleFailed = 5,
};
-/**
- The mode used to track the user location on the map. Used with
- `MGLMapView.userTrackingMode`.
- */
-typedef NS_ENUM(NSUInteger, MGLUserTrackingMode) {
- /** The map does not follow the user location. */
- MGLUserTrackingModeNone = 0,
- /** The map follows the user location. */
- MGLUserTrackingModeFollow,
- /** The map follows the user location and rotates when the heading changes. */
- MGLUserTrackingModeFollowWithHeading,
- /** The map follows the user location and rotates when the course changes. */
- MGLUserTrackingModeFollowWithCourse,
-};
-
/** Options for enabling debugging features in an `MGLMapView` instance. */
typedef NS_OPTIONS(NSUInteger, MGLMapDebugMaskOptions) {
/** Edges of tile boundaries are shown as thick, red lines to help diagnose
@@ -89,6 +74,39 @@ typedef NS_OPTIONS(NSUInteger, MGLMapDebugMaskOptions) {
#endif
};
+/**
+ A structure containing information about a transition.
+ */
+typedef struct MGLTransition {
+ /**
+ The amount of time the animation should take, not including the delay.
+ */
+ NSTimeInterval duration;
+
+ /**
+ The amount of time in seconds to wait before beginning the animation.
+ */
+ NSTimeInterval delay;
+} MGLTransition;
+
+/**
+ Creates a new `MGLTransition` from the given duration and delay.
+
+ @param duration The amount of time the animation should take, not including
+ the delay.
+ @param delay The amount of time in seconds to wait before beginning the
+ animation.
+
+ @return Returns a `MGLTransition` struct containing the transition attributes.
+ */
+NS_INLINE MGLTransition MGLTransitionMake(NSTimeInterval duration, NSTimeInterval delay) {
+ MGLTransition transition;
+ transition.duration = duration;
+ transition.delay = delay;
+
+ return transition;
+}
+
NS_ASSUME_NONNULL_END
#ifndef NS_ARRAY_OF
diff --git a/platform/darwin/src/MGLVectorSource.h b/platform/darwin/src/MGLVectorSource.h
index 8634316809..83926fd287 100644
--- a/platform/darwin/src/MGLVectorSource.h
+++ b/platform/darwin/src/MGLVectorSource.h
@@ -26,6 +26,12 @@ NS_ASSUME_NONNULL_BEGIN
(<var>extent</var>&nbsp;×&nbsp;2)&nbsp;−&nbsp;1, inclusive. Any vector style
layer initialized with a vector source must have a non-`nil` value in its
`sourceLayerIdentifier` property.
+
+ Commonly used vector sources include
+ <a href="https://www.mapbox.com/vector-tiles/mapbox-streets/">Mapbox Streets</a>,
+ <a href="https://www.mapbox.com/vector-tiles/mapbox-terrain/">Mapbox Terrain</a>,
+ and
+ <a href="https://www.mapbox.com/vector-tiles/mapbox-traffic-v1/">Mapbox Traffic</a>.
### Example
@@ -52,23 +58,39 @@ MGL_EXPORT
#pragma mark Accessing a Source’s Content
/**
- Returns an array of map features loaded by this source, restricted to the
- given source layers and filtered by the given predicate.
-
- Each object in the returned array represents a feature for the
- current style and provides access to attributes specified by the
- <a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources">source</a>.
-
- Features come from tiled vector data that is converted to tiles internally,
- so feature geometries are clipped at tile boundaries and features
- may appear duplicated across tiles.
-
- @param sourceLayerIdentifiers The source layers to include in the query. Only the
- features contained in these source layers are included in the returned array. At
- least one source layer is required.
- @param predicate A predicate to filter the returned features.
+ Returns an array of map features loaded by this source, restricted to the given
+ source layers and filtered by the given predicate.
+
+ Each object in the returned array represents a feature loaded by the source and
+ provides access to attributes specified as part of the loaded feature. The
+ source loads a feature if the source is added to an `MGLMapView`’s style; that
+ style has a layer that uses the source; and the map view has recently scrolled
+ to the region containing the feature.
+
+ Features come from tiled vector data that is converted to tiles internally, so
+ feature geometries are clipped at tile boundaries and features may appear
+ duplicated across tiles. For example, suppose part of a lengthy polyline
+ representing a road has recently scrolled into view. The resulting array
+ includes those parts of the road that lie within the map tiles that the source
+ has loaded, even if the road extends into other tiles. The portion of the road
+ within each map tile is included individually.
+
+ Returned features may not necessarily be visible to the user at the time they
+ are loaded: the style may contain a layer that forces the source’s tiles to
+ load but filters out the features in question, preventing them from being
+ drawn. To obtain only _visible_ features, use the
+ `-[MGLMapView visibleFeaturesAtPoint:inStyleLayersWithIdentifiers:predicate:]`
+ or
+ `-[MGLMapView visibleFeaturesInRect:inStyleLayersWithIdentifiers:predicate:]`
+ method.
+
+ @param sourceLayerIdentifiers The source layers to include in the query. Only
+ the features contained in these source layers are included in the returned
+ array. This array may not be empty.
+ @param predicate A predicate to filter the returned features. Use `nil` to
+ include all loaded features.
@return An array of objects conforming to the `MGLFeature` protocol that
- represent features in the sources used by the current style.
+ represent features loaded by the source that match the predicate.
*/
- (NS_ARRAY_OF(id <MGLFeature>) *)featuresInSourceLayersWithIdentifiers:(NS_SET_OF(NSString *) *)sourceLayerIdentifiers predicate:(nullable NSPredicate *)predicate NS_SWIFT_NAME(features(sourceLayerIdentifiers:predicate:));
diff --git a/platform/darwin/src/NSDate+MGLAdditions.h b/platform/darwin/src/NSDate+MGLAdditions.h
index 820d1bd9e2..1da03fda62 100644
--- a/platform/darwin/src/NSDate+MGLAdditions.h
+++ b/platform/darwin/src/NSDate+MGLAdditions.h
@@ -1,13 +1,17 @@
#import <Foundation/Foundation.h>
+#import "MGLFoundation.h"
#include <mbgl/util/chrono.hpp>
-@interface NSDate (MGLAdditions)
+NS_ASSUME_NONNULL_BEGIN
+
/// Converts from a duration in seconds to a duration object usable in mbgl.
-mbgl::Duration MGLDurationInSecondsFromTimeInterval(NSTimeInterval duration);
+MGL_EXPORT
+mbgl::Duration MGLDurationFromTimeInterval(NSTimeInterval duration);
/// Converts from an mbgl duration object to a duration in seconds.
-NSTimeInterval MGLTimeIntervalFromDurationInSeconds(mbgl::Duration duration);
+MGL_EXPORT
+NSTimeInterval MGLTimeIntervalFromDuration(mbgl::Duration duration);
-@end
+NS_ASSUME_NONNULL_END
diff --git a/platform/darwin/src/NSDate+MGLAdditions.mm b/platform/darwin/src/NSDate+MGLAdditions.mm
index deac3c4881..b45b41f836 100644
--- a/platform/darwin/src/NSDate+MGLAdditions.mm
+++ b/platform/darwin/src/NSDate+MGLAdditions.mm
@@ -1,15 +1,11 @@
#import "NSDate+MGLAdditions.h"
-@implementation NSDate (MGLAdditions)
-
-mbgl::Duration MGLDurationInSecondsFromTimeInterval(NSTimeInterval duration)
+mbgl::Duration MGLDurationFromTimeInterval(NSTimeInterval duration)
{
return std::chrono::duration_cast<mbgl::Duration>(std::chrono::duration<NSTimeInterval>(duration));
}
-NSTimeInterval MGLTimeIntervalFromDurationInSeconds(mbgl::Duration duration)
+NSTimeInterval MGLTimeIntervalFromDuration(mbgl::Duration duration)
{
- return duration.count();
+ return std::chrono::duration<NSTimeInterval, std::ratio<1>>(duration).count();
}
-
-@end
diff --git a/platform/darwin/src/NSString+MGLAdditions.h b/platform/darwin/src/NSString+MGLAdditions.h
index ff72e9d3af..d82ecaa671 100644
--- a/platform/darwin/src/NSString+MGLAdditions.h
+++ b/platform/darwin/src/NSString+MGLAdditions.h
@@ -14,8 +14,9 @@ NS_ASSUME_NONNULL_BEGIN
Returns a title-cased representation of the receiver using the specified
locale.
- @param The locale. For strings presented to users, pass in the current locale
- (`+[NSLocale currentLocale]`). To use the system locale, pass in `nil`.
+ @param locale The locale. For strings presented to users, pass in the current
+ locale (`+[NSLocale currentLocale]`). To use the system locale, pass in
+ `nil`.
*/
- (NSString *)mgl_titleCasedStringWithLocale:(NSLocale *)locale;
diff --git a/platform/darwin/src/NSValue+MGLAdditions.h b/platform/darwin/src/NSValue+MGLAdditions.h
index 76388cf2bb..e6755021d0 100644
--- a/platform/darwin/src/NSValue+MGLAdditions.h
+++ b/platform/darwin/src/NSValue+MGLAdditions.h
@@ -2,6 +2,7 @@
#import "MGLGeometry.h"
#import "MGLOfflinePack.h"
+#import "MGLTypes.h"
NS_ASSUME_NONNULL_BEGIN
@@ -70,6 +71,22 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property (readonly) MGLOfflinePackProgress MGLOfflinePackProgressValue;
+#pragma mark Working with Transition Values
+
+/**
+ Creates a new value object containing the given `MGLTransition`
+ structure.
+
+ @param transition The value for the new object.
+ @return A new value object that contains the transition information.
+ */
++ (NSValue *)valueWithMGLTransition:(MGLTransition)transition;
+
+/**
+ The `MGLTransition` structure representation of the value.
+ */
+@property (readonly) MGLTransition MGLTransitionValue;
+
@end
NS_ASSUME_NONNULL_END
diff --git a/platform/darwin/src/NSValue+MGLAdditions.m b/platform/darwin/src/NSValue+MGLAdditions.m
index 0d2128bea8..a95ef23941 100644
--- a/platform/darwin/src/NSValue+MGLAdditions.m
+++ b/platform/darwin/src/NSValue+MGLAdditions.m
@@ -46,4 +46,16 @@
return progress;
}
+#pragma mark Working with Transition Values
+
++ (NSValue *)valueWithMGLTransition:(MGLTransition)transition; {
+ return [NSValue value:&transition withObjCType:@encode(MGLTransition)];
+}
+
+- (MGLTransition)MGLTransitionValue {
+ MGLTransition transition;
+ [self getValue:&transition];
+ return transition;
+}
+
@end
diff --git a/platform/darwin/test/MGLBackgroundStyleLayerTests.mm b/platform/darwin/test/MGLBackgroundStyleLayerTests.mm
index 92c0ac7cbc..c96a4fe7fa 100644
--- a/platform/darwin/test/MGLBackgroundStyleLayerTests.mm
+++ b/platform/darwin/test/MGLBackgroundStyleLayerTests.mm
@@ -2,10 +2,12 @@
// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLStyleLayerTests.h"
+#import "../../darwin/src/NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/background_layer.hpp>
+#include <mbgl/style/transition_options.hpp>
@interface MGLBackgroundLayerTests : MGLStyleLayerTests
@end
@@ -22,6 +24,9 @@
XCTAssertTrue(layer.rawLayer->is<mbgl::style::BackgroundLayer>());
auto rawLayer = layer.rawLayer->as<mbgl::style::BackgroundLayer>();
+ MGLTransition transitionTest = MGLTransitionMake(5, 4);
+
+
// background-color
{
XCTAssertTrue(rawLayer->getBackgroundColor().isUndefined(),
@@ -59,6 +64,15 @@
XCTAssertThrowsSpecificNamed(layer.backgroundColor = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<MGLColor *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.backgroundColor = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
+ // Transition property test
+ layer.backgroundColorTransition = transitionTest;
+ auto toptions = rawLayer->getBackgroundColorTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition backgroundColorTransition = layer.backgroundColorTransition;
+ XCTAssertEqual(backgroundColorTransition.delay, transitionTest.delay);
+ XCTAssertEqual(backgroundColorTransition.duration, transitionTest.duration);
}
// background-opacity
@@ -98,6 +112,15 @@
XCTAssertThrowsSpecificNamed(layer.backgroundOpacity = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<NSNumber *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.backgroundOpacity = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
+ // Transition property test
+ layer.backgroundOpacityTransition = transitionTest;
+ auto toptions = rawLayer->getBackgroundOpacityTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition backgroundOpacityTransition = layer.backgroundOpacityTransition;
+ XCTAssertEqual(backgroundOpacityTransition.delay, transitionTest.delay);
+ XCTAssertEqual(backgroundOpacityTransition.duration, transitionTest.duration);
}
// background-pattern
@@ -137,6 +160,15 @@
XCTAssertThrowsSpecificNamed(layer.backgroundPattern = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<NSString *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.backgroundPattern = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
+ // Transition property test
+ layer.backgroundPatternTransition = transitionTest;
+ auto toptions = rawLayer->getBackgroundPatternTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition backgroundPatternTransition = layer.backgroundPatternTransition;
+ XCTAssertEqual(backgroundPatternTransition.delay, transitionTest.delay);
+ XCTAssertEqual(backgroundPatternTransition.duration, transitionTest.duration);
}
}
diff --git a/platform/darwin/test/MGLCircleStyleLayerTests.mm b/platform/darwin/test/MGLCircleStyleLayerTests.mm
index d7515e8e4e..2a2e9f2d4a 100644
--- a/platform/darwin/test/MGLCircleStyleLayerTests.mm
+++ b/platform/darwin/test/MGLCircleStyleLayerTests.mm
@@ -2,10 +2,12 @@
// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLStyleLayerTests.h"
+#import "../../darwin/src/NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/circle_layer.hpp>
+#include <mbgl/style/transition_options.hpp>
@interface MGLCircleLayerTests : MGLStyleLayerTests
@end
@@ -43,6 +45,9 @@
XCTAssertTrue(layer.rawLayer->is<mbgl::style::CircleLayer>());
auto rawLayer = layer.rawLayer->as<mbgl::style::CircleLayer>();
+ MGLTransition transitionTest = MGLTransitionMake(5, 4);
+
+
// circle-blur
{
XCTAssertTrue(rawLayer->getCircleBlur().isUndefined(),
@@ -98,6 +103,15 @@
@"Unsetting circleBlur should return circle-blur to the default value.");
XCTAssertEqualObjects(layer.circleBlur, defaultStyleValue,
@"circleBlur should return the default value after being unset.");
+ // Transition property test
+ layer.circleBlurTransition = transitionTest;
+ auto toptions = rawLayer->getCircleBlurTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition circleBlurTransition = layer.circleBlurTransition;
+ XCTAssertEqual(circleBlurTransition.delay, transitionTest.delay);
+ XCTAssertEqual(circleBlurTransition.duration, transitionTest.duration);
}
// circle-color
@@ -155,6 +169,15 @@
@"Unsetting circleColor should return circle-color to the default value.");
XCTAssertEqualObjects(layer.circleColor, defaultStyleValue,
@"circleColor should return the default value after being unset.");
+ // Transition property test
+ layer.circleColorTransition = transitionTest;
+ auto toptions = rawLayer->getCircleColorTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition circleColorTransition = layer.circleColorTransition;
+ XCTAssertEqual(circleColorTransition.delay, transitionTest.delay);
+ XCTAssertEqual(circleColorTransition.duration, transitionTest.duration);
}
// circle-opacity
@@ -212,6 +235,15 @@
@"Unsetting circleOpacity should return circle-opacity to the default value.");
XCTAssertEqualObjects(layer.circleOpacity, defaultStyleValue,
@"circleOpacity should return the default value after being unset.");
+ // Transition property test
+ layer.circleOpacityTransition = transitionTest;
+ auto toptions = rawLayer->getCircleOpacityTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition circleOpacityTransition = layer.circleOpacityTransition;
+ XCTAssertEqual(circleOpacityTransition.delay, transitionTest.delay);
+ XCTAssertEqual(circleOpacityTransition.duration, transitionTest.duration);
}
// circle-radius
@@ -269,6 +301,15 @@
@"Unsetting circleRadius should return circle-radius to the default value.");
XCTAssertEqualObjects(layer.circleRadius, defaultStyleValue,
@"circleRadius should return the default value after being unset.");
+ // Transition property test
+ layer.circleRadiusTransition = transitionTest;
+ auto toptions = rawLayer->getCircleRadiusTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition circleRadiusTransition = layer.circleRadiusTransition;
+ XCTAssertEqual(circleRadiusTransition.delay, transitionTest.delay);
+ XCTAssertEqual(circleRadiusTransition.duration, transitionTest.duration);
}
// circle-pitch-scale
@@ -365,6 +406,15 @@
@"Unsetting circleStrokeColor should return circle-stroke-color to the default value.");
XCTAssertEqualObjects(layer.circleStrokeColor, defaultStyleValue,
@"circleStrokeColor should return the default value after being unset.");
+ // Transition property test
+ layer.circleStrokeColorTransition = transitionTest;
+ auto toptions = rawLayer->getCircleStrokeColorTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition circleStrokeColorTransition = layer.circleStrokeColorTransition;
+ XCTAssertEqual(circleStrokeColorTransition.delay, transitionTest.delay);
+ XCTAssertEqual(circleStrokeColorTransition.duration, transitionTest.duration);
}
// circle-stroke-opacity
@@ -422,6 +472,15 @@
@"Unsetting circleStrokeOpacity should return circle-stroke-opacity to the default value.");
XCTAssertEqualObjects(layer.circleStrokeOpacity, defaultStyleValue,
@"circleStrokeOpacity should return the default value after being unset.");
+ // Transition property test
+ layer.circleStrokeOpacityTransition = transitionTest;
+ auto toptions = rawLayer->getCircleStrokeOpacityTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition circleStrokeOpacityTransition = layer.circleStrokeOpacityTransition;
+ XCTAssertEqual(circleStrokeOpacityTransition.delay, transitionTest.delay);
+ XCTAssertEqual(circleStrokeOpacityTransition.duration, transitionTest.duration);
}
// circle-stroke-width
@@ -479,6 +538,15 @@
@"Unsetting circleStrokeWidth should return circle-stroke-width to the default value.");
XCTAssertEqualObjects(layer.circleStrokeWidth, defaultStyleValue,
@"circleStrokeWidth should return the default value after being unset.");
+ // Transition property test
+ layer.circleStrokeWidthTransition = transitionTest;
+ auto toptions = rawLayer->getCircleStrokeWidthTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition circleStrokeWidthTransition = layer.circleStrokeWidthTransition;
+ XCTAssertEqual(circleStrokeWidthTransition.delay, transitionTest.delay);
+ XCTAssertEqual(circleStrokeWidthTransition.duration, transitionTest.duration);
}
// circle-translate
diff --git a/platform/darwin/test/MGLFillStyleLayerTests.mm b/platform/darwin/test/MGLFillStyleLayerTests.mm
index c03b22c399..85f0b24fa7 100644
--- a/platform/darwin/test/MGLFillStyleLayerTests.mm
+++ b/platform/darwin/test/MGLFillStyleLayerTests.mm
@@ -2,10 +2,12 @@
// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLStyleLayerTests.h"
+#import "../../darwin/src/NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/fill_layer.hpp>
+#include <mbgl/style/transition_options.hpp>
@interface MGLFillLayerTests : MGLStyleLayerTests
@end
@@ -43,6 +45,9 @@
XCTAssertTrue(layer.rawLayer->is<mbgl::style::FillLayer>());
auto rawLayer = layer.rawLayer->as<mbgl::style::FillLayer>();
+ MGLTransition transitionTest = MGLTransitionMake(5, 4);
+
+
// fill-antialias
{
XCTAssertTrue(rawLayer->getFillAntialias().isUndefined(),
@@ -137,6 +142,15 @@
@"Unsetting fillColor should return fill-color to the default value.");
XCTAssertEqualObjects(layer.fillColor, defaultStyleValue,
@"fillColor should return the default value after being unset.");
+ // Transition property test
+ layer.fillColorTransition = transitionTest;
+ auto toptions = rawLayer->getFillColorTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition fillColorTransition = layer.fillColorTransition;
+ XCTAssertEqual(fillColorTransition.delay, transitionTest.delay);
+ XCTAssertEqual(fillColorTransition.duration, transitionTest.duration);
}
// fill-opacity
@@ -194,6 +208,15 @@
@"Unsetting fillOpacity should return fill-opacity to the default value.");
XCTAssertEqualObjects(layer.fillOpacity, defaultStyleValue,
@"fillOpacity should return the default value after being unset.");
+ // Transition property test
+ layer.fillOpacityTransition = transitionTest;
+ auto toptions = rawLayer->getFillOpacityTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition fillOpacityTransition = layer.fillOpacityTransition;
+ XCTAssertEqual(fillOpacityTransition.delay, transitionTest.delay);
+ XCTAssertEqual(fillOpacityTransition.duration, transitionTest.duration);
}
// fill-outline-color
@@ -251,6 +274,15 @@
@"Unsetting fillOutlineColor should return fill-outline-color to the default value.");
XCTAssertEqualObjects(layer.fillOutlineColor, defaultStyleValue,
@"fillOutlineColor should return the default value after being unset.");
+ // Transition property test
+ layer.fillOutlineColorTransition = transitionTest;
+ auto toptions = rawLayer->getFillOutlineColorTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition fillOutlineColorTransition = layer.fillOutlineColorTransition;
+ XCTAssertEqual(fillOutlineColorTransition.delay, transitionTest.delay);
+ XCTAssertEqual(fillOutlineColorTransition.duration, transitionTest.duration);
}
// fill-pattern
@@ -290,6 +322,15 @@
XCTAssertThrowsSpecificNamed(layer.fillPattern = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<NSString *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.fillPattern = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
+ // Transition property test
+ layer.fillPatternTransition = transitionTest;
+ auto toptions = rawLayer->getFillPatternTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition fillPatternTransition = layer.fillPatternTransition;
+ XCTAssertEqual(fillPatternTransition.delay, transitionTest.delay);
+ XCTAssertEqual(fillPatternTransition.duration, transitionTest.duration);
}
// fill-translate
diff --git a/platform/darwin/test/MGLLineStyleLayerTests.mm b/platform/darwin/test/MGLLineStyleLayerTests.mm
index 95c3e434c0..1e92959520 100644
--- a/platform/darwin/test/MGLLineStyleLayerTests.mm
+++ b/platform/darwin/test/MGLLineStyleLayerTests.mm
@@ -2,10 +2,12 @@
// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLStyleLayerTests.h"
+#import "../../darwin/src/NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/line_layer.hpp>
+#include <mbgl/style/transition_options.hpp>
@interface MGLLineLayerTests : MGLStyleLayerTests
@end
@@ -43,6 +45,9 @@
XCTAssertTrue(layer.rawLayer->is<mbgl::style::LineLayer>());
auto rawLayer = layer.rawLayer->as<mbgl::style::LineLayer>();
+ MGLTransition transitionTest = MGLTransitionMake(5, 4);
+
+
// line-cap
{
XCTAssertTrue(rawLayer->getLineCap().isUndefined(),
@@ -254,6 +259,15 @@
@"Unsetting lineBlur should return line-blur to the default value.");
XCTAssertEqualObjects(layer.lineBlur, defaultStyleValue,
@"lineBlur should return the default value after being unset.");
+ // Transition property test
+ layer.lineBlurTransition = transitionTest;
+ auto toptions = rawLayer->getLineBlurTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition lineBlurTransition = layer.lineBlurTransition;
+ XCTAssertEqual(lineBlurTransition.delay, transitionTest.delay);
+ XCTAssertEqual(lineBlurTransition.duration, transitionTest.duration);
}
// line-color
@@ -311,6 +325,15 @@
@"Unsetting lineColor should return line-color to the default value.");
XCTAssertEqualObjects(layer.lineColor, defaultStyleValue,
@"lineColor should return the default value after being unset.");
+ // Transition property test
+ layer.lineColorTransition = transitionTest;
+ auto toptions = rawLayer->getLineColorTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition lineColorTransition = layer.lineColorTransition;
+ XCTAssertEqual(lineColorTransition.delay, transitionTest.delay);
+ XCTAssertEqual(lineColorTransition.duration, transitionTest.duration);
}
// line-dasharray
@@ -407,6 +430,15 @@
@"Unsetting lineGapWidth should return line-gap-width to the default value.");
XCTAssertEqualObjects(layer.lineGapWidth, defaultStyleValue,
@"lineGapWidth should return the default value after being unset.");
+ // Transition property test
+ layer.lineGapWidthTransition = transitionTest;
+ auto toptions = rawLayer->getLineGapWidthTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition lineGapWidthTransition = layer.lineGapWidthTransition;
+ XCTAssertEqual(lineGapWidthTransition.delay, transitionTest.delay);
+ XCTAssertEqual(lineGapWidthTransition.duration, transitionTest.duration);
}
// line-offset
@@ -464,6 +496,15 @@
@"Unsetting lineOffset should return line-offset to the default value.");
XCTAssertEqualObjects(layer.lineOffset, defaultStyleValue,
@"lineOffset should return the default value after being unset.");
+ // Transition property test
+ layer.lineOffsetTransition = transitionTest;
+ auto toptions = rawLayer->getLineOffsetTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition lineOffsetTransition = layer.lineOffsetTransition;
+ XCTAssertEqual(lineOffsetTransition.delay, transitionTest.delay);
+ XCTAssertEqual(lineOffsetTransition.duration, transitionTest.duration);
}
// line-opacity
@@ -521,6 +562,15 @@
@"Unsetting lineOpacity should return line-opacity to the default value.");
XCTAssertEqualObjects(layer.lineOpacity, defaultStyleValue,
@"lineOpacity should return the default value after being unset.");
+ // Transition property test
+ layer.lineOpacityTransition = transitionTest;
+ auto toptions = rawLayer->getLineOpacityTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition lineOpacityTransition = layer.lineOpacityTransition;
+ XCTAssertEqual(lineOpacityTransition.delay, transitionTest.delay);
+ XCTAssertEqual(lineOpacityTransition.duration, transitionTest.duration);
}
// line-pattern
@@ -560,6 +610,15 @@
XCTAssertThrowsSpecificNamed(layer.linePattern = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<NSString *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.linePattern = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
+ // Transition property test
+ layer.linePatternTransition = transitionTest;
+ auto toptions = rawLayer->getLinePatternTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition linePatternTransition = layer.linePatternTransition;
+ XCTAssertEqual(linePatternTransition.delay, transitionTest.delay);
+ XCTAssertEqual(linePatternTransition.duration, transitionTest.duration);
}
// line-translate
@@ -683,6 +742,15 @@
XCTAssertThrowsSpecificNamed(layer.lineWidth = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<NSNumber *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.lineWidth = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
+ // Transition property test
+ layer.lineWidthTransition = transitionTest;
+ auto toptions = rawLayer->getLineWidthTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition lineWidthTransition = layer.lineWidthTransition;
+ XCTAssertEqual(lineWidthTransition.delay, transitionTest.delay);
+ XCTAssertEqual(lineWidthTransition.duration, transitionTest.duration);
}
}
diff --git a/platform/darwin/test/MGLNSDateAdditionsTests.mm b/platform/darwin/test/MGLNSDateAdditionsTests.mm
new file mode 100644
index 0000000000..6d8d951024
--- /dev/null
+++ b/platform/darwin/test/MGLNSDateAdditionsTests.mm
@@ -0,0 +1,40 @@
+#import <XCTest/XCTest.h>
+
+#include <mbgl/util/chrono.hpp>
+#import "../../darwin/src/NSDate+MGLAdditions.h"
+
+using namespace std::chrono_literals;
+
+@interface MGLNSDateAdditionsTests : XCTestCase
+@end
+
+@implementation MGLNSDateAdditionsTests
+
+- (void)testDurationToNSTimeInterval {
+
+ NSTimeInterval timeInterval = 5;
+ mbgl::Duration duration = MGLDurationFromTimeInterval(timeInterval);
+ NSTimeInterval durationTimeInterval = MGLTimeIntervalFromDuration(duration);
+
+ mbgl::Duration expectedDuration = 5s;
+ mbgl::Duration expectedDurationMiliSeconds = 5000ms;
+ mbgl::Duration expectedDurationMicroSeconds = 5000000us;
+ mbgl::Duration expectedDurationNanoSeconds = 5000000000ns;
+
+ XCTAssertEqual(timeInterval, durationTimeInterval);
+ XCTAssertEqual(timeInterval, MGLTimeIntervalFromDuration(expectedDuration));
+ XCTAssertEqual(timeInterval, MGLTimeIntervalFromDuration(expectedDurationMiliSeconds));
+ XCTAssertEqual(timeInterval, MGLTimeIntervalFromDuration(expectedDurationMicroSeconds));
+ XCTAssertEqual(timeInterval, MGLTimeIntervalFromDuration(expectedDurationNanoSeconds));
+
+ mbgl::Duration durationMiliSeconds = 2500ms;
+ mbgl::Duration durationMicroSeconds = 2500000us;
+ mbgl::Duration durationNanoSeconds = 2500000000ns;
+
+ XCTAssertEqual(NSTimeInterval(2.5), MGLTimeIntervalFromDuration(durationMiliSeconds));
+ XCTAssertEqual(NSTimeInterval(2.5), MGLTimeIntervalFromDuration(durationMicroSeconds));
+ XCTAssertEqual(NSTimeInterval(2.5), MGLTimeIntervalFromDuration(durationNanoSeconds));
+
+}
+
+@end
diff --git a/platform/darwin/test/MGLRasterStyleLayerTests.mm b/platform/darwin/test/MGLRasterStyleLayerTests.mm
index b7a764e6c2..7b0757eeb6 100644
--- a/platform/darwin/test/MGLRasterStyleLayerTests.mm
+++ b/platform/darwin/test/MGLRasterStyleLayerTests.mm
@@ -2,10 +2,12 @@
// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLStyleLayerTests.h"
+#import "../../darwin/src/NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/raster_layer.hpp>
+#include <mbgl/style/transition_options.hpp>
@interface MGLRasterLayerTests : MGLStyleLayerTests
@end
@@ -25,6 +27,9 @@
XCTAssertTrue(layer.rawLayer->is<mbgl::style::RasterLayer>());
auto rawLayer = layer.rawLayer->as<mbgl::style::RasterLayer>();
+ MGLTransition transitionTest = MGLTransitionMake(5, 4);
+
+
// raster-brightness-max
{
XCTAssertTrue(rawLayer->getRasterBrightnessMax().isUndefined(),
@@ -140,6 +145,15 @@
XCTAssertThrowsSpecificNamed(layer.rasterContrast = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<NSNumber *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.rasterContrast = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
+ // Transition property test
+ layer.rasterContrastTransition = transitionTest;
+ auto toptions = rawLayer->getRasterContrastTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition rasterContrastTransition = layer.rasterContrastTransition;
+ XCTAssertEqual(rasterContrastTransition.delay, transitionTest.delay);
+ XCTAssertEqual(rasterContrastTransition.duration, transitionTest.duration);
}
// raster-fade-duration
@@ -179,6 +193,15 @@
XCTAssertThrowsSpecificNamed(layer.rasterFadeDuration = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<NSNumber *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.rasterFadeDuration = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
+ // Transition property test
+ layer.rasterFadeDurationTransition = transitionTest;
+ auto toptions = rawLayer->getRasterFadeDurationTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition rasterFadeDurationTransition = layer.rasterFadeDurationTransition;
+ XCTAssertEqual(rasterFadeDurationTransition.delay, transitionTest.delay);
+ XCTAssertEqual(rasterFadeDurationTransition.duration, transitionTest.duration);
}
// raster-hue-rotate
@@ -257,6 +280,15 @@
XCTAssertThrowsSpecificNamed(layer.rasterOpacity = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<NSNumber *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.rasterOpacity = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
+ // Transition property test
+ layer.rasterOpacityTransition = transitionTest;
+ auto toptions = rawLayer->getRasterOpacityTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition rasterOpacityTransition = layer.rasterOpacityTransition;
+ XCTAssertEqual(rasterOpacityTransition.delay, transitionTest.delay);
+ XCTAssertEqual(rasterOpacityTransition.duration, transitionTest.duration);
}
// raster-saturation
@@ -296,6 +328,15 @@
XCTAssertThrowsSpecificNamed(layer.rasterSaturation = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
functionStyleValue = [MGLStyleValue<NSNumber *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.rasterSaturation = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
+ // Transition property test
+ layer.rasterSaturationTransition = transitionTest;
+ auto toptions = rawLayer->getRasterSaturationTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition rasterSaturationTransition = layer.rasterSaturationTransition;
+ XCTAssertEqual(rasterSaturationTransition.delay, transitionTest.delay);
+ XCTAssertEqual(rasterSaturationTransition.duration, transitionTest.duration);
}
}
diff --git a/platform/darwin/test/MGLStyleLayerTests.mm.ejs b/platform/darwin/test/MGLStyleLayerTests.mm.ejs
index 810d7fbd3b..a405ae58c4 100644
--- a/platform/darwin/test/MGLStyleLayerTests.mm.ejs
+++ b/platform/darwin/test/MGLStyleLayerTests.mm.ejs
@@ -7,10 +7,12 @@
// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLStyleLayerTests.h"
+#import "../../darwin/src/NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/<%- type %>_layer.hpp>
+#include <mbgl/style/transition_options.hpp>
@interface MGL<%- camelize(type) %>LayerTests : MGLStyleLayerTests
@end
@@ -53,6 +55,9 @@
XCTAssertNotEqual(layer.rawLayer, nullptr);
XCTAssertTrue(layer.rawLayer->is<mbgl::style::<%- camelize(type) %>Layer>());
auto rawLayer = layer.rawLayer->as<mbgl::style::<%- camelize(type) %>Layer>();
+
+ MGLTransition transitionTest = MGLTransitionMake(5, 4);
+
<% for (const property of properties) { -%>
// <%- originalPropertyName(property) %>
@@ -124,6 +129,17 @@
functionStyleValue = [MGLStyleValue<<%- propertyType(property) %>> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.<%- objCName(property) %> = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
<% } -%>
+<% if (property["transition"] && !property.original) { -%>
+ // Transition property test
+ layer.<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %>Transition = transitionTest;
+ auto toptions = rawLayer->get<%- camelize(originalPropertyName(property)) %>Transition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition <%- camelizeWithLeadingLowercase(originalPropertyName(property)) %>Transition = layer.<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %>Transition;
+ XCTAssertEqual(<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %>Transition.delay, transitionTest.delay);
+ XCTAssertEqual(<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %>Transition.duration, transitionTest.duration);
+<% } -%>
}
<% } -%>
}
diff --git a/platform/darwin/test/MGLStyleValueTests.swift b/platform/darwin/test/MGLStyleValueTests.swift
index f965c31e40..784b2fbaf1 100644
--- a/platform/darwin/test/MGLStyleValueTests.swift
+++ b/platform/darwin/test/MGLStyleValueTests.swift
@@ -24,8 +24,8 @@ extension MGLStyleValueTests {
return
}
- if let actualConstant = actual as? MGLStyleConstantValue<MGLColor> {
- assertColorsEqualWithAccuracy(actualConstant.rawValue, (expected as! MGLStyleConstantValue<MGLColor>).rawValue)
+ if let actualConstant = actual as? MGLConstantStyleValue<MGLColor> {
+ assertColorsEqualWithAccuracy(actualConstant.rawValue, (expected as! MGLConstantStyleValue<MGLColor>).rawValue)
} else if let actualFunction = actual as? MGLStyleFunction<MGLColor>,
let expectedFunction = expected as? MGLStyleFunction<MGLColor> {
@@ -55,11 +55,11 @@ extension MGLStyleValueTests {
XCTFail("Expected stop value of type \(type(of: expectedValue)), but found \(type(of: actualValue)) instead.")
return
}
- if let actualValue = actualValue as? MGLStyleConstantValue<MGLColor>,
- let expectedValue = expectedValue as? MGLStyleConstantValue<MGLColor> {
+ if let actualValue = actualValue as? MGLConstantStyleValue<MGLColor>,
+ let expectedValue = expectedValue as? MGLConstantStyleValue<MGLColor> {
assertColorsEqualWithAccuracy(actualValue.rawValue, expectedValue.rawValue)
- } else if let actualValue = actualValue as? MGLStyleConstantValue<AnyObject>,
- let expectedValue = expectedValue as? MGLStyleConstantValue<AnyObject> {
+ } else if let actualValue = actualValue as? MGLConstantStyleValue<AnyObject>,
+ let expectedValue = expectedValue as? MGLConstantStyleValue<AnyObject> {
XCTAssertEqual(actualValue, expectedValue)
} else {
XCTFail("Unsupported stop value type \(type(of: actualValue)).")
@@ -90,16 +90,16 @@ extension MGLStyleValueTests {
let circleStyleLayer = MGLCircleStyleLayer(identifier: "circleLayer", source: shapeSource)
// Boolean
- symbolStyleLayer.iconAllowsOverlap = MGLStyleConstantValue(rawValue: true)
- XCTAssertEqual((symbolStyleLayer.iconAllowsOverlap as! MGLStyleConstantValue<NSNumber>).rawValue, true)
+ symbolStyleLayer.iconAllowsOverlap = MGLConstantStyleValue(rawValue: true)
+ XCTAssertEqual((symbolStyleLayer.iconAllowsOverlap as! MGLConstantStyleValue<NSNumber>).rawValue, true)
// Number
- symbolStyleLayer.iconHaloWidth = MGLStyleConstantValue(rawValue: 3)
- XCTAssertEqual((symbolStyleLayer.iconHaloWidth as! MGLStyleConstantValue<NSNumber>).rawValue, 3)
+ symbolStyleLayer.iconHaloWidth = MGLConstantStyleValue(rawValue: 3)
+ XCTAssertEqual((symbolStyleLayer.iconHaloWidth as! MGLConstantStyleValue<NSNumber>).rawValue, 3)
// String
- symbolStyleLayer.text = MGLStyleConstantValue(rawValue: "{name}")
- XCTAssertEqual((symbolStyleLayer.text as! MGLStyleConstantValue<NSString>).rawValue, "{name}")
+ symbolStyleLayer.text = MGLConstantStyleValue(rawValue: "{name}")
+ XCTAssertEqual((symbolStyleLayer.text as! MGLConstantStyleValue<NSString>).rawValue, "{name}")
var circleTranslationOne = CGVector(dx: 100, dy: 0)
let circleTranslationValueOne = NSValue(bytes: &circleTranslationOne, objCType: "{CGVector=dd}")
diff --git a/platform/darwin/test/MGLSymbolStyleLayerTests.mm b/platform/darwin/test/MGLSymbolStyleLayerTests.mm
index 1d599f5aca..e3e473ef78 100644
--- a/platform/darwin/test/MGLSymbolStyleLayerTests.mm
+++ b/platform/darwin/test/MGLSymbolStyleLayerTests.mm
@@ -2,10 +2,12 @@
// Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`.
#import "MGLStyleLayerTests.h"
+#import "../../darwin/src/NSDate+MGLAdditions.h"
#import "MGLStyleLayer_Private.h"
#include <mbgl/style/layers/symbol_layer.hpp>
+#include <mbgl/style/transition_options.hpp>
@interface MGLSymbolLayerTests : MGLStyleLayerTests
@end
@@ -43,6 +45,9 @@
XCTAssertTrue(layer.rawLayer->is<mbgl::style::SymbolLayer>());
auto rawLayer = layer.rawLayer->as<mbgl::style::SymbolLayer>();
+ MGLTransition transitionTest = MGLTransitionMake(5, 4);
+
+
// icon-allow-overlap
{
XCTAssertTrue(rawLayer->getIconAllowOverlap().isUndefined(),
@@ -1468,6 +1473,15 @@
@"Unsetting iconColor should return icon-color to the default value.");
XCTAssertEqualObjects(layer.iconColor, defaultStyleValue,
@"iconColor should return the default value after being unset.");
+ // Transition property test
+ layer.iconColorTransition = transitionTest;
+ auto toptions = rawLayer->getIconColorTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition iconColorTransition = layer.iconColorTransition;
+ XCTAssertEqual(iconColorTransition.delay, transitionTest.delay);
+ XCTAssertEqual(iconColorTransition.duration, transitionTest.duration);
}
// icon-halo-blur
@@ -1525,6 +1539,15 @@
@"Unsetting iconHaloBlur should return icon-halo-blur to the default value.");
XCTAssertEqualObjects(layer.iconHaloBlur, defaultStyleValue,
@"iconHaloBlur should return the default value after being unset.");
+ // Transition property test
+ layer.iconHaloBlurTransition = transitionTest;
+ auto toptions = rawLayer->getIconHaloBlurTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition iconHaloBlurTransition = layer.iconHaloBlurTransition;
+ XCTAssertEqual(iconHaloBlurTransition.delay, transitionTest.delay);
+ XCTAssertEqual(iconHaloBlurTransition.duration, transitionTest.duration);
}
// icon-halo-color
@@ -1582,6 +1605,15 @@
@"Unsetting iconHaloColor should return icon-halo-color to the default value.");
XCTAssertEqualObjects(layer.iconHaloColor, defaultStyleValue,
@"iconHaloColor should return the default value after being unset.");
+ // Transition property test
+ layer.iconHaloColorTransition = transitionTest;
+ auto toptions = rawLayer->getIconHaloColorTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition iconHaloColorTransition = layer.iconHaloColorTransition;
+ XCTAssertEqual(iconHaloColorTransition.delay, transitionTest.delay);
+ XCTAssertEqual(iconHaloColorTransition.duration, transitionTest.duration);
}
// icon-halo-width
@@ -1639,6 +1671,15 @@
@"Unsetting iconHaloWidth should return icon-halo-width to the default value.");
XCTAssertEqualObjects(layer.iconHaloWidth, defaultStyleValue,
@"iconHaloWidth should return the default value after being unset.");
+ // Transition property test
+ layer.iconHaloWidthTransition = transitionTest;
+ auto toptions = rawLayer->getIconHaloWidthTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition iconHaloWidthTransition = layer.iconHaloWidthTransition;
+ XCTAssertEqual(iconHaloWidthTransition.delay, transitionTest.delay);
+ XCTAssertEqual(iconHaloWidthTransition.duration, transitionTest.duration);
}
// icon-opacity
@@ -1696,6 +1737,15 @@
@"Unsetting iconOpacity should return icon-opacity to the default value.");
XCTAssertEqualObjects(layer.iconOpacity, defaultStyleValue,
@"iconOpacity should return the default value after being unset.");
+ // Transition property test
+ layer.iconOpacityTransition = transitionTest;
+ auto toptions = rawLayer->getIconOpacityTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition iconOpacityTransition = layer.iconOpacityTransition;
+ XCTAssertEqual(iconOpacityTransition.delay, transitionTest.delay);
+ XCTAssertEqual(iconOpacityTransition.duration, transitionTest.duration);
}
// icon-translate
@@ -1837,6 +1887,15 @@
@"Unsetting textColor should return text-color to the default value.");
XCTAssertEqualObjects(layer.textColor, defaultStyleValue,
@"textColor should return the default value after being unset.");
+ // Transition property test
+ layer.textColorTransition = transitionTest;
+ auto toptions = rawLayer->getTextColorTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition textColorTransition = layer.textColorTransition;
+ XCTAssertEqual(textColorTransition.delay, transitionTest.delay);
+ XCTAssertEqual(textColorTransition.duration, transitionTest.duration);
}
// text-halo-blur
@@ -1894,6 +1953,15 @@
@"Unsetting textHaloBlur should return text-halo-blur to the default value.");
XCTAssertEqualObjects(layer.textHaloBlur, defaultStyleValue,
@"textHaloBlur should return the default value after being unset.");
+ // Transition property test
+ layer.textHaloBlurTransition = transitionTest;
+ auto toptions = rawLayer->getTextHaloBlurTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition textHaloBlurTransition = layer.textHaloBlurTransition;
+ XCTAssertEqual(textHaloBlurTransition.delay, transitionTest.delay);
+ XCTAssertEqual(textHaloBlurTransition.duration, transitionTest.duration);
}
// text-halo-color
@@ -1951,6 +2019,15 @@
@"Unsetting textHaloColor should return text-halo-color to the default value.");
XCTAssertEqualObjects(layer.textHaloColor, defaultStyleValue,
@"textHaloColor should return the default value after being unset.");
+ // Transition property test
+ layer.textHaloColorTransition = transitionTest;
+ auto toptions = rawLayer->getTextHaloColorTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition textHaloColorTransition = layer.textHaloColorTransition;
+ XCTAssertEqual(textHaloColorTransition.delay, transitionTest.delay);
+ XCTAssertEqual(textHaloColorTransition.duration, transitionTest.duration);
}
// text-halo-width
@@ -2008,6 +2085,15 @@
@"Unsetting textHaloWidth should return text-halo-width to the default value.");
XCTAssertEqualObjects(layer.textHaloWidth, defaultStyleValue,
@"textHaloWidth should return the default value after being unset.");
+ // Transition property test
+ layer.textHaloWidthTransition = transitionTest;
+ auto toptions = rawLayer->getTextHaloWidthTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition textHaloWidthTransition = layer.textHaloWidthTransition;
+ XCTAssertEqual(textHaloWidthTransition.delay, transitionTest.delay);
+ XCTAssertEqual(textHaloWidthTransition.duration, transitionTest.duration);
}
// text-opacity
@@ -2065,6 +2151,15 @@
@"Unsetting textOpacity should return text-opacity to the default value.");
XCTAssertEqualObjects(layer.textOpacity, defaultStyleValue,
@"textOpacity should return the default value after being unset.");
+ // Transition property test
+ layer.textOpacityTransition = transitionTest;
+ auto toptions = rawLayer->getTextOpacityTransition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition textOpacityTransition = layer.textOpacityTransition;
+ XCTAssertEqual(textOpacityTransition.delay, transitionTest.delay);
+ XCTAssertEqual(textOpacityTransition.duration, transitionTest.duration);
}
// text-translate
diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md
index 1b4161fe06..e75f90dd5d 100644
--- a/platform/ios/CHANGELOG.md
+++ b/platform/ios/CHANGELOG.md
@@ -8,21 +8,30 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT
## 3.5.0
+### Packaging
+
+* The minimum deployment target for this SDK is now iOS 8. ([#8129](https://github.com/mapbox/mapbox-gl-native/pull/8129))
+* Added support for the Carthage dependency manager. See [our website](https://www.mapbox.com/ios-sdk/) for setup instructions. ([#8257](https://github.com/mapbox/mapbox-gl-native/pull/8257))
+* While running your application in the iOS Simulator, you will receive a notice in the console if a newer version of this SDK is available. ([#8282](https://github.com/mapbox/mapbox-gl-native/pull/8282))
+
### 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 Chinese (Simplified and Traditional), French, German, Japanese, Lithuanian, Polish, Portuguese (Brazilian), Russian, Spanish, Swedish, Ukrainian, and Vietnamese localizations. ([#7316](https://github.com/mapbox/mapbox-gl-native/pull/7316), [#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), Russian, Spanish, Swedish, Ukrainian, and Vietnamese localizations. ([#7316](https://github.com/mapbox/mapbox-gl-native/pull/7316), [#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))
@@ -32,13 +41,20 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT
* 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 `UIColor` 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))
* Annotations are no longer deselected when the map is panned or zoomed, even if the annotation moves out of the visible bounds. ([#8022](https://github.com/mapbox/mapbox-gl-native/pull/8022))
+* 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))
+* Fixed an issue where translucent, non-view-backed point annotations along tile boundaries would be drawn darker than expected. ([#6832](https://github.com/mapbox/mapbox-gl-native/pull/6832))
* Double-tap and two-finger tap gestures now zoom to the nearest integer zoom level. ([#8027](https://github.com/mapbox/mapbox-gl-native/pull/8027))
+* The `MGLAnnotationView.annotation` property is now read-write. ([#8139](https://github.com/mapbox/mapbox-gl-native/pull/8139))
+* Enabled the one-finger zoom gesture on iPad. To execute this gesture, tap twice; on second tap, hold your finger on the map and pan up to zoom in, or down to zoom out. ([#8379](https://github.com/mapbox/mapbox-gl-native/pull/8379))
### Networking and offline maps
@@ -46,13 +62,12 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT
* 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 device 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
-* The minimum deployment target for this SDK is now iOS 8. ([#8129](https://github.com/mapbox/mapbox-gl-native/pull/8129))
* 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, non-view-backed 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))
* Fixed an issue that sometimes caused crashes when the SDK interacted with the file system in the background. ([#8125](https://github.com/mapbox/mapbox-gl-native/pull/8125))
* Added a `MGLDistanceFormatter` class for formatting geographic distances. ([#7888](https://github.com/mapbox/mapbox-gl-native/pull/7888))
@@ -108,7 +123,7 @@ This is the final scheduled version of the Mapbox iOS SDK that supports iOS 7. (
* A source’s tiles are no longer rendered when the map is outside the source’s supported zoom levels. ([#6345](https://github.com/mapbox/mapbox-gl-native/pull/6345))
* Improved style parsing performance. ([#6170](https://github.com/mapbox/mapbox-gl-native/pull/6170))
* Improved feature querying performance. ([#6514](https://github.com/mapbox/mapbox-gl-native/pull/6514))
-* Fixed an issue where shapes that cannot currently be visually represented as annotations were still shown on the map as point annotations. ([#6764](https://github.com/mapbox/mapbox-gl-native/issues/6764))
+* Fixed an issue where shapes that cannot currently be visually represented as annotations were still shown on the map as point annotations. ([#6764](https://github.com/mapbox/mapbox-gl-native/issues/6764))
### User location
diff --git a/platform/ios/INSTALL.md b/platform/ios/INSTALL.md
index 4daefe55a9..e0df7c48f6 100644
--- a/platform/ios/INSTALL.md
+++ b/platform/ios/INSTALL.md
@@ -111,6 +111,18 @@ pod 'Mapbox-iOS-SDK-nightly-dynamic', podspec: 'https://raw.githubusercontent.co
If using the static framework, add `$(inherited)` to your target’s Other Linker Flags in the Build Settings tab.
+#### Carthage
+
+For instructions on installing stable release versions of the Mapbox iOS SDK with Carthage, see [our website](https://www.mapbox.com/ios-sdk/). If you require a build without symbols pre-stripped, use [this feed URL](https://www.mapbox.com/ios-sdk/Mapbox-iOS-SDK-symbols.json) with Carthage.
+
+##### Testing pre-releases with Carthage
+
+Carthage currently does not support pre-release versions of binaries.
+
+##### Using your own build with Carthage
+
+This project does not support being compiled as a local repository by Carthage.
+
### Configuration
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 iOS 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/).
diff --git a/platform/ios/Mapbox-iOS-SDK-symbols.podspec b/platform/ios/Mapbox-iOS-SDK-symbols.podspec
index 24ff0f5e43..aa9a6cf7e5 100644
--- a/platform/ios/Mapbox-iOS-SDK-symbols.podspec
+++ b/platform/ios/Mapbox-iOS-SDK-symbols.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |m|
- version = '3.5.0-beta.1'
+ version = '3.5.0-rc.2'
m.name = 'Mapbox-iOS-SDK-symbols'
m.version = "#{version}-symbols"
diff --git a/platform/ios/Mapbox-iOS-SDK.podspec b/platform/ios/Mapbox-iOS-SDK.podspec
index 3509d9a30f..296015da11 100644
--- a/platform/ios/Mapbox-iOS-SDK.podspec
+++ b/platform/ios/Mapbox-iOS-SDK.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |m|
- version = '3.5.0-beta.1'
+ version = '3.5.0-rc.2'
m.name = 'Mapbox-iOS-SDK'
m.version = version
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m
index 63ca0ea1f6..39458c4f31 100644
--- a/platform/ios/app/MBXViewController.m
+++ b/platform/ios/app/MBXViewController.m
@@ -915,8 +915,8 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
- (void)styleBuildingLayer
{
- self.mapView.style.transitionDuration = 5;
- self.mapView.style.transitionDelay = 1;
+ MGLTransition transition = { 5, 1 };
+ self.mapView.style.transition = transition;
MGLFillStyleLayer *buildingLayer = (MGLFillStyleLayer *)[self.mapView.style layerWithIdentifier:@"building"];
buildingLayer.fillColor = [MGLStyleValue<UIColor *> valueWithRawValue:[UIColor purpleColor]];
}
@@ -1020,8 +1020,8 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
[self.mapView.style addSource:source];
MGLFillStyleLayer *fillLayer = [[MGLFillStyleLayer alloc] initWithIdentifier:queryLayerID source:source];
- fillLayer.fillColor = [MGLStyleConstantValue<UIColor *> valueWithRawValue:[UIColor blueColor]];
- fillLayer.fillOpacity = [MGLStyleConstantValue<NSNumber *> valueWithRawValue:@0.5];
+ fillLayer.fillColor = [MGLConstantStyleValue<UIColor *> valueWithRawValue:[UIColor blueColor]];
+ fillLayer.fillOpacity = [MGLConstantStyleValue<NSNumber *> valueWithRawValue:@0.5];
[self.mapView.style addLayer:fillLayer];
});
}
@@ -1272,19 +1272,19 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
[self.mapView.style addSource:routeSource];
MGLLineStyleLayer *baseRouteLayer = [[MGLLineStyleLayer alloc] initWithIdentifier:@"style-base-route-layer" source:routeSource];
- baseRouteLayer.lineColor = [MGLStyleConstantValue valueWithRawValue:[UIColor orangeColor]];
- baseRouteLayer.lineWidth = [MGLStyleConstantValue valueWithRawValue:@20];
- baseRouteLayer.lineOpacity = [MGLStyleConstantValue valueWithRawValue:@0.5];
- baseRouteLayer.lineCap = [MGLStyleConstantValue valueWithRawValue:[NSValue valueWithMGLLineCap:MGLLineCapRound]];
- baseRouteLayer.lineJoin = [MGLStyleConstantValue valueWithRawValue:[NSValue valueWithMGLLineJoin:MGLLineJoinRound]];
+ baseRouteLayer.lineColor = [MGLConstantStyleValue valueWithRawValue:[UIColor orangeColor]];
+ baseRouteLayer.lineWidth = [MGLConstantStyleValue valueWithRawValue:@20];
+ baseRouteLayer.lineOpacity = [MGLConstantStyleValue valueWithRawValue:@0.5];
+ baseRouteLayer.lineCap = [MGLConstantStyleValue valueWithRawValue:[NSValue valueWithMGLLineCap:MGLLineCapRound]];
+ baseRouteLayer.lineJoin = [MGLConstantStyleValue valueWithRawValue:[NSValue valueWithMGLLineJoin:MGLLineJoinRound]];
[self.mapView.style addLayer:baseRouteLayer];
MGLLineStyleLayer *routeLayer = [[MGLLineStyleLayer alloc] initWithIdentifier:@"style-route-layer" source:routeSource];
- routeLayer.lineColor = [MGLStyleConstantValue valueWithRawValue:[UIColor whiteColor]];
- routeLayer.lineWidth = [MGLStyleConstantValue valueWithRawValue:@15];
- routeLayer.lineOpacity = [MGLStyleConstantValue valueWithRawValue:@0.8];
- routeLayer.lineCap = [MGLStyleConstantValue valueWithRawValue:[NSValue valueWithMGLLineCap:MGLLineCapRound]];
- routeLayer.lineJoin = [MGLStyleConstantValue valueWithRawValue:[NSValue valueWithMGLLineJoin:MGLLineJoinRound]];
+ routeLayer.lineColor = [MGLConstantStyleValue valueWithRawValue:[UIColor whiteColor]];
+ routeLayer.lineWidth = [MGLConstantStyleValue valueWithRawValue:@15];
+ routeLayer.lineOpacity = [MGLConstantStyleValue valueWithRawValue:@0.8];
+ routeLayer.lineCap = [MGLConstantStyleValue valueWithRawValue:[NSValue valueWithMGLLineCap:MGLLineCapRound]];
+ routeLayer.lineJoin = [MGLConstantStyleValue valueWithRawValue:[NSValue valueWithMGLLineJoin:MGLLineJoinRound]];
[self.mapView.style addLayer:routeLayer];
}
@@ -1340,8 +1340,8 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
MGLSymbolStyleLayer *layer = (MGLSymbolStyleLayer *)[self.mapView.style layerWithIdentifier:layerName];
if ([layer isKindOfClass:[MGLSymbolStyleLayer class]]) {
- if ([layer.text isKindOfClass:[MGLStyleConstantValue class]]) {
- MGLStyleConstantValue *label = (MGLStyleConstantValue<NSString *> *)layer.text;
+ if ([layer.text isKindOfClass:[MGLConstantStyleValue class]]) {
+ MGLConstantStyleValue *label = (MGLConstantStyleValue<NSString *> *)layer.text;
if ([label.rawValue hasPrefix:@"{name"]) {
layer.text = [MGLStyleValue valueWithRawValue:language];
}
@@ -1349,7 +1349,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) {
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) {
if ([stop.rawValue hasPrefix:@"{name"]) {
stops[zoomLevel] = [MGLStyleValue<NSString *> valueWithRawValue:language];
}
diff --git a/platform/ios/app/ca.lproj/Localizable.strings b/platform/ios/app/ca.lproj/Localizable.strings
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/platform/ios/app/ca.lproj/Localizable.strings
diff --git a/platform/ios/app/fi.lproj/Localizable.strings b/platform/ios/app/fi.lproj/Localizable.strings
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/platform/ios/app/fi.lproj/Localizable.strings
diff --git a/platform/ios/app/nl.lproj/Localizable.strings b/platform/ios/app/nl.lproj/Localizable.strings
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/platform/ios/app/nl.lproj/Localizable.strings
diff --git a/platform/ios/docs/guides/Data-Driven Styling.md b/platform/ios/docs/guides/Data-Driven Styling.md
new file mode 100644
index 0000000000..0b685512b4
--- /dev/null
+++ b/platform/ios/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: 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 layer = MGLCircleStyleLayer(identifier: "circles", source: source)
+layer.circleColor = MGLStyleValue(interpolationMode: .exponential,
+ sourceStops: stops,
+ attributeName: "mag",
+ options: [.defaultValue: MGLStyleValue<UIColor>(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: UIColor.yellow),
+ 2.5: MGLStyleValue(rawValue: UIColor.orange),
+ 5: MGLStyleValue(rawValue: UIColor.red),
+ 7.5: MGLStyleValue(rawValue: UIColor.blue),
+ 10: MGLStyleValue(rawValue: UIColor.white)]
+
+layer.circleColor = MGLStyleValue(interpolationMode: .interval,
+ sourceStops: stops,
+ attributeName: "mag",
+ options: [.defaultValue: MGLStyleValue<UIColor>(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: UIColor.orange),
+ "explosion": MGLStyleValue(rawValue: UIColor.red),
+ "quarry blast": MGLStyleValue(rawValue: UIColor.yellow)]
+
+layer.circleColor = MGLStyleValue(interpolationMode: .categorical,
+ sourceStops: categoricalStops,
+ attributeName: "type",
+ options: [.defaultValue: MGLStyleValue(rawValue: UIColor.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/ios/docs/guides/For Style Authors.md b/platform/ios/docs/guides/For Style Authors.md
index a65d07bdd1..952be6bec7 100644
--- a/platform/ios/docs/guides/For Style Authors.md
+++ b/platform/ios/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
@@ -28,7 +28,7 @@ make sure the contents of these elements remain legible with the map view
underneath.
The user location annotation view, the attribution button, any buttons in
callout views, and any items in the navigation bar are influenced by your
-application’s tint color, so choose a tint color that constrasts well with your
+application’s tint color, so choose a tint color that contrasts well with your
map style.
If you intend your style to be used in the dark, consider the impact that Night
Shift may have on your style’s colors.
@@ -109,6 +109,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
@@ -189,6 +190,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 iOS 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
@@ -197,6 +222,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 iOS 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
@@ -205,6 +254,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 iOS 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
@@ -213,6 +286,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 iOS 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
@@ -221,6 +318,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 iOS 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
@@ -252,7 +373,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/ios/docs/guides/Runtime Styling.md b/platform/ios/docs/guides/Runtime Styling.md
index e85b466c65..194d8b3bdd 100644
--- a/platform/ios/docs/guides/Runtime Styling.md
+++ b/platform/ios/docs/guides/Runtime Styling.md
@@ -44,6 +44,10 @@ The Mapbox SDK gives you access to all of the same tools we use to render our de
Draw custom shapes on the map the same way you would a custom `UIView` or `CALayer`. These shapes keep their geographic scale and are perfect for visualizing everything from indoor floor plans to metro systems to hurricane tracks.
+## Next steps
+
+Check out the [iOS code examples](https://www.mapbox.com/ios-sdk/examples/runtime-toggle-layer/) to learn more about how to use runtime styling in your own apps.
+
## Resources
* [Information for style authors](for-style-authors.html)
diff --git a/platform/ios/docs/img/data-driven-styling/categorical1.png b/platform/ios/docs/img/data-driven-styling/categorical1.png
new file mode 100644
index 0000000000..969846b41b
--- /dev/null
+++ b/platform/ios/docs/img/data-driven-styling/categorical1.png
Binary files differ
diff --git a/platform/ios/docs/img/data-driven-styling/categorical2.png b/platform/ios/docs/img/data-driven-styling/categorical2.png
new file mode 100644
index 0000000000..5008c522ed
--- /dev/null
+++ b/platform/ios/docs/img/data-driven-styling/categorical2.png
Binary files differ
diff --git a/platform/ios/docs/img/data-driven-styling/citibikes.png b/platform/ios/docs/img/data-driven-styling/citibikes.png
new file mode 100644
index 0000000000..a616672a32
--- /dev/null
+++ b/platform/ios/docs/img/data-driven-styling/citibikes.png
Binary files differ
diff --git a/platform/ios/docs/img/data-driven-styling/exponential-function-1.png b/platform/ios/docs/img/data-driven-styling/exponential-function-1.png
new file mode 100644
index 0000000000..6aa129a305
--- /dev/null
+++ b/platform/ios/docs/img/data-driven-styling/exponential-function-1.png
Binary files differ
diff --git a/platform/ios/docs/img/data-driven-styling/exponential-function.png b/platform/ios/docs/img/data-driven-styling/exponential-function.png
new file mode 100644
index 0000000000..c14969f0a8
--- /dev/null
+++ b/platform/ios/docs/img/data-driven-styling/exponential-function.png
Binary files differ
diff --git a/platform/ios/docs/img/data-driven-styling/exponential.png b/platform/ios/docs/img/data-driven-styling/exponential.png
new file mode 100644
index 0000000000..87ddc1350e
--- /dev/null
+++ b/platform/ios/docs/img/data-driven-styling/exponential.png
Binary files differ
diff --git a/platform/ios/docs/img/data-driven-styling/identity.png b/platform/ios/docs/img/data-driven-styling/identity.png
new file mode 100644
index 0000000000..632ccdf3d5
--- /dev/null
+++ b/platform/ios/docs/img/data-driven-styling/identity.png
Binary files differ
diff --git a/platform/ios/docs/img/data-driven-styling/interval.png b/platform/ios/docs/img/data-driven-styling/interval.png
new file mode 100644
index 0000000000..d15aff2025
--- /dev/null
+++ b/platform/ios/docs/img/data-driven-styling/interval.png
Binary files differ
diff --git a/platform/ios/docs/img/data-driven-styling/polylineExample.png b/platform/ios/docs/img/data-driven-styling/polylineExample.png
new file mode 100644
index 0000000000..cd9b39bae4
--- /dev/null
+++ b/platform/ios/docs/img/data-driven-styling/polylineExample.png
Binary files differ
diff --git a/platform/ios/framework/Settings.bundle/ca.lproj/Root.strings b/platform/ios/framework/Settings.bundle/ca.lproj/Root.strings
new file mode 100644
index 0000000000..94e8335582
--- /dev/null
+++ b/platform/ios/framework/Settings.bundle/ca.lproj/Root.strings
@@ -0,0 +1,3 @@
+"TELEMETRY_GROUP_TITLE" = "Configuració de privacitat";
+"TELEMETRY_SWITCH_TITLE" = "Telemetria Mapbox";
+"TELEMETRY_GROUP_FOOTER" = "Aquest ajust permet que l’aplicació comparteixi dades anònimes de localització i ús amb Mapbox.";
diff --git a/platform/ios/framework/Settings.bundle/fi.lproj/Root.strings b/platform/ios/framework/Settings.bundle/fi.lproj/Root.strings
new file mode 100644
index 0000000000..e0c2e50d09
--- /dev/null
+++ b/platform/ios/framework/Settings.bundle/fi.lproj/Root.strings
@@ -0,0 +1,3 @@
+"TELEMETRY_GROUP_TITLE" = "Yksityisyysasetukset";
+"TELEMETRY_SWITCH_TITLE" = "Mapbox-telemetria";
+"TELEMETRY_GROUP_FOOTER" = "Tämä asetus antaa sovellukselle luvan jakaa anonymisoituja sijainti- ja käyttötietoja Mapboxille.";
diff --git a/platform/ios/framework/Settings.bundle/nl.lproj/Root.strings b/platform/ios/framework/Settings.bundle/nl.lproj/Root.strings
new file mode 100644
index 0000000000..ea73b0ba3c
--- /dev/null
+++ b/platform/ios/framework/Settings.bundle/nl.lproj/Root.strings
@@ -0,0 +1,3 @@
+"TELEMETRY_GROUP_TITLE" = "Privacy Instellingen";
+"TELEMETRY_SWITCH_TITLE" = "Mapbox Telemetrie";
+"TELEMETRY_GROUP_FOOTER" = "Deze instelling laat toe om anonieme locatie en gebruiksgegevens te delen met Mapbox.";
diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj
index 04971e8e29..9a87f2c631 100644
--- a/platform/ios/ios.xcodeproj/project.pbxproj
+++ b/platform/ios/ios.xcodeproj/project.pbxproj
@@ -9,6 +9,7 @@
/* Begin PBXBuildFile section */
1753ED421E53CE6F00A9FD90 /* MGLConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = 1753ED411E53CE6F00A9FD90 /* MGLConversion.h */; };
1753ED431E53CE6F00A9FD90 /* MGLConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = 1753ED411E53CE6F00A9FD90 /* MGLConversion.h */; };
+ 1F95931D1E6DE2E900D5B294 /* MGLNSDateAdditionsTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1F95931C1E6DE2E900D5B294 /* MGLNSDateAdditionsTests.mm */; };
30E578171DAA85520050F07E /* UIImage+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 30E578111DAA7D690050F07E /* UIImage+MGLAdditions.h */; };
30E578181DAA85520050F07E /* UIImage+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 30E578111DAA7D690050F07E /* UIImage+MGLAdditions.h */; };
30E578191DAA855E0050F07E /* UIImage+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 30E578121DAA7D690050F07E /* UIImage+MGLAdditions.mm */; };
@@ -188,6 +189,10 @@
7E016D871D9E890300A29A21 /* MGLPolygon+MGLAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E016D831D9E890300A29A21 /* MGLPolygon+MGLAdditions.m */; };
920A3E5D1E6F995200C16EFC /* MGLSourceQueryTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 920A3E5C1E6F995200C16EFC /* MGLSourceQueryTests.m */; };
9221B2F11E6F9D1400A2385E /* query-style.json in Resources */ = {isa = PBXBuildFile; fileRef = 9221B2F01E6F9D1400A2385E /* query-style.json */; };
+ 9620BB381E69FE1700705A1D /* MGLSDKUpdateChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = 9620BB361E69FE1700705A1D /* MGLSDKUpdateChecker.h */; };
+ 9620BB391E69FE1700705A1D /* MGLSDKUpdateChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = 9620BB361E69FE1700705A1D /* MGLSDKUpdateChecker.h */; };
+ 9620BB3A1E69FE1700705A1D /* MGLSDKUpdateChecker.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9620BB371E69FE1700705A1D /* MGLSDKUpdateChecker.mm */; };
+ 9620BB3B1E69FE1700705A1D /* MGLSDKUpdateChecker.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9620BB371E69FE1700705A1D /* MGLSDKUpdateChecker.mm */; };
968F36B51E4D128D003A5522 /* MGLDistanceFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = 3557F7AE1E1D27D300CCA5E6 /* MGLDistanceFormatter.h */; settings = {ATTRIBUTES = (Public, ); }; };
96E027231E57C76E004B8E66 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 96E027251E57C76E004B8E66 /* Localizable.strings */; };
DA00FC8E1D5EEB0D009AABC8 /* MGLAttributionInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = DA00FC8C1D5EEB0D009AABC8 /* MGLAttributionInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -528,6 +533,7 @@
/* Begin PBXFileReference section */
1753ED411E53CE6F00A9FD90 /* MGLConversion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLConversion.h; sourceTree = "<group>"; };
+ 1F95931C1E6DE2E900D5B294 /* MGLNSDateAdditionsTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLNSDateAdditionsTests.mm; path = ../../darwin/test/MGLNSDateAdditionsTests.mm; sourceTree = "<group>"; };
20DABE861DF78148007AC5FF /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Foundation.strings"; sourceTree = "<group>"; };
20DABE881DF78148007AC5FF /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = "<group>"; };
20DABE8A1DF78149007AC5FF /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Root.strings"; sourceTree = "<group>"; };
@@ -644,6 +650,8 @@
7E016D831D9E890300A29A21 /* MGLPolygon+MGLAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MGLPolygon+MGLAdditions.m"; sourceTree = "<group>"; };
920A3E5C1E6F995200C16EFC /* MGLSourceQueryTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLSourceQueryTests.m; path = ../../darwin/test/MGLSourceQueryTests.m; sourceTree = "<group>"; };
9221B2F01E6F9D1400A2385E /* query-style.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = "query-style.json"; path = "../../darwin/test/query-style.json"; sourceTree = "<group>"; };
+ 9620BB361E69FE1700705A1D /* MGLSDKUpdateChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLSDKUpdateChecker.h; sourceTree = "<group>"; };
+ 9620BB371E69FE1700705A1D /* MGLSDKUpdateChecker.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = MGLSDKUpdateChecker.mm; sourceTree = "<group>"; };
9660916B1E5BBFD700A9A03B /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = "<group>"; };
9660916C1E5BBFD900A9A03B /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/Localizable.strings; sourceTree = "<group>"; };
9660916D1E5BBFDB00A9A03B /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Localizable.strings; sourceTree = "<group>"; };
@@ -713,6 +721,17 @@
DA4A26961CB6E795000B7809 /* Mapbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Mapbox.framework; sourceTree = BUILT_PRODUCTS_DIR; };
DA6023F11E4CE94300DBFF23 /* sv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sv; path = sv.lproj/Foundation.strings; sourceTree = "<group>"; };
DA6023F21E4CE94800DBFF23 /* sv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = sv; path = sv.lproj/Foundation.stringsdict; sourceTree = "<group>"; };
+ DA618B111E68823600CB7F44 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = ru; path = ru.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
+ DA618B191E68883700CB7F44 /* ca */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = ca; path = ca.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
+ DA618B1A1E68883900CB7F44 /* ca */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ca; path = ca.lproj/Localizable.strings; sourceTree = "<group>"; };
+ DA618B1B1E68884E00CB7F44 /* ca */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ca; path = ca.lproj/Localizable.strings; sourceTree = "<group>"; };
+ DA618B1C1E6888EC00CB7F44 /* ca */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ca; path = ca.lproj/Foundation.strings; sourceTree = "<group>"; };
+ DA618B1D1E6888F500CB7F44 /* ca */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = ca; path = ca.lproj/Foundation.stringsdict; sourceTree = "<group>"; };
+ DA618B1E1E688A3700CB7F44 /* ca */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ca; path = ca.lproj/Root.strings; sourceTree = "<group>"; };
+ DA618B251E68920500CB7F44 /* lt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = lt; path = lt.lproj/Foundation.strings; sourceTree = "<group>"; };
+ DA618B261E68920D00CB7F44 /* lt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = lt; path = lt.lproj/Foundation.stringsdict; sourceTree = "<group>"; };
+ DA618B2B1E68932D00CB7F44 /* fi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fi; path = fi.lproj/Localizable.strings; sourceTree = "<group>"; };
+ DA618B2C1E68933600CB7F44 /* fi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fi; path = fi.lproj/Root.strings; sourceTree = "<group>"; };
DA6408D91DA4E7D300908C90 /* MGLVectorStyleLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLVectorStyleLayer.h; sourceTree = "<group>"; };
DA6408DA1DA4E7D300908C90 /* MGLVectorStyleLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLVectorStyleLayer.m; sourceTree = "<group>"; };
DA7262091DEEE3480043BB89 /* MGLOpenGLStyleLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLOpenGLStyleLayer.h; sourceTree = "<group>"; };
@@ -724,7 +743,7 @@
DA737AE11E59157600AD2CDE /* pl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/Root.strings; sourceTree = "<group>"; };
DA737AE51E5916D400AD2CDE /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = ru; path = ru.lproj/Foundation.stringsdict; sourceTree = "<group>"; };
DA737AE61E59171700AD2CDE /* ru */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Root.strings; sourceTree = "<group>"; };
- DA737AE71E59172C00AD2CDE /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Localizable.strings; sourceTree = "<group>"; };
+ DA737AE71E59172C00AD2CDE /* ru */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Localizable.strings; sourceTree = "<group>"; };
DA737AE91E5917C300AD2CDE /* uk */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = uk; path = uk.lproj/Localizable.strings; sourceTree = "<group>"; };
DA737AEA1E5917EF00AD2CDE /* uk */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = uk; path = uk.lproj/Root.strings; sourceTree = "<group>"; };
DA737EE01D056A4E005BDA16 /* MGLMapViewDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLMapViewDelegate.h; sourceTree = "<group>"; };
@@ -869,6 +888,8 @@
DAD165761CF4CDFF001FF4B9 /* MGLShapeCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLShapeCollection.h; sourceTree = "<group>"; };
DAD165771CF4CDFF001FF4B9 /* MGLShapeCollection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLShapeCollection.mm; sourceTree = "<group>"; };
DAE7DEC11E245455007505A6 /* MGLNSStringAdditionsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLNSStringAdditionsTests.m; path = ../../darwin/test/MGLNSStringAdditionsTests.m; sourceTree = "<group>"; };
+ DAE8CCAD1E6E8C70009B5CB0 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/Localizable.strings; sourceTree = "<group>"; };
+ DAE8CCAE1E6E8C76009B5CB0 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/Root.strings; sourceTree = "<group>"; };
DAED38611D62D0FC00D7640F /* NSURL+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSURL+MGLAdditions.h"; sourceTree = "<group>"; };
DAED38621D62D0FC00D7640F /* NSURL+MGLAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSURL+MGLAdditions.m"; sourceTree = "<group>"; };
DAEDC4331D603417000224FF /* MGLAttributionInfoTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLAttributionInfoTests.m; path = ../../darwin/test/MGLAttributionInfoTests.m; sourceTree = "<group>"; };
@@ -1180,6 +1201,7 @@
DA0CD58F1CF56F6A00A5F5A5 /* MGLFeatureTests.mm */,
DA2E885C1CC0382C00F24E7B /* MGLGeometryTests.mm */,
35E208A61D24210F00EC9A46 /* MGLNSDataAdditionsTests.m */,
+ 1F95931C1E6DE2E900D5B294 /* MGLNSDateAdditionsTests.mm */,
DAE7DEC11E245455007505A6 /* MGLNSStringAdditionsTests.m */,
DA2E885D1CC0382C00F24E7B /* MGLOfflinePackTests.m */,
DA2E885E1CC0382C00F24E7B /* MGLOfflineRegionTests.m */,
@@ -1526,6 +1548,8 @@
DA8848471CBAFB9800AB86E3 /* MGLLocationManager.m */,
DA8848481CBAFB9800AB86E3 /* MGLMapboxEvents.h */,
DA8848491CBAFB9800AB86E3 /* MGLMapboxEvents.m */,
+ 9620BB361E69FE1700705A1D /* MGLSDKUpdateChecker.h */,
+ 9620BB371E69FE1700705A1D /* MGLSDKUpdateChecker.mm */,
);
name = Telemetry;
sourceTree = "<group>";
@@ -1621,6 +1645,7 @@
30E578171DAA85520050F07E /* UIImage+MGLAdditions.h in Headers */,
DAD1656C1CF41981001FF4B9 /* MGLFeature.h in Headers */,
40EDA1C01CFE0E0200D9EA68 /* MGLAnnotationContainerView.h in Headers */,
+ 9620BB381E69FE1700705A1D /* MGLSDKUpdateChecker.h in Headers */,
DA88484F1CBAFB9800AB86E3 /* MGLAnnotationImage_Private.h in Headers */,
1753ED421E53CE6F00A9FD90 /* MGLConversion.h in Headers */,
DA8847F21CBAFA5100AB86E3 /* MGLMapCamera.h in Headers */,
@@ -1682,6 +1707,7 @@
DA17BE311CC4BDAA00402C41 /* MGLMapView_Private.h in Headers */,
DABFB86C1CBE99E500D62B32 /* MGLTypes.h in Headers */,
DABFB8691CBE99E500D62B32 /* MGLShape.h in Headers */,
+ 9620BB391E69FE1700705A1D /* MGLSDKUpdateChecker.h in Headers */,
3510FFEB1D6D9C7A00F413B2 /* NSComparisonPredicate+MGLAdditions.h in Headers */,
35E1A4D91D74336F007AA97F /* MGLValueEvaluator.h in Headers */,
7E016D7F1D9E86BE00A29A21 /* MGLPolyline+MGLAdditions.h in Headers */,
@@ -1918,6 +1944,9 @@
ru,
uk,
lt,
+ ca,
+ fi,
+ nl,
);
mainGroup = DA1DC9411CB6C1C2006E619F;
productRefGroup = DA1DC94B1CB6C1C2006E619F /* Products */;
@@ -2077,6 +2106,7 @@
40CFA6511D7875BB008103BD /* MGLShapeSourceTests.mm in Sources */,
DA35A2C51CCA9F8300E826B2 /* MGLClockDirectionFormatterTests.m in Sources */,
35B8E08C1D6C8B5100E768D2 /* MGLPredicateTests.mm in Sources */,
+ 1F95931D1E6DE2E900D5B294 /* MGLNSDateAdditionsTests.mm in Sources */,
DD58A4C61D822BD000E1F038 /* MGLExpressionTests.mm in Sources */,
3575798B1D502B0C000B822E /* MGLBackgroundStyleLayerTests.mm in Sources */,
DA2E88621CC0382C00F24E7B /* MGLOfflinePackTests.m in Sources */,
@@ -2099,6 +2129,7 @@
3510FFEC1D6D9C7A00F413B2 /* NSComparisonPredicate+MGLAdditions.mm in Sources */,
7E016D801D9E86BE00A29A21 /* MGLPolyline+MGLAdditions.m in Sources */,
DAED38651D62D0FC00D7640F /* NSURL+MGLAdditions.m in Sources */,
+ 9620BB3A1E69FE1700705A1D /* MGLSDKUpdateChecker.mm in Sources */,
354B83981D2E873E005D9406 /* MGLUserLocationAnnotationView.m in Sources */,
DA88485D1CBAFB9800AB86E3 /* MGLFaux3DUserLocationAnnotationView.m in Sources */,
DAD165701CF41981001FF4B9 /* MGLFeature.mm in Sources */,
@@ -2176,6 +2207,7 @@
3510FFED1D6D9C7A00F413B2 /* NSComparisonPredicate+MGLAdditions.mm in Sources */,
7E016D811D9E86BE00A29A21 /* MGLPolyline+MGLAdditions.m in Sources */,
354B83991D2E873E005D9406 /* MGLUserLocationAnnotationView.m in Sources */,
+ 9620BB3B1E69FE1700705A1D /* MGLSDKUpdateChecker.mm in Sources */,
DAA4E4221CBB730400178DFB /* MGLPointAnnotation.mm in Sources */,
DAED38661D62D0FC00D7640F /* NSURL+MGLAdditions.m in Sources */,
DAD165711CF41981001FF4B9 /* MGLFeature.mm in Sources */,
@@ -2309,6 +2341,9 @@
9660916D1E5BBFDB00A9A03B /* ru */,
9660916E1E5BBFDC00A9A03B /* uk */,
9660916F1E5BBFDE00A9A03B /* lt */,
+ DA618B1A1E68883900CB7F44 /* ca */,
+ DA618B2B1E68932D00CB7F44 /* fi */,
+ DAE8CCAD1E6E8C70009B5CB0 /* nl */,
);
name = Localizable.strings;
sourceTree = "<group>";
@@ -2329,6 +2364,9 @@
DA737AE61E59171700AD2CDE /* ru */,
DA737AEA1E5917EF00AD2CDE /* uk */,
DA1AC01C1E5B87EC006DF1D6 /* lt */,
+ DA618B1E1E688A3700CB7F44 /* ca */,
+ DA618B2C1E68933600CB7F44 /* fi */,
+ DAE8CCAE1E6E8C76009B5CB0 /* nl */,
);
name = Root.strings;
sourceTree = "<group>";
@@ -2349,6 +2387,7 @@
DA737AE71E59172C00AD2CDE /* ru */,
DA737AE91E5917C300AD2CDE /* uk */,
DA1AC01B1E5B8774006DF1D6 /* lt */,
+ DA618B1B1E68884E00CB7F44 /* ca */,
);
name = Localizable.strings;
sourceTree = "<group>";
@@ -2363,6 +2402,8 @@
DAA32CB51E4C4CF4006F8D24 /* ja */,
DAA32CBD1E4C4F62006F8D24 /* vi */,
DA6023F11E4CE94300DBFF23 /* sv */,
+ DA618B1C1E6888EC00CB7F44 /* ca */,
+ DA618B251E68920500CB7F44 /* lt */,
);
name = Foundation.strings;
sourceTree = "<group>";
@@ -2379,6 +2420,8 @@
DA737AE01E59150A00AD2CDE /* pl */,
DA737AE51E5916D400AD2CDE /* ru */,
DA1AC0201E5B8917006DF1D6 /* uk */,
+ DA618B1D1E6888F500CB7F44 /* ca */,
+ DA618B261E68920D00CB7F44 /* lt */,
);
name = Foundation.stringsdict;
sourceTree = "<group>";
@@ -2398,6 +2441,8 @@
DAA32CA21E4C44DD006F8D24 /* de */,
DAA32CA91E4C4919006F8D24 /* fr */,
DA9C012B1E4C7AD900C4742A /* pt-BR */,
+ DA618B111E68823600CB7F44 /* ru */,
+ DA618B191E68883700CB7F44 /* ca */,
);
name = Localizable.stringsdict;
sourceTree = "<group>";
@@ -2418,6 +2463,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;
@@ -2470,6 +2516,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/ios/jazzy.yml b/platform/ios/jazzy.yml
index 9a119db31e..5d39e276b6 100644
--- a/platform/ios/jazzy.yml
+++ b/platform/ios/jazzy.yml
@@ -19,6 +19,7 @@ custom_categories:
children:
- Adding Points to a Map
- Runtime Styling
+ - Data-Driven Styling
- Working with Mapbox Studio
- Working with GeoJSON Data
- For Style Authors
diff --git a/platform/ios/resources/Base.lproj/Localizable.strings b/platform/ios/resources/Base.lproj/Localizable.strings
index 3d54ffd95b..fc2e8c8fec 100644
--- a/platform/ios/resources/Base.lproj/Localizable.strings
+++ b/platform/ios/resources/Base.lproj/Localizable.strings
@@ -52,9 +52,13 @@
/* Action sheet title */
"SDK_NAME" = "Mapbox iOS SDK";
+
/* User-friendly error description */
"STYLE_NOT_FOUND_DESC" = "The map failed to load because the style can’t be found or is incompatible.";
+/* Developer-only SDK update notification; {latest version, in format x.x.x} */
+"SDK_UPDATE_AVAILABLE" = "Mapbox iOS SDK version %@ is now available:";
+
/* Telemetry prompt message */
"TELEMETRY_DISABLED_MSG" = "You can help make OpenStreetMap and Mapbox maps better by contributing anonymous usage data.";
diff --git a/platform/ios/resources/ca.lproj/Localizable.strings b/platform/ios/resources/ca.lproj/Localizable.strings
new file mode 100644
index 0000000000..aec7226e6b
--- /dev/null
+++ b/platform/ios/resources/ca.lproj/Localizable.strings
@@ -0,0 +1,75 @@
+/* Accessibility hint */
+"ANNOTATION_A11Y_HINT" = "Mostra més informació";
+
+/* No comment provided by engineer. */
+"API_CLIENT_400_DESC" = "La tasca de dades de la sessió ha fallat. La petició original era: %@";
+
+/* No comment provided by engineer. */
+"API_CLIENT_400_REASON" = "El codi d’estat era %ld";
+
+/* No comment provided by engineer. */
+"CANCEL" = "Cancel·lar";
+
+/* Accessibility hint */
+"COMPASS_A11Y_HINT" = "Orienta el mapa amb rumb nord";
+
+/* Accessibility label */
+"COMPASS_A11Y_LABEL" = "Brúixola";
+
+/* Compass abbreviation for north */
+"COMPASS_NORTH" = "N";
+
+/* Instructions in Interface Builder designable; {key}, {plist file name} */
+"DESIGNABLE" = "Per mostrar aquí un mapa allotjat a Mapbox posa %1$@ al teu token d’accés a %2$@\n\nPer obtenir instruccions detallades, consulteu:";
+
+/* Setup documentation URL display string; keep as short as possible */
+"FIRST_STEPS_URL" = "mapbox.com/help/first-steps-ios-sdk";
+
+/* Accessibility hint */
+"INFO_A11Y_HINT" = "Mostra els crèdits, el formulari de contacte i més";
+
+/* Accessibility label */
+"INFO_A11Y_LABEL" = "Sobre aquest mapa";
+
+/* Accessibility label */
+"LOGO_A11Y_LABEL" = "Mapbox";
+
+/* Accessibility label */
+"MAP_A11Y_LABEL" = "Mapa";
+
+/* Map accessibility value */
+"MAP_A11Y_VALUE" = "Zoom %1$dx\n%2$ld anotació (ns) visibles";
+
+/* Action sheet title */
+"SDK_NAME" = "Mapbox iOS SDK";
+
+/* Telemetry prompt message */
+"TELEMETRY_DISABLED_MSG" = "Pots ajudar a millorar els mapes d’OpenStreetMap i de Mapbox aportant dades d’ús anònimes.";
+
+/* Telemetry prompt button */
+"TELEMETRY_DISABLED_OFF" = "No vull participar";
+
+/* Telemetry prompt button */
+"TELEMETRY_DISABLED_ON" = "Participar";
+
+/* Telemetry prompt message */
+"TELEMETRY_ENABLED_MSG" = "Estàs ajudant a millorar els mapes d’OpenStreetMap i de Mapbox aportant dades d’ús anònimes.";
+
+/* Telemetry prompt button */
+"TELEMETRY_ENABLED_OFF" = "Aturar la participació";
+
+/* Telemetry prompt button */
+"TELEMETRY_ENABLED_ON" = "Continuar la participació";
+
+/* Telemetry prompt button */
+"TELEMETRY_MORE" = "Vull saber-ne més";
+
+/* Action in attribution sheet */
+"TELEMETRY_NAME" = "Telemetria de Mapbox";
+
+/* Telemetry prompt title */
+"TELEMETRY_TITLE" = "Millora els mapes de Mapbox";
+
+/* Default user location annotation title */
+"USER_DOT_TITLE" = "Ets aquí";
+
diff --git a/platform/ios/resources/ca.lproj/Localizable.stringsdict b/platform/ios/resources/ca.lproj/Localizable.stringsdict
new file mode 100644
index 0000000000..85a839d870
--- /dev/null
+++ b/platform/ios/resources/ca.lproj/Localizable.stringsdict
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>MAP_A11Y_VALUE</key>
+ <dict>
+ <key>NSStringLocalizedFormatKey</key>
+ <string>Zoom %dx
+%#@count@ visible</string>
+ <key>count</key>
+ <dict>
+ <key>NSStringFormatSpecTypeKey</key>
+ <string>NSStringPluralRuleType</string>
+ <key>NSStringFormatValueTypeKey</key>
+ <string>ld</string>
+ <key>one</key>
+ <string>%d anotació</string>
+ <key>other</key>
+ <string>%d anotacions</string>
+ </dict>
+ </dict>
+</dict>
+</plist>
diff --git a/platform/ios/resources/ja.lproj/Localizable.strings b/platform/ios/resources/ja.lproj/Localizable.strings
index 87c40bb920..b8fde1cdb2 100644
--- a/platform/ios/resources/ja.lproj/Localizable.strings
+++ b/platform/ios/resources/ja.lproj/Localizable.strings
@@ -43,6 +43,9 @@
/* Action sheet title */
"SDK_NAME" = "Mapbox iOS SDK";
+/* Developer-only SDK update notification; {latest version, in format x.x.x} */
+"SDK_UPDATE_AVAILABLE" = "現在Mapbox iOS SDK %1$@が入手できる:";
+
/* Telemetry prompt message */
"TELEMETRY_DISABLED_MSG" = "You can help make OpenStreetMap and Mapbox maps better by contributing anonymous usage data.";
diff --git a/platform/ios/resources/ru.lproj/Localizable.strings b/platform/ios/resources/ru.lproj/Localizable.strings
index c895e34cee..1c3b46f057 100644
--- a/platform/ios/resources/ru.lproj/Localizable.strings
+++ b/platform/ios/resources/ru.lproj/Localizable.strings
@@ -20,7 +20,7 @@
"COMPASS_NORTH" = "N";
/* Instructions in Interface Builder designable; {key}, {plist file name} */
-"DESIGNABLE" = "To display a Mapbox-hosted map here, set %1$@ to your access token in %2$@\n\nFor detailed instructions, see:";
+"DESIGNABLE" = "Для отображения здесь карт Mapbox задайте %1$@ к вашему токену доступа в %2$@\n\nПодробные инструкции см.:";
/* Setup documentation URL display string; keep as short as possible */
"FIRST_STEPS_URL" = "mapbox.com/help/first-steps-ios-sdk";
@@ -38,13 +38,13 @@
"MAP_A11Y_LABEL" = "Карта";
/* Map accessibility value */
-"MAP_A11Y_VALUE" = "Zoom %1$dx\n%2$ld annotation(s) visible";
+"MAP_A11Y_VALUE" = "Масштаб %1$dx\n%2$ld аннотации(й) видны";
/* Action sheet title */
"SDK_NAME" = "Mapbox iOS SDK";
/* Telemetry prompt message */
-"TELEMETRY_DISABLED_MSG" = "You can help make OpenStreetMap and Mapbox maps better by contributing anonymous usage data.";
+"TELEMETRY_DISABLED_MSG" = "Вы можете помочь сделать карты OpenStreetMap и Mapbox лучше путем предоставления анонимных данных об использовании.";
/* Telemetry prompt button */
"TELEMETRY_DISABLED_OFF" = "Не участвовать";
@@ -53,7 +53,7 @@
"TELEMETRY_DISABLED_ON" = "Участвовать";
/* Telemetry prompt message */
-"TELEMETRY_ENABLED_MSG" = "You are helping to make OpenStreetMap and Mapbox maps better by contributing anonymous usage data.";
+"TELEMETRY_ENABLED_MSG" = "Вы помогаете сделать карты OpenStreetMap и Mapbox лучше путем предоставления анонимных данных об использовании.";
/* Telemetry prompt button */
"TELEMETRY_ENABLED_OFF" = "Прекратить участие";
diff --git a/platform/ios/resources/ru.lproj/Localizable.stringsdict b/platform/ios/resources/ru.lproj/Localizable.stringsdict
new file mode 100644
index 0000000000..49f9cc4621
--- /dev/null
+++ b/platform/ios/resources/ru.lproj/Localizable.stringsdict
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>MAP_A11Y_VALUE</key>
+ <dict>
+ <key>NSStringLocalizedFormatKey</key>
+ <string>Zoom %dx
+%#@count@ visible</string>
+ <key>count</key>
+ <dict>
+ <key>NSStringFormatSpecTypeKey</key>
+ <string>NSStringPluralRuleType</string>
+ <key>NSStringFormatValueTypeKey</key>
+ <string>ld</string>
+ <key>one</key>
+ <string>%d аннотация</string>
+ <key>few</key>
+ <string>%d аннотации</string>
+ <key>many</key>
+ <string>%d аннотаций</string>
+ <key>other</key>
+ <string>%d аннотации</string>
+ </dict>
+ </dict>
+</dict>
+</plist>
diff --git a/platform/ios/scripts/deploy-packages.sh b/platform/ios/scripts/deploy-packages.sh
index 479803aa05..4a3c73295a 100755
--- a/platform/ios/scripts/deploy-packages.sh
+++ b/platform/ios/scripts/deploy-packages.sh
@@ -83,7 +83,7 @@ if [[ $( echo ${VERSION_TAG} | grep --invert-match ios-v ) ]]; then
exit 1
fi
-if [[ $( wget --spider -O- https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/releases/tags/${VERSION_TAG} 2>&1 | grep -c "404 Not Found" ) == 0 ]]; then
+if [[ $( curl --head https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/releases/tags/${VERSION_TAG} | head -n 1 | grep -c "404 Not Found") == 0 ]]; then
echo "Error: ${VERSION_TAG} has already been published on GitHub"
echo "See: https://github.com/${GITHUB_USER}/${GITHUB_REPO}/releases/tag/${VERSION_TAG}"
exit 1
diff --git a/platform/ios/src/MGLAnnotationView.mm b/platform/ios/src/MGLAnnotationView.mm
index 0e904779d5..5e0ae3b848 100644
--- a/platform/ios/src/MGLAnnotationView.mm
+++ b/platform/ios/src/MGLAnnotationView.mm
@@ -239,7 +239,10 @@
}
else if (dragState == MGLAnnotationViewDragStateCanceling)
{
- NSAssert(self.annotation, @"Annotation property should not be nil.");
+ if (!self.annotation) {
+ [NSException raise:NSInvalidArgumentException
+ format:@"Annotation property should not be nil."];
+ }
self.panGestureRecognizer.enabled = NO;
self.longPressRecognizer.enabled = NO;
self.center = [self.mapView convertCoordinate:self.annotation.coordinate toPointToView:self.mapView];
diff --git a/platform/ios/src/MGLMapView.h b/platform/ios/src/MGLMapView.h
index 8fb58005de..4872ff2448 100644
--- a/platform/ios/src/MGLMapView.h
+++ b/platform/ios/src/MGLMapView.h
@@ -45,6 +45,40 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationVerticalAlignment) {
};
/**
+ The mode used to track the user location on the map. Used with
+ `MGLMapView.userTrackingMode`.
+ */
+typedef NS_ENUM(NSUInteger, MGLUserTrackingMode) {
+ /** The map does not follow the user location. */
+ MGLUserTrackingModeNone = 0,
+ /** The map follows the user location. This tracking mode falls back
+ to `MGLUserTrackingModeNone` if the user pans the map view. */
+ MGLUserTrackingModeFollow,
+ /**
+ The map follows the user location and rotates when the heading changes.
+ The default user location annotation displays a fan-shaped indicator with
+ the current heading. The heading indicator represents the direction the
+ device is facing, which is sized according to the reported accuracy.
+
+ This tracking mode is disabled if the user pans the map view, but
+ remains enabled if the user zooms in. If the user rotates the map
+ view, this tracking mode will fall back to `MGLUserTrackingModeFollow`.
+ */
+ MGLUserTrackingModeFollowWithHeading,
+ /**
+ The map follows the user location and rotates when the course changes.
+ Course represents the direction in which the device is traveling.
+ The default user location annotation shows a puck-shaped indicator
+ that rotates as the course changes.
+
+ This tracking mode is disabled if the user pans the map view, but
+ remains enabled if the user zooms in. If the user rotates the map view,
+ this tracking mode will fall back to `MGLUserTrackingModeFollow`.
+ */
+ MGLUserTrackingModeFollowWithCourse,
+};
+
+/**
An interactive, customizable map view with an interface similar to the one
provided by Apple’s MapKit.
@@ -1137,10 +1171,11 @@ IB_DESIGNABLE
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.
+ 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
@@ -1153,17 +1188,17 @@ 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
@@ -1190,13 +1225,18 @@ 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”
+ 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.
+ 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
@@ -1227,9 +1267,9 @@ IB_DESIGNABLE
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
- `-visibleFeaturesAtPoint:inStyleLayersWithIdentifiers:predicate:` method. For
+ 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.
@@ -1248,13 +1288,14 @@ IB_DESIGNABLE
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
@@ -1282,6 +1323,11 @@ 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
@@ -1290,6 +1336,14 @@ IB_DESIGNABLE
approach also avoids layer identifer name changes that will occur in the default
style’s layers over time.
+ @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.
+
@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
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 257167227f..1ccd5ce355 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -58,6 +58,7 @@
#import "MGLStyle_Private.h"
#import "MGLStyleLayer_Private.h"
#import "MGLMapboxEvents.h"
+#import "MGLSDKUpdateChecker.h"
#import "MGLCompactCalloutView.h"
#import "MGLAnnotationContainerView.h"
#import "MGLAnnotationContainerView_Private.h"
@@ -350,6 +351,14 @@ public:
return self;
}
++ (void)initialize
+{
+ if (self == [MGLMapView self])
+ {
+ [MGLSDKUpdateChecker checkForUpdates];
+ }
+}
+
+ (NS_SET_OF(NSString *) *)keyPathsForValuesAffectingStyle
{
return [NSSet setWithObject:@"styleURL"];
@@ -533,14 +542,11 @@ public:
_decelerationRate = MGLMapViewDecelerationRateNormal;
- if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
- {
- _quickZoom = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleQuickZoomGesture:)];
- _quickZoom.numberOfTapsRequired = 1;
- _quickZoom.minimumPressDuration = 0;
- [_quickZoom requireGestureRecognizerToFail:doubleTap];
- [self addGestureRecognizer:_quickZoom];
- }
+ _quickZoom = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleQuickZoomGesture:)];
+ _quickZoom.numberOfTapsRequired = 1;
+ _quickZoom.minimumPressDuration = 0;
+ [_quickZoom requireGestureRecognizerToFail:doubleTap];
+ [self addGestureRecognizer:_quickZoom];
// observe app activity
//
@@ -1242,7 +1248,7 @@ public:
if (![self.delegate respondsToSelector:@selector(mapView:shouldChangeFromCamera:toCamera:)] ||
[self.delegate mapView:self shouldChangeFromCamera:oldCamera toCamera:toCamera])
{
- _mbglMap->moveBy({ offset.x, offset.y }, MGLDurationInSecondsFromTimeInterval(self.decelerationRate));
+ _mbglMap->moveBy({ offset.x, offset.y }, MGLDurationFromTimeInterval(self.decelerationRate));
}
}
@@ -1351,7 +1357,7 @@ public:
} else {
if (drift)
{
- _mbglMap->setScale(newScale, mbgl::ScreenCoordinate { centerPoint.x, centerPoint.y }, MGLDurationInSecondsFromTimeInterval(duration));
+ _mbglMap->setScale(newScale, mbgl::ScreenCoordinate { centerPoint.x, centerPoint.y }, MGLDurationFromTimeInterval(duration));
}
}
@@ -1422,7 +1428,7 @@ public:
if (![self.delegate respondsToSelector:@selector(mapView:shouldChangeFromCamera:toCamera:)] ||
[self.delegate mapView:self shouldChangeFromCamera:oldCamera toCamera:toCamera])
{
- _mbglMap->setBearing(newDegrees, mbgl::ScreenCoordinate { centerPoint.x, centerPoint.y }, MGLDurationInSecondsFromTimeInterval(decelerationRate));
+ _mbglMap->setBearing(newDegrees, mbgl::ScreenCoordinate { centerPoint.x, centerPoint.y }, MGLDurationFromTimeInterval(decelerationRate));
[self notifyGestureDidEndWithDrift:YES];
@@ -1513,14 +1519,18 @@ public:
return nil;
}
}
-
+
// Handle the case of an offset annotation view by converting the tap point to be the geo location
// of the annotation itself that the view represents
for (MGLAnnotationView *view in self.annotationContainerView.annotationViews)
{
if (view.centerOffset.dx != 0 || view.centerOffset.dy != 0) {
if (CGRectContainsPoint(view.frame, tapPoint)) {
- NSAssert(view.annotation, @"Annotation's view annotation property should not be nil.");
+ if (!view.annotation) {
+ [NSException raise:NSInvalidArgumentException
+ format:@"Annotation view's annotation property should not be nil."];
+ }
+
CGPoint annotationPoint = [self convertCoordinate:view.annotation.coordinate toPointToView:self];
tapPoint = annotationPoint;
}
@@ -1563,7 +1573,7 @@ public:
[self trackGestureEvent:MGLEventGestureDoubleTap forRecognizer:doubleTap];
mbgl::ScreenCoordinate center(gesturePoint.x, gesturePoint.y);
- _mbglMap->setZoom(newZoom, center, MGLDurationInSecondsFromTimeInterval(MGLAnimationDuration));
+ _mbglMap->setZoom(newZoom, center, MGLDurationFromTimeInterval(MGLAnimationDuration));
__weak MGLMapView *weakSelf = self;
@@ -1601,7 +1611,7 @@ public:
[self.delegate mapView:self shouldChangeFromCamera:oldCamera toCamera:toCamera])
{
mbgl::ScreenCoordinate center(gesturePoint.x, gesturePoint.y);
- _mbglMap->setZoom(newZoom, center, MGLDurationInSecondsFromTimeInterval(MGLAnimationDuration));
+ _mbglMap->setZoom(newZoom, center, MGLDurationFromTimeInterval(MGLAnimationDuration));
__weak MGLMapView *weakSelf = self;
@@ -1991,10 +2001,7 @@ public:
// Update the annotation’s backing geometry to match the annotation model object. Any associated annotation view is also moved by side effect. However, -updateAnnotationViews disables the view’s animation actions, because it can’t distinguish between moves due to the viewport changing and moves due to the annotation’s coordinate changing.
_mbglMap->updateAnnotation(annotationTag, mbgl::SymbolAnnotation { point, symbolName.UTF8String });
- if (annotationTag == _selectedAnnotationTag)
- {
- [self deselectAnnotation:annotation animated:YES];
- }
+ [self updateCalloutView];
}
}
else if ([keyPath isEqualToString:@"coordinates"] && [object isKindOfClass:[MGLMultiPoint class]])
@@ -2011,13 +2018,7 @@ public:
{
// Update the annotation’s backing geometry to match the annotation model object.
_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 animated:YES];
- }
+ [self updateCalloutView];
}
}
}
@@ -2431,7 +2432,7 @@ public:
mbgl::AnimationOptions animationOptions;
if (duration)
{
- animationOptions.duration.emplace(MGLDurationInSecondsFromTimeInterval(duration));
+ animationOptions.duration.emplace(MGLDurationFromTimeInterval(duration));
animationOptions.easing.emplace(MGLUnitBezierForMediaTimingFunction(function));
}
if (completion)
@@ -2486,7 +2487,7 @@ public:
_mbglMap->setZoom(zoomLevel,
MGLEdgeInsetsFromNSEdgeInsets(self.contentInset),
- MGLDurationInSecondsFromTimeInterval(duration));
+ MGLDurationFromTimeInterval(duration));
}
- (void)setMinimumZoomLevel:(double)minimumZoomLevel
@@ -2595,7 +2596,7 @@ public:
mbgl::AnimationOptions animationOptions;
if (duration > 0)
{
- animationOptions.duration.emplace(MGLDurationInSecondsFromTimeInterval(duration));
+ animationOptions.duration.emplace(MGLDurationFromTimeInterval(duration));
animationOptions.easing.emplace(MGLUnitBezierForMediaTimingFunction(function));
}
if (completion)
@@ -2658,13 +2659,13 @@ public:
{
_mbglMap->setBearing(direction,
MGLEdgeInsetsFromNSEdgeInsets(self.contentInset),
- MGLDurationInSecondsFromTimeInterval(duration));
+ MGLDurationFromTimeInterval(duration));
}
else
{
CGPoint centerPoint = self.userLocationAnnotationViewCenter;
_mbglMap->setBearing(direction, mbgl::ScreenCoordinate { centerPoint.x, centerPoint.y },
- MGLDurationInSecondsFromTimeInterval(duration));
+ MGLDurationFromTimeInterval(duration));
}
}
@@ -2709,7 +2710,7 @@ public:
mbgl::AnimationOptions animationOptions;
if (duration > 0)
{
- animationOptions.duration.emplace(MGLDurationInSecondsFromTimeInterval(duration));
+ animationOptions.duration.emplace(MGLDurationFromTimeInterval(duration));
animationOptions.easing.emplace(MGLUnitBezierForMediaTimingFunction(function));
}
if (completion)
@@ -2759,7 +2760,7 @@ public:
mbgl::AnimationOptions animationOptions;
if (duration >= 0)
{
- animationOptions.duration = MGLDurationInSecondsFromTimeInterval(duration);
+ animationOptions.duration = MGLDurationFromTimeInterval(duration);
}
if (peakAltitude >= 0)
{
@@ -3067,7 +3068,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 || annotation == self.userLocation
@@ -3107,7 +3108,7 @@ public:
NSAssert([annotation conformsToProtocol:@protocol(MGLAnnotation)], @"annotation should conform to MGLAnnotation");
// adding the same annotation object twice is a no-op
- if ([self.annotations containsObject:annotation])
+ if (_annotationTagsByAnnotation.count(annotation) != 0)
{
continue;
}
diff --git a/platform/ios/src/MGLMapViewDelegate.h b/platform/ios/src/MGLMapViewDelegate.h
index 12320a63a5..c1faaa3d07 100644
--- a/platform/ios/src/MGLMapViewDelegate.h
+++ b/platform/ios/src/MGLMapViewDelegate.h
@@ -22,12 +22,11 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark Responding to Map Position Changes
/**
- Tells the delegate that the viewpoint depicted by the map view is about to
- change.
-
+ Tells the delegate that the viewpoint depicted by the map view is about to change.
+
This method is called whenever the currently displayed map camera will start
changing for any reason.
-
+
@param mapView The map view whose viewpoint will change.
@param animated Whether the change will cause an animated effect on the map.
*/
@@ -38,10 +37,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.
*/
@@ -52,7 +53,8 @@ NS_ASSUME_NONNULL_BEGIN
changing.
This method is called whenever the currently displayed map camera has finished
- changing, after any calls to `-mapViewRegionIsChanging:` due to animation.
+ changing, after any calls to `-mapViewRegionIsChanging:` due to animation. Therefore,
+ 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.
diff --git a/platform/ios/src/MGLSDKUpdateChecker.h b/platform/ios/src/MGLSDKUpdateChecker.h
new file mode 100644
index 0000000000..13cef46ad4
--- /dev/null
+++ b/platform/ios/src/MGLSDKUpdateChecker.h
@@ -0,0 +1,13 @@
+#import <Foundation/Foundation.h>
+
+#import "MGLFoundation.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface MGLSDKUpdateChecker : NSObject
+
++ (void)checkForUpdates;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/platform/ios/src/MGLSDKUpdateChecker.mm b/platform/ios/src/MGLSDKUpdateChecker.mm
new file mode 100644
index 0000000000..ab4ef7be86
--- /dev/null
+++ b/platform/ios/src/MGLSDKUpdateChecker.mm
@@ -0,0 +1,39 @@
+#import "MGLSDKUpdateChecker.h"
+#import "NSBundle+MGLAdditions.h"
+#import "NSProcessInfo+MGLAdditions.h"
+
+@implementation MGLSDKUpdateChecker
+
++ (void)checkForUpdates {
+#if TARGET_IPHONE_SIMULATOR
+ // Abort if running in a playground.
+ if ([[NSBundle mainBundle].bundleIdentifier hasPrefix:@"com.apple.dt.playground."] ||
+ NSProcessInfo.processInfo.mgl_isInterfaceBuilderDesignablesAgent) {
+ return;
+ }
+
+ NSString *currentVersion = [NSBundle mgl_frameworkInfoDictionary][@"MGLSemanticVersionString"];
+
+ // Skip version check if weʼre doing gl-native development, as the framework
+ // version is `1` until built for packaging.
+ if ([currentVersion isEqualToString:@"1.0.0"]) {
+ return;
+ }
+
+ NSURL *url = [NSURL URLWithString:@"https://www.mapbox.com/ios-sdk/latest_version"];
+ [[NSURLSession.sharedSession dataTaskWithURL:url completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
+ if (error || ((NSHTTPURLResponse *)response).statusCode != 200) {
+ return;
+ }
+
+ NSString *latestVersion = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
+ latestVersion = [latestVersion stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
+ if (![currentVersion isEqualToString:latestVersion]) {
+ NSString *updateAvailable = [NSString stringWithFormat:NSLocalizedStringWithDefaultValue(@"SDK_UPDATE_AVAILABLE", nil, nil, @"Mapbox iOS SDK version %@ is now available:", @"Developer-only SDK update notification; {latest version, in format x.x.x}"), latestVersion];
+ NSLog(@"%@ https://github.com/mapbox/mapbox-gl-native/releases/tag/ios-v%@", updateAvailable, latestVersion);
+ }
+ }] resume];
+#endif
+}
+
+@end
diff --git a/platform/ios/vendor/Fabric/Fabric.h b/platform/ios/vendor/Fabric/Fabric.h
index 8673be4827..f0ca18fb16 100644
--- a/platform/ios/vendor/Fabric/Fabric.h
+++ b/platform/ios/vendor/Fabric/Fabric.h
@@ -27,7 +27,7 @@ NS_ASSUME_NONNULL_BEGIN
*
* Only the first call to this method is honored. Subsequent calls are no-ops.
*
- * @param kits An array of kit Class objects
+ * @param kitClasses An array of kit Class objects
*
* @return Returns the shared Fabric instance. In most cases this can be ignored.
*/
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.
*/