summaryrefslogtreecommitdiff
path: root/platform/macos
diff options
context:
space:
mode:
Diffstat (limited to 'platform/macos')
-rw-r--r--platform/macos/CHANGELOG.md42
-rw-r--r--platform/macos/DEVELOPING.md21
-rw-r--r--platform/macos/INSTALL.md8
-rw-r--r--platform/macos/Mapbox-macOS-SDK-symbols.podspec2
-rw-r--r--platform/macos/Mapbox-macOS-SDK.podspec2
-rw-r--r--platform/macos/README.md18
-rw-r--r--platform/macos/app/AppDelegate.m50
-rw-r--r--platform/macos/app/Base.lproj/Localizable.strings0
-rw-r--r--platform/macos/app/Base.lproj/MainMenu.xib8
-rw-r--r--platform/macos/app/Base.lproj/MapDocument.xib11
-rw-r--r--platform/macos/app/DroppedPinAnnotation.m2
-rw-r--r--platform/macos/app/Info.plist2
-rw-r--r--platform/macos/app/LimeGreenStyleLayer.m8
-rw-r--r--platform/macos/app/MGLVectorSource+MBXAdditions.m2
-rw-r--r--platform/macos/app/MapDocument.m116
-rw-r--r--platform/macos/app/OfflinePackNameValueTransformer.m4
-rw-r--r--platform/macos/app/StyleLayerIconTransformer.m2
-rw-r--r--platform/macos/app/TimeIntervalTransformer.m6
-rw-r--r--platform/macos/app/de.lproj/Localizable.strings0
-rw-r--r--platform/macos/app/es.lproj/Localizable.strings0
-rw-r--r--platform/macos/app/fr.lproj/Localizable.strings0
-rw-r--r--platform/macos/app/ja.lproj/Localizable.strings0
-rw-r--r--platform/macos/app/lt.lproj/Localizable.strings0
-rw-r--r--platform/macos/app/pl.lproj/Localizable.strings0
-rw-r--r--platform/macos/app/pt-BR.lproj/Localizable.strings0
-rw-r--r--platform/macos/app/sv.lproj/Localizable.strings0
-rw-r--r--platform/macos/app/uk.lproj/Localizable.strings0
-rw-r--r--platform/macos/app/vi.lproj/Localizable.strings0
-rw-r--r--platform/macos/app/zh-Hans.lproj/Localizable.strings0
-rw-r--r--platform/macos/app/zh-Hant.lproj/Localizable.strings0
-rw-r--r--platform/macos/config.cmake10
-rw-r--r--platform/macos/docs/guides/For Style Authors.md11
-rw-r--r--platform/macos/docs/pod-README.md6
-rw-r--r--platform/macos/jazzy.yml1
-rw-r--r--platform/macos/macos.xcodeproj/project.pbxproj125
-rwxr-xr-xplatform/macos/scripts/deploy-packages.sh14
-rw-r--r--platform/macos/sdk/de.lproj/Localizable.strings15
-rw-r--r--platform/macos/sdk/es.lproj/Localizable.strings15
-rw-r--r--platform/macos/sdk/fr.lproj/Localizable.strings15
-rw-r--r--platform/macos/sdk/ja.lproj/Localizable.strings15
-rw-r--r--platform/macos/sdk/lt.lproj/Localizable.strings15
-rw-r--r--platform/macos/sdk/pl.lproj/Localizable.strings15
-rw-r--r--platform/macos/sdk/pt-BR.lproj/Localizable.strings15
-rw-r--r--platform/macos/sdk/sv.lproj/Localizable.strings15
-rw-r--r--platform/macos/sdk/uk.lproj/Localizable.strings15
-rw-r--r--platform/macos/sdk/vi.lproj/Localizable.strings15
-rw-r--r--platform/macos/sdk/zh-Hant.lproj/Localizable.strings15
-rw-r--r--platform/macos/src/MGLAnnotationImage.h10
-rw-r--r--platform/macos/src/MGLAnnotationImage.m4
-rw-r--r--platform/macos/src/MGLAttributionButton.mm10
-rw-r--r--platform/macos/src/MGLMapView+IBAdditions.h2
-rw-r--r--platform/macos/src/MGLMapView.h253
-rw-r--r--platform/macos/src/MGLMapView.mm208
-rw-r--r--platform/macos/src/MGLMapViewDelegate.h96
-rw-r--r--platform/macos/src/MGLOpenGLLayer.mm17
-rw-r--r--platform/macos/src/Mapbox.h1
-rw-r--r--platform/macos/src/NSColor+MGLAdditions.mm4
-rw-r--r--platform/macos/src/NSImage+MGLAdditions.h2
-rw-r--r--platform/macos/src/NSImage+MGLAdditions.mm23
-rw-r--r--platform/macos/test/MGLAttributionButtonTests.m4
60 files changed, 898 insertions, 372 deletions
diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md
index 90387cfdea..5015ee0819 100644
--- a/platform/macos/CHANGELOG.md
+++ b/platform/macos/CHANGELOG.md
@@ -6,10 +6,12 @@
* 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))
-* Added a Simplified Chinese localization. ([#7316](https://github.com/mapbox/mapbox-gl-native/pull/7316), [#7503](https://github.com/mapbox/mapbox-gl-native/pull/7503))
+* 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))
### 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 `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))
@@ -19,15 +21,46 @@
* 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))
* Fixed an issue that collapsed consecutive newlines within text labels. ([#7446](https://github.com/mapbox/mapbox-gl-native/pull/7446))
+* Fixed artifacts when drawing particularly acute line joins. ([#7786](https://github.com/mapbox/mapbox-gl-native/pull/7786))
+* Fixed an issue in which a vector style layer predicate involving the `$id` key path would exclude all features from the layer. ([#7989](https://github.com/mapbox/mapbox-gl-native/pull/7989), [#7971](https://github.com/mapbox/mapbox-gl-native/pull/7971))
+* 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 `MGLComputedShapeSource` source class that allows applications to supply vector data on a per-tile basis.
+### 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))
+* 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))
+
+### Networking and offline maps
+
+* Offline pack notifications are now posted by `MGLOfflinePack` instances instead of the shared `MGLOfflineStorage` object. For backwards compatibility, the `userInfo` dictionary still indicates the pack’s state and progress. ([#7952](https://github.com/mapbox/mapbox-gl-native/pull/7952))
+* 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))
+
### Other changes
+* 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))
* Fixed flickering that occurred when panning past the antimeridian. ([#7574](https://github.com/mapbox/mapbox-gl-native/pull/7574))
-* 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))
+* Added a `MGLDistanceFormatter` class for formatting geographic distances. ([#7888](https://github.com/mapbox/mapbox-gl-native/pull/7888))
+
+## 0.3.1 - February 21, 2017
+
+This version of the Mapbox macOS SDK corresponds to version 3.4.2 of the Mapbox iOS SDK.
+
+* Fixed an issue causing MGLMapView’s `camera`’s `heading` to be set to a negative value, indicating an undefined heading, when the map view faces northwest. The heading is now wrapped to between zero and 360 degrees, for consistency with MGLMapView’s `direction` property. ([#7724](https://github.com/mapbox/mapbox-gl-native/pull/7724))
+* Fixed a crash that occurred when moving a window containing an MGLMapView from one screen to another. ([#8004](https://github.com/mapbox/mapbox-gl-native/pull/8004))
+* Fixed an issue preventing the use of the integrated GPU on machines that have more than one GPU. Follow the instructions in [Technical Q&A 1734](https://developer.apple.com/library/content/qa/qa1734/_index.html) to enable integrated GPU usage in your application. ([#7834](https://github.com/mapbox/mapbox-gl-native/pull/7834))
+* Fixed an issue causing the mouse cursor to jump after shift- or option-dragging a map view if the window opened on a screen with a different size than the screen with keyboard focus. ([#7846](https://github.com/mapbox/mapbox-gl-native/pull/7846))
+* Deprecated the style class methods in MGLStyle. ([#7785](https://github.com/mapbox/mapbox-gl-native/pull/7785))
+* Improved the performance of trivial camera animations. ([#7125](https://github.com/mapbox/mapbox-gl-native/pull/7125))
-## 0.3.0
+## 0.3.0 - January 21, 2016
This version of the Mapbox macOS SDK corresponds to version 3.4.0 of the Mapbox iOS SDK. The two SDKs have very similar feature sets. The main differences are the lack of user location tracking and annotation views. Some APIs have been adapted to macOS conventions, particularly the use of NSPopover for callout views.
@@ -64,7 +97,8 @@ This version of the Mapbox macOS SDK corresponds to version 3.4.0 of the Mapbox
* Added `showAnnotations:animated:` and `showAnnotations:edgePadding:animated:`, which moves the map viewport to show the specified annotations. ([#5749](https://github.com/mapbox/mapbox-gl-native/pull/5749))
* Added new methods to MGLMultiPoint for changing the vertices along a polyline annotation or the exterior of a polygon annotation. ([#6565](https://github.com/mapbox/mapbox-gl-native/pull/6565))
-* Added new APIs to MGLMapView to query for visible annotations. ([6061](https://github.com/mapbox/mapbox-gl-native/pull/6061))
+* Fixed an exception raised when adding a custom annotation model object to MGLMapView. ([#7746](https://github.com/mapbox/mapbox-gl-native/pull/7746))
+* Added new APIs to MGLMapView to query for visible annotations. ([#6061](https://github.com/mapbox/mapbox-gl-native/pull/6061))
* Shape, feature, and annotation classes now conform to NSSecureCoding. ([#6559](https://github.com/mapbox/mapbox-gl-native/pull/6559))
* Various method arguments that are represented as C arrays of `CLLocationCoordinate2D` instances have been marked `const` to streamline bridging to Swift. ([#7215](https://github.com/mapbox/mapbox-gl-native/pull/7215))
* To make an MGLPolyline or MGLPolygon span the antimeridian, specify coordinates with longitudes greater than 180° or less than −180°. ([#6088](https://github.com/mapbox/mapbox-gl-native/pull/6088))
diff --git a/platform/macos/DEVELOPING.md b/platform/macos/DEVELOPING.md
index 6737566a5c..bc91e69456 100644
--- a/platform/macos/DEVELOPING.md
+++ b/platform/macos/DEVELOPING.md
@@ -89,12 +89,25 @@ To add or update text that the user may see in the macOS SDK:
### Adding a localization
-To add a localization to the macOS SDK:
+Translations of all the Mapbox GL Native SDKs are managed [in Transifex](https://www.transifex.com/mapbox/mapbox-gl-native/). If your language already has a translation, feel free to complete or proofread it. Otherwise, please [request your language](https://www.transifex.com/mapbox/mapbox-gl-native/languages/). Note that we’re primarily interested in languages that macOS supports as system languages.
+
+Once you’ve finished translating the SDK into a new language in Transifex, perform these steps to make Xcode aware of the translation:
1. In macos.xcworkspace, open the project editor for macos.xcodeproj. Using the project editor’s sidebar or tab bar dropdown, go to the “macos” project; under the Localizations section of the Info tab, click the + button to add your language to the project.
-1. In the sheet that appears, select all the .strings and .stringsdict files but no .xib file. (Most of the XIBs are part of the macosapp example application, which is not localized, while MGLAnnotationCallout.xib contains no localizable strings.)
-1. In the Project navigator, expand each .strings and .stringsdict file in the project. An additional version for your localization should be listed; translate it. Translate everything on the right side of the equals sign. Leave the left side and any comments unmodified. See Apple’s documentation on the [.strings](https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/LoadingResources/Strings/Strings.html) and [.stringsdict](https://developer.apple.com/library/content/documentation/MacOSX/Conceptual/BPInternational/StringsdictFileFormat/StringsdictFileFormat.html) formats.
-1. You’re already most of the way towards localizing the iOS SDK too – consider [completing that localization](../ios/DEVELOPING.md#adding-a-localization).
+1. In the sheet that appears, select all the .strings and .stringsdict files but no .xib file. (Most of the XIBs are part of the macosapp example application, which is not localized, while MGLAnnotationCallout.xib contains no localizable strings.) If your language lacks declension and pluralization, as in the case of Chinese, omit the .stringsdict files.
+1. In the Project navigator, expand each .stringsdict file in the project. An additional version for your localization should be listed; translate it. See Apple’s documentation on the [.stringsdict format](https://developer.apple.com/library/content/documentation/MacOSX/Conceptual/BPInternational/StringsdictFileFormat/StringsdictFileFormat.html).
+1. In the Project navigator, select Demo App/Localizable.strings and then, in the File Inspector, check the box for your new localization.
+1. Repeat the steps above in ios.xcworkspace.
+
+The .strings files should still be in the original English – that’s expected. Now you can pull your translations into this repository:
+
+1. _(First time only.)_ Download the [`tx` command line tool](https://docs.transifex.com/client/installing-the-client) and [configure your .transifexrc](https://docs.transifex.com/client/client-configuration).
+1. Run `tx pull -a`.
+1. Convert any added .strings files from UTF-16 encoding to UTF-8 encoding to facilitate diffing and merging. You can convert the file encoding using Xcode’s File inspector or the following command (substituting _MYLANG_ for the locale code):
+
+```
+find platform/{darwin,ios}/resources platform/macos/sdk -path '*/MYLANG.lproj/*.strings' -exec textutil -convert txt -extension strings -inputencoding UTF-16 -encoding UTF-8 {} -output {} \;
+```
### Adding a code example
diff --git a/platform/macos/INSTALL.md b/platform/macos/INSTALL.md
index f8b4c675de..ef04267c47 100644
--- a/platform/macos/INSTALL.md
+++ b/platform/macos/INSTALL.md
@@ -1,14 +1,14 @@
-# Integrating the Mapbox macOS SDK into your application
+# Integrating a custom build of the Mapbox macOS SDK into your application
-This document explains how to build the Mapbox macOS SDK and integrate it into your own Cocoa application.
+This document explains how to build a development version of the Mapbox macOS SDK from source and integrate it into your own Cocoa application. This process is for advanced developers who want to get a glimpse of the SDK’s development between releases. To use a production-ready version of the SDK, see the [Mapbox macOS SDK homepage](https://mapbox.github.io/mapbox-gl-native/macos/).
### Requirements
The Mapbox macOS SDK requires the macOS 10.10.0 SDK (or above) and Xcode 7.3 (or above).
-### Building the SDK
+### Building the SDK from source
-Grab a [prebuilt release](https://github.com/mapbox/mapbox-gl-native/releases/) – look for the releases that begin with “macos-” – or build the SDK from source:
+To build the SDK from source:
1. [Install core dependencies](../../INSTALL.md).
diff --git a/platform/macos/Mapbox-macOS-SDK-symbols.podspec b/platform/macos/Mapbox-macOS-SDK-symbols.podspec
index 6de7f829a3..c17e665512 100644
--- a/platform/macos/Mapbox-macOS-SDK-symbols.podspec
+++ b/platform/macos/Mapbox-macOS-SDK-symbols.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |m|
- version = '0.3.0-rc.1'
+ version = '0.3.1'
m.name = 'Mapbox-macOS-SDK-symbols'
m.version = "#{version}-symbols"
diff --git a/platform/macos/Mapbox-macOS-SDK.podspec b/platform/macos/Mapbox-macOS-SDK.podspec
index 03ef0eabe7..a6f2d2838b 100644
--- a/platform/macos/Mapbox-macOS-SDK.podspec
+++ b/platform/macos/Mapbox-macOS-SDK.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |m|
- version = '0.3.0-rc.1'
+ version = '0.3.1'
m.name = 'Mapbox-macOS-SDK'
m.version = version
diff --git a/platform/macos/README.md b/platform/macos/README.md
index aea5ba0d6a..14b3e0cf16 100644
--- a/platform/macos/README.md
+++ b/platform/macos/README.md
@@ -1,10 +1,10 @@
-# Mapbox macOS SDK
+# [Mapbox macOS SDK](https://mapbox.github.io/mapbox-gl-native/macos/)
[![Bitrise](https://www.bitrise.io/app/155ef7da24b38dcd.svg?token=4KSOw_gd6WxTnvGE2rMttg&branch=master)](https://www.bitrise.io/app/155ef7da24b38dcd)
Put interactive, scalable world maps into your native Cocoa application with the Mapbox macOS SDK.
-* Mapbox-curated [map styles](https://www.mapbox.com/maps/) and [vector tiles](https://www.mapbox.com/vector-tiles/) make it easy to get started.
+* Mapbox-curated [map styles](https://www.mapbox.com/maps/) and [OpenStreetMap-based](https://www.mapbox.com/vector-tiles/mapbox-streets-v7/) [vector tiles](https://www.mapbox.com/vector-tiles/) make it easy to get started.
* Customize every aspect of the map’s appearance in code or visually using [Mapbox Studio](https://www.mapbox.com/mapbox-studio/).
* High-performance OpenGL rendering and multitouch gestures keep your users happy.
* A well-designed, fully documented API helps you stay productive.
@@ -14,11 +14,17 @@ Put interactive, scalable world maps into your native Cocoa application with the
The Mapbox macOS SDK is compatible with macOS 10.10.0 and above for Cocoa applications developed in Objective-C, Swift, Interface Builder, or AppleScript. For hybrid applications, consider [Mapbox GL JS](https://github.com/mapbox/mapbox-gl-js/).
-* [Integrate the Mapbox macOS SDK into your application](INSTALL.md)
+Information for Mac developers:
+
+* [Integrate the Mapbox macOS SDK into your application](https://mapbox.github.io/mapbox-gl-native/macos/)
+* [Learn how to use the Mapbox macOS SDK](https://mapbox.github.io/mapbox-gl-native/macos/)
+* [Browse example styles designed in Mapbox Studio](https://www.mapbox.com/gallery/)
+
+Information for contributors:
+
+* [Build the Mapbox macOS SDK from source](INSTALL.md)
* [Contribute to the Mapbox macOS SDK](DEVELOPING.md)
-* [Mapbox macOS SDK reference documentation](https://mapbox.github.io/mapbox-gl-native/macos/)
-* [See example styles designed in Mapbox Studio](https://www.mapbox.com/gallery/)
-* [Hand-authoring a macOS SDK–compatible style](https://www.mapbox.com/mapbox-gl-style-spec/)
+* [Mapbox Style Specification](https://www.mapbox.com/mapbox-gl-style-spec/)
* [Mapbox Vector Tile Specification](https://www.mapbox.com/developers/vector-tiles/)
Mapbox does not officially support the Mapbox macOS SDK to the same extent as the Mapbox iOS SDK; however, bug reports and pull requests are certainly welcome.
diff --git a/platform/macos/app/AppDelegate.m b/platform/macos/app/AppDelegate.m
index d3fe2d204e..0d780424f9 100644
--- a/platform/macos/app/AppDelegate.m
+++ b/platform/macos/app/AppDelegate.m
@@ -20,10 +20,10 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask";
switch (self.state) {
case MGLOfflinePackStateComplete:
return [NSImage imageNamed:@"NSMenuOnStateTemplate"];
-
+
case MGLOfflinePackStateActive:
return [NSImage imageNamed:@"NSFollowLinkFreestandingTemplate"];
-
+
default:
return nil;
}
@@ -71,7 +71,7 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask";
@end
-@interface AppDelegate ()
+@interface AppDelegate () <NSWindowDelegate>
@property (weak) IBOutlet NSArrayController *offlinePacksArrayController;
@property (weak) IBOutlet NSPanel *offlinePacksPanel;
@@ -104,7 +104,7 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask";
andSelector:@selector(handleGetURLEvent:withReplyEvent:)
forEventClass:kInternetEventClass
andEventID:kAEGetURL];
-
+
if (![[NSUserDefaults standardUserDefaults] boolForKey:@"NSQuitAlwaysKeepsWindows"]) {
NSData *cameraData = [[NSUserDefaults standardUserDefaults] objectForKey:MGLLastMapCameraDefaultsKey];
if (cameraData) {
@@ -130,7 +130,7 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask";
[alert runModal];
[self showPreferences:nil];
}
-
+
[self.offlinePacksArrayController bind:@"content" toObject:[MGLOfflineStorage sharedOfflineStorage] withKeyPath:@"packs" options:nil];
}
@@ -148,7 +148,7 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask";
[[NSUserDefaults standardUserDefaults] setInteger:mapView.debugMask forKey:MGLLastMapDebugMaskDefaultsKey];
}
}
-
+
[self.offlinePacksArrayController unbind:@"content"];
}
@@ -164,16 +164,16 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask";
params[parts[0]] = [parts[1] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
}
}
-
+
MGLMapCamera *camera = [MGLMapCamera camera];
NSString *zoomLevelString = params[@"zoom"];
self.pendingZoomLevel = zoomLevelString.length ? zoomLevelString.doubleValue : -1;
-
+
NSString *directionString = params[@"bearing"];
if (directionString.length) {
camera.heading = directionString.doubleValue;
}
-
+
NSString *centerString = params[@"center"];
if (centerString) {
NSArray *coordinateValues = [centerString componentsSeparatedByString:@","];
@@ -182,12 +182,12 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask";
[coordinateValues[1] doubleValue]);
}
}
-
+
NSString *pitchString = params[@"pitch"];
if (pitchString.length) {
camera.pitch = pitchString.doubleValue;
}
-
+
self.pendingCamera = camera;
[[NSDocumentController sharedDocumentController] openUntitledDocumentAndDisplay:YES error:NULL];
}
@@ -196,7 +196,7 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask";
- (IBAction)showOfflinePacksPanel:(id)sender {
[self.offlinePacksPanel makeKeyAndOrderFront:sender];
-
+
for (MGLOfflinePack *pack in self.offlinePacksArrayController.arrangedObjects) {
[pack requestProgress];
}
@@ -226,15 +226,15 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask";
}
break;
}
-
+
case MGLOfflinePackStateInactive:
[pack resume];
break;
-
+
case MGLOfflinePackStateActive:
[pack suspend];
break;
-
+
default:
break;
}
@@ -261,6 +261,14 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask";
[self.preferencesWindow makeKeyAndOrderFront:sender];
}
+- (IBAction)print:(id)sender {
+ NSDocument *currentDocument = [NSDocumentController sharedDocumentController].currentDocument;
+ if ([currentDocument isKindOfClass:[MapDocument class]]) {
+ MGLMapView *mapView = [(MapDocument *)currentDocument mapView];
+ [mapView print:sender];
+ }
+}
+
- (IBAction)openAccessTokenManager:(id)sender {
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"https://www.mapbox.com/studio/account/tokens/"]];
}
@@ -277,10 +285,22 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask";
if (menuItem.action == @selector(showOfflinePacksPanel:)) {
return YES;
}
+ if (menuItem.action == @selector(print:)) {
+ return YES;
+ }
if (menuItem.action == @selector(delete:)) {
return self.offlinePacksArrayController.selectedObjects.count;
}
return NO;
}
+#pragma mark NSWindowDelegate methods
+
+- (void)windowWillClose:(NSNotification *)notification {
+ NSWindow *window = notification.object;
+ if (window == self.preferencesWindow) {
+ [window makeFirstResponder:nil];
+ }
+}
+
@end
diff --git a/platform/macos/app/Base.lproj/Localizable.strings b/platform/macos/app/Base.lproj/Localizable.strings
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/platform/macos/app/Base.lproj/Localizable.strings
diff --git a/platform/macos/app/Base.lproj/MainMenu.xib b/platform/macos/app/Base.lproj/MainMenu.xib
index bc2ef06ef6..4f524df4d4 100644
--- a/platform/macos/app/Base.lproj/MainMenu.xib
+++ b/platform/macos/app/Base.lproj/MainMenu.xib
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11191" systemVersion="15G31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11762" systemVersion="15G1217" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11191"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11762"/>
+ <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
@@ -135,7 +136,7 @@
</menuItem>
<menuItem title="Print…" keyEquivalent="p" id="aTl-1u-JFS">
<connections>
- <action selector="print:" target="-1" id="qaZ-4w-aoO"/>
+ <action selector="print:" target="Voe-Tx-rLC" id="rXg-Pd-AG8"/>
</connections>
</menuItem>
</items>
@@ -709,6 +710,7 @@ CA
</constraints>
</view>
<connections>
+ <outlet property="delegate" destination="Voe-Tx-rLC" id="PNO-Pp-jOX"/>
<outlet property="initialFirstResponder" destination="7sb-sf-oJU" id="UZe-di-dnA"/>
</connections>
<point key="canvasLocation" x="754" y="221"/>
diff --git a/platform/macos/app/Base.lproj/MapDocument.xib b/platform/macos/app/Base.lproj/MapDocument.xib
index 4ba8f0a3ad..b658b52cc2 100644
--- a/platform/macos/app/Base.lproj/MapDocument.xib
+++ b/platform/macos/app/Base.lproj/MapDocument.xib
@@ -1,7 +1,8 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11201" systemVersion="15G1004" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11201"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11762"/>
+ <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="MapDocument">
@@ -47,7 +48,7 @@
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" fullSizeContentView="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="388" y="211" width="642" height="480"/>
- <rect key="screenRect" x="0.0" y="0.0" width="1280" height="777"/>
+ <rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<view key="contentView" id="TuG-C5-zLS">
<rect key="frame" x="0.0" y="0.0" width="642" height="480"/>
<autoresizingMask key="autoresizingMask"/>
@@ -123,7 +124,7 @@
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="185" id="VQs-2Z-hmP"/>
</constraints>
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="NDx-rn-TLj">
- <rect key="frame" x="0.0" y="464" width="184.5" height="16"/>
+ <rect key="frame" x="0.0" y="464" width="163" height="16"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="NO" id="0vt-rI-sHB">
diff --git a/platform/macos/app/DroppedPinAnnotation.m b/platform/macos/app/DroppedPinAnnotation.m
index 5b19fd7401..d7bd4068dc 100644
--- a/platform/macos/app/DroppedPinAnnotation.m
+++ b/platform/macos/app/DroppedPinAnnotation.m
@@ -11,7 +11,7 @@ static MGLCoordinateFormatter *DroppedPinCoordinateFormatter;
NSTimer *_timer;
NSTimeInterval _priorShownTimeInterval;
NSDate *_dateShown;
-
+
NSValueTransformer *_timeIntervalTransformer;
}
diff --git a/platform/macos/app/Info.plist b/platform/macos/app/Info.plist
index cc7037f589..21b86bfc75 100644
--- a/platform/macos/app/Info.plist
+++ b/platform/macos/app/Info.plist
@@ -52,5 +52,7 @@
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
+ <key>NSSupportsAutomaticGraphicsSwitching</key>
+ <true/>
</dict>
</plist>
diff --git a/platform/macos/app/LimeGreenStyleLayer.m b/platform/macos/app/LimeGreenStyleLayer.m
index 0d2e642db9..40c336cd98 100644
--- a/platform/macos/app/LimeGreenStyleLayer.m
+++ b/platform/macos/app/LimeGreenStyleLayer.m
@@ -14,11 +14,11 @@
- (void)didMoveToMapView:(MGLMapView *)mapView {
static const GLchar *vertexShaderSource = "attribute vec2 a_pos; void main() { gl_Position = vec4(a_pos, 0, 1); }";
static const GLchar *fragmentShaderSource = "void main() { gl_FragColor = vec4(0, 1, 0, 1); }";
-
+
_program = glCreateProgram();
_vertexShader = glCreateShader(GL_VERTEX_SHADER);
_fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
-
+
glShaderSource(_vertexShader, 1, &vertexShaderSource, NULL);
glCompileShader(_vertexShader);
glAttachShader(_program, _vertexShader);
@@ -27,7 +27,7 @@
glAttachShader(_program, _fragmentShader);
glLinkProgram(_program);
_aPos = glGetAttribLocation(_program, "a_pos");
-
+
GLfloat background[] = { -1,-1, 1,-1, -1,1, 1,1 };
glGenBuffers(1, &_buffer);
glBindBuffer(GL_ARRAY_BUFFER, _buffer);
@@ -48,7 +48,7 @@
if (!_program) {
return;
}
-
+
glDeleteBuffers(1, &_buffer);
glDetachShader(_program, _vertexShader);
glDetachShader(_program, _fragmentShader);
diff --git a/platform/macos/app/MGLVectorSource+MBXAdditions.m b/platform/macos/app/MGLVectorSource+MBXAdditions.m
index f59b72aa9f..644b43a651 100644
--- a/platform/macos/app/MGLVectorSource+MBXAdditions.m
+++ b/platform/macos/app/MGLVectorSource+MBXAdditions.m
@@ -35,7 +35,7 @@
if (!self.mapboxStreets) {
return @{};
}
-
+
// Replace {name} and {name_*} with the matching localized name tag.
NSString *localizedKey = preferredLanguage ? [NSString stringWithFormat:@"name_%@", preferredLanguage] : @"name";
NSMutableDictionary *localizedKeysByKey = [NSMutableDictionary dictionaryWithObject:localizedKey forKey:@"name"];
diff --git a/platform/macos/app/MapDocument.m b/platform/macos/app/MapDocument.m
index dd1e4c2162..5913e7300d 100644
--- a/platform/macos/app/MapDocument.m
+++ b/platform/macos/app/MapDocument.m
@@ -22,10 +22,13 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
NSMutableArray *flattenedShapes = [NSMutableArray arrayWithCapacity:shapes.count];
for (id <MGLAnnotation> shape in shapes) {
NSArray *subshapes;
- // Flatten multipoints but not polylines or polygons.
- if ([shape isMemberOfClass:[MGLMultiPoint class]]) {
- NSUInteger pointCount = [(MGLMultiPoint *)shape pointCount];
- CLLocationCoordinate2D *coordinates = [(MGLMultiPoint *)shape coordinates];
+ if ([shape isKindOfClass:[MGLMultiPolyline class]]) {
+ subshapes = [(MGLMultiPolyline *)shape polylines];
+ } else if ([shape isKindOfClass:[MGLMultiPolygon class]]) {
+ subshapes = [(MGLMultiPolygon *)shape polygons];
+ } else if ([shape isKindOfClass:[MGLPointCollection class]]) {
+ NSUInteger pointCount = [(MGLPointCollection *)shape pointCount];
+ CLLocationCoordinate2D *coordinates = [(MGLPointCollection *)shape coordinates];
NSMutableArray *pointAnnotations = [NSMutableArray arrayWithCapacity:pointCount];
for (NSUInteger i = 0; i < pointCount; i++) {
MGLPointAnnotation *pointAnnotation = [[MGLPointAnnotation alloc] init];
@@ -33,14 +36,10 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
[pointAnnotations addObject:pointAnnotation];
}
subshapes = pointAnnotations;
- } else if ([shape isKindOfClass:[MGLMultiPolyline class]]) {
- subshapes = [(MGLMultiPolyline *)shape polylines];
- } else if ([shape isKindOfClass:[MGLMultiPolygon class]]) {
- subshapes = [(MGLMultiPolygon *)shape polygons];
} else if ([shape isKindOfClass:[MGLShapeCollection class]]) {
subshapes = MBXFlattenedShapes([(MGLShapeCollection *)shape shapes]);
}
-
+
if (subshapes) {
[flattenedShapes addObjectsFromArray:subshapes];
} else {
@@ -63,11 +62,11 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
/// Style URL inherited from an existing document at the time this document
/// was created.
NSURL *_inheritedStyleURL;
-
+
NSPoint _mouseLocationForMapViewContextMenu;
NSUInteger _droppedPinCounter;
NSNumberFormatter *_spellOutNumberFormatter;
-
+
BOOL _isLocalizingLabels;
BOOL _showsToolTipsOnDroppedPins;
BOOL _randomizesCursorsOnDroppedPins;
@@ -95,19 +94,19 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
- (void)windowControllerDidLoadNib:(NSWindowController *)controller {
[super windowControllerDidLoadNib:controller];
-
+
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(userDefaultsDidChange:)
name:NSUserDefaultsDidChangeNotification
object:nil];
-
+
_spellOutNumberFormatter = [[NSNumberFormatter alloc] init];
-
+
NSPressGestureRecognizer *pressGestureRecognizer = [[NSPressGestureRecognizer alloc] initWithTarget:self action:@selector(handlePressGesture:)];
[self.mapView addGestureRecognizer:pressGestureRecognizer];
-
+
[self.splitView setPosition:0 ofDividerAtIndex:0];
-
+
[self applyPendingState];
}
@@ -217,11 +216,11 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
}
- (IBAction)zoomIn:(id)sender {
- [self.mapView setZoomLevel:self.mapView.zoomLevel + 1 animated:YES];
+ [self.mapView setZoomLevel:round(self.mapView.zoomLevel) + 1 animated:YES];
}
- (IBAction)zoomOut:(id)sender {
- [self.mapView setZoomLevel:self.mapView.zoomLevel - 1 animated:YES];
+ [self.mapView setZoomLevel:round(self.mapView.zoomLevel) - 1 animated:YES];
}
- (IBAction)snapToNorth:(id)sender {
@@ -263,7 +262,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
[self.undoManager registerUndoWithTarget:self handler:^(MapDocument * _Nonnull target) {
[target toggleStyleLayersAtArrangedObjectIndexes:indices];
}];
-
+
if (!self.undoManager.undoing) {
NSString *actionName;
if (indices.count == 1) {
@@ -276,11 +275,11 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
[self.undoManager setActionIsDiscardable:YES];
[self.undoManager setActionName:actionName];
}
-
+
for (MGLStyleLayer *layer in layers) {
layer.visible = !isVisible;
}
-
+
NSIndexSet *columnIndices = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 2)];
[self.styleLayersTableView reloadDataForRowIndexes:indices columnIndexes:columnIndices];
}
@@ -298,7 +297,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
[self.undoManager registerUndoWithTarget:self handler:^(id _Nonnull target) {
[self deleteStyleLayersAtArrangedObjectIndexes:indices];
}];
-
+
if (!self.undoManager.undoing) {
NSString *actionName;
if (indices.count == 1) {
@@ -309,7 +308,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
}
[self.undoManager setActionName:actionName];
}
-
+
[self.styleLayersArrayController insertObjects:layers atArrangedObjectIndexes:indices];
}
@@ -318,7 +317,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
[self.undoManager registerUndoWithTarget:self handler:^(id _Nonnull target) {
[self insertStyleLayers:layers atArrangedObjectIndexes:indices];
}];
-
+
if (!self.undoManager.undoing) {
NSString *actionName;
if (indices.count == 1) {
@@ -329,7 +328,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
}
[self.undoManager setActionName:actionName];
}
-
+
[self.styleLayersArrayController removeObjectsAtArrangedObjectIndexes:indices];
}
@@ -346,17 +345,17 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
if (![layer isKindOfClass:[MGLSymbolStyleLayer class]]) {
continue;
}
-
+
MGLVectorSource *source = (MGLVectorSource *)[style sourceWithIdentifier:layer.sourceIdentifier];
if (![source isKindOfClass:[MGLVectorSource class]] || !source.mapboxStreets) {
continue;
}
-
+
NSDictionary *localizedKeysByKey = localizedKeysByKeyBySourceIdentifier[layer.sourceIdentifier];
if (!localizedKeysByKey) {
localizedKeysByKey = localizedKeysByKeyBySourceIdentifier[layer.sourceIdentifier] = [source localizedKeysByKeyForPreferredLanguage:preferredLanguage];
}
-
+
NSString *(^stringByLocalizingString)(NSString *) = ^ NSString * (NSString *string) {
NSMutableString *localizedString = string.mutableCopy;
[localizedKeysByKey enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, NSString * _Nonnull localizedKey, BOOL * _Nonnull stop) {
@@ -369,12 +368,13 @@ 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];
layer.text = [MGLStyleValue<NSString *> valueWithRawValue:stringByLocalizingString(textField)];
- } else if ([layer.text isKindOfClass:[MGLStyleFunction class]]) {
- MGLStyleFunction *function = (MGLStyleFunction<NSString *> *)layer.text;
+ }
+ 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) {
NSString *textField = stop.rawValue;
@@ -391,7 +391,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
self.mapView.styleURL = _inheritedStyleURL;
_inheritedStyleURL = nil;
}
-
+
AppDelegate *appDelegate = (AppDelegate *)NSApp.delegate;
if (appDelegate.pendingStyleURL) {
self.mapView.styleURL = appDelegate.pendingStyleURL;
@@ -420,7 +420,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
self.mapView.zoomLevel = MIN(appDelegate.pendingMaximumZoomLevel, self.mapView.zoomLevel);
appDelegate.pendingMaximumZoomLevel = -1;
}
-
+
// Temporarily set the display name to the default center coordinate instead
// of “Untitled” until the binding kicks in.
NSValue *coordinateValue = [NSValue valueWithMGLCoordinate:self.mapView.centerCoordinate];
@@ -475,7 +475,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
- (IBAction)dropManyPins:(id)sender {
[self removeAllAnnotations:sender];
-
+
NSRect bounds = self.mapView.bounds;
NSMutableArray *annotations = [NSMutableArray array];
for (CGFloat x = NSMinX(bounds); x < NSMaxX(bounds); x += arc4random_uniform(50)) {
@@ -483,7 +483,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
[annotations addObject:[self pinAtPoint:NSMakePoint(x, y)]];
}
}
-
+
[NSTimer scheduledTimerWithTimeInterval:1.0/60.0
target:self
selector:@selector(dropOneOfManyPins:)
@@ -518,7 +518,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
- (IBAction)startWorldTour:(id)sender {
_isTouringWorld = YES;
-
+
[self removeAllAnnotations:sender];
NSUInteger numberOfAnnotations = sizeof(WorldTourDestinations) / sizeof(WorldTourDestinations[0]);
NSMutableArray *annotations = [NSMutableArray arrayWithCapacity:numberOfAnnotations];
@@ -537,7 +537,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
_isTouringWorld = NO;
return;
}
-
+
[annotations removeObjectAtIndex:0];
MGLMapCamera *camera = [MGLMapCamera cameraLookingAtCenterCoordinate:nextAnnotation.coordinate
fromDistance:0
@@ -612,11 +612,11 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
[self.undoManager registerUndoWithTarget:self handler:^(id _Nonnull target) {
[self removeCustomStyleLayer:sender];
}];
-
+
if (!self.undoManager.isUndoing) {
[self.undoManager setActionName:@"Add Lime Green Layer"];
}
-
+
LimeGreenStyleLayer *layer = [[LimeGreenStyleLayer alloc] initWithIdentifier:@"mbx-custom"];
MGLStyleLayer *houseNumberLayer = [self.mapView.style layerWithIdentifier:@"housenum-label"];
if (houseNumberLayer) {
@@ -630,11 +630,11 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
[self.undoManager registerUndoWithTarget:self handler:^(id _Nonnull target) {
[self insertCustomStyleLayer:sender];
}];
-
+
if (!self.undoManager.isUndoing) {
[self.undoManager setActionName:@"Delete Lime Green Layer"];
}
-
+
MGLStyleLayer *layer = [self.mapView.style layerWithIdentifier:@"mbx-custom"];
[self.mapView.style removeLayer:layer];
}
@@ -698,7 +698,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
if ([namePrompt runModal] != NSAlertFirstButtonReturn) {
return;
}
-
+
id <MGLOfflineRegion> region = [[MGLTilePyramidOfflineRegion alloc] initWithStyleURL:self.mapView.styleURL bounds:self.mapView.visibleCoordinateBounds fromZoomLevel:self.mapView.zoomLevel toZoomLevel:self.mapView.maximumZoomLevel];
NSData *context = [[NSValueTransformer valueTransformerForName:@"OfflinePackNameValueTransformer"] reverseTransformedValue:nameTextField.stringValue];
[[MGLOfflineStorage sharedOfflineStorage] addPackForRegion:region withContext:context completionHandler:^(MGLOfflinePack * _Nullable pack, NSError * _Nullable error) {
@@ -728,38 +728,38 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
self.mapView.style.transitionDelay = 1;
MGLFillStyleLayer *fillStyleLayer = (MGLFillStyleLayer *)[self.mapView.style layerWithIdentifier:@"water"];
-
- MGLStyleValue *colorFunction = [MGLStyleValue<NSColor *> valueWithStops:@{
+
+ MGLStyleValue *colorFunction = [MGLStyleValue<NSColor *> valueWithInterpolationMode:MGLInterpolationModeExponential cameraStops:@{
@0.0: [MGLStyleValue<NSColor *> valueWithRawValue:[NSColor redColor]],
@10.0: [MGLStyleValue<NSColor *> valueWithRawValue:[NSColor yellowColor]],
@20.0: [MGLStyleValue<NSColor *> valueWithRawValue:[NSColor blackColor]],
- }];
+ } options:nil];
fillStyleLayer.fillColor = colorFunction;
-
+
NSString *filePath = [[NSBundle bundleForClass:self.class] pathForResource:@"amsterdam" ofType:@"geojson"];
NSURL *geoJSONURL = [NSURL fileURLWithPath:filePath];
MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"ams" URL:geoJSONURL options:nil];
[self.mapView.style addSource:source];
-
+
MGLFillStyleLayer *fillLayer = [[MGLFillStyleLayer alloc] initWithIdentifier:@"test" source:source];
fillLayer.fillColor = [MGLStyleValue<NSColor *> valueWithRawValue:[NSColor greenColor]];
fillLayer.predicate = [NSPredicate predicateWithFormat:@"%K == %@", @"type", @"park"];
[self.mapView.style addLayer:fillLayer];
-
+
NSImage *image = [NSImage imageNamed:NSImageNameIChatTheaterTemplate];
[self.mapView.style setImage:image forName:NSImageNameIChatTheaterTemplate];
-
+
MGLSource *streetsSource = [self.mapView.style sourceWithIdentifier:@"composite"];
MGLSymbolStyleLayer *theaterLayer = [[MGLSymbolStyleLayer alloc] initWithIdentifier:@"theaters" source:streetsSource];
theaterLayer.sourceLayerIdentifier = @"poi_label";
theaterLayer.predicate = [NSPredicate predicateWithFormat:@"maki == 'theatre'"];
theaterLayer.iconImageName = [MGLStyleValue valueWithRawValue:NSImageNameIChatTheaterTemplate];
theaterLayer.iconScale = [MGLStyleValue valueWithRawValue:@2];
- theaterLayer.iconColor = [MGLStyleValue valueWithStops:@{
+ theaterLayer.iconColor = [MGLStyleValue valueWithInterpolationMode:MGLInterpolationModeExponential cameraStops:@{
@16.0: [MGLStyleValue valueWithRawValue:[NSColor redColor]],
@18.0: [MGLStyleValue valueWithRawValue:[NSColor yellowColor]],
@20.0: [MGLStyleValue valueWithRawValue:[NSColor blackColor]],
- }];
+ } options:nil];
[self.mapView.style addLayer:theaterLayer];
}
@@ -781,7 +781,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
title = [feature attributeForKey:@"name_en"] ?: [feature attributeForKey:@"name"];
}
}
-
+
DroppedPinAnnotation *annotation = [[DroppedPinAnnotation alloc] init];
annotation.coordinate = [self.mapView convertPoint:point toCoordinateFromView:self.mapView];
annotation.title = title ?: @"Dropped Pin";
@@ -993,7 +993,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
if (![MGLAccountManager accessToken]) {
return NSNotFound;
}
-
+
NSArray *styleURLs = @[
[MGLStyle streetsStyleURLWithVersion:MGLStyleDefaultVersion],
[MGLStyle outdoorsStyleURLWithVersion:MGLStyleDefaultVersion],
@@ -1009,7 +1009,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
if (!self.mapView) {
return NO;
}
-
+
SEL action = toolbarItem.action;
if (action == @selector(showShareMenu:)) {
[(NSButton *)toolbarItem.view sendActionOn:NSLeftMouseDownMask];
@@ -1047,14 +1047,14 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
NSImage *browserIcon = [[NSWorkspace sharedWorkspace] iconForFile:browserURL.path];
NSString *browserName = [[NSFileManager defaultManager] displayNameAtPath:browserURL.path];
NSString *browserServiceName = [NSString stringWithFormat:@"Open in %@", browserName];
-
+
NSSharingService *browserService = [[NSSharingService alloc] initWithTitle:browserServiceName
image:browserIcon
alternateImage:nil
handler:^{
[[NSWorkspace sharedWorkspace] openURL:self.shareURL];
}];
-
+
NSMutableArray *sharingServices = [proposedServices mutableCopy];
[sharingServices insertObject:browserService atIndex:0];
return sharingServices;
@@ -1123,14 +1123,14 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio
- (void)mapView:(MGLMapView *)mapView didSelectAnnotation:(id <MGLAnnotation>)annotation {
if ([annotation isKindOfClass:[DroppedPinAnnotation class]]) {
- DroppedPinAnnotation *droppedPin = annotation;
+ DroppedPinAnnotation *droppedPin = (DroppedPinAnnotation *)annotation;
[droppedPin resume];
}
}
- (void)mapView:(MGLMapView *)mapView didDeselectAnnotation:(id <MGLAnnotation>)annotation {
if ([annotation isKindOfClass:[DroppedPinAnnotation class]]) {
- DroppedPinAnnotation *droppedPin = annotation;
+ DroppedPinAnnotation *droppedPin = (DroppedPinAnnotation *)annotation;
[droppedPin pause];
}
}
diff --git a/platform/macos/app/OfflinePackNameValueTransformer.m b/platform/macos/app/OfflinePackNameValueTransformer.m
index 2825e48ed3..d1b3c20ac1 100644
--- a/platform/macos/app/OfflinePackNameValueTransformer.m
+++ b/platform/macos/app/OfflinePackNameValueTransformer.m
@@ -14,7 +14,7 @@ static NSString * const MBXOfflinePackContextNameKey = @"Name";
- (NSString *)transformedValue:(NSData *)context {
NSAssert([context isKindOfClass:[NSData class]], @"Context should be NSData.");
-
+
NSDictionary *userInfo = [NSKeyedUnarchiver unarchiveObjectWithData:context];
NSAssert([userInfo isKindOfClass:[NSDictionary class]], @"Context of offline pack isn’t a dictionary.");
NSString *name = userInfo[MBXOfflinePackContextNameKey];
@@ -24,7 +24,7 @@ static NSString * const MBXOfflinePackContextNameKey = @"Name";
- (NSData *)reverseTransformedValue:(NSString *)name {
NSAssert([name isKindOfClass:[NSString class]], @"Name should be a string.");
-
+
return [NSKeyedArchiver archivedDataWithRootObject:@{
MBXOfflinePackContextNameKey: name,
}];
diff --git a/platform/macos/app/StyleLayerIconTransformer.m b/platform/macos/app/StyleLayerIconTransformer.m
index 93f59abb3e..ff2b964b87 100644
--- a/platform/macos/app/StyleLayerIconTransformer.m
+++ b/platform/macos/app/StyleLayerIconTransformer.m
@@ -31,7 +31,7 @@
if ([layer isKindOfClass:[MGLSymbolStyleLayer class]]) {
return [NSImage imageNamed:@"symbol"];
}
-
+
return nil;
}
diff --git a/platform/macos/app/TimeIntervalTransformer.m b/platform/macos/app/TimeIntervalTransformer.m
index 39177dc5bc..2c9cb6fc74 100644
--- a/platform/macos/app/TimeIntervalTransformer.m
+++ b/platform/macos/app/TimeIntervalTransformer.m
@@ -18,7 +18,7 @@ NSString *NumberAndUnitString(NSInteger quantity, NSString *singular, NSString *
if (![value isKindOfClass:[NSValue class]]) {
return nil;
}
-
+
NSTimeInterval timeInterval = [value doubleValue];
NSInteger seconds = floor(timeInterval);
NSInteger minutes = floor(seconds / 60);
@@ -29,7 +29,7 @@ NSString *NumberAndUnitString(NSInteger quantity, NSString *singular, NSString *
hours -= days * 24;
NSInteger weeks = floor(days) / 7;
days -= weeks * 7;
-
+
NSMutableArray *components = [NSMutableArray array];
if (seconds || timeInterval < 60) {
[components addObject:NumberAndUnitString(seconds, @"second", @"seconds")];
@@ -46,7 +46,7 @@ NSString *NumberAndUnitString(NSInteger quantity, NSString *singular, NSString *
if (weeks) {
[components insertObject:NumberAndUnitString(weeks, @"week", @"weeks") atIndex:0];
}
-
+
return [components componentsJoinedByString:@", "];
}
diff --git a/platform/macos/app/de.lproj/Localizable.strings b/platform/macos/app/de.lproj/Localizable.strings
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/platform/macos/app/de.lproj/Localizable.strings
diff --git a/platform/macos/app/es.lproj/Localizable.strings b/platform/macos/app/es.lproj/Localizable.strings
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/platform/macos/app/es.lproj/Localizable.strings
diff --git a/platform/macos/app/fr.lproj/Localizable.strings b/platform/macos/app/fr.lproj/Localizable.strings
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/platform/macos/app/fr.lproj/Localizable.strings
diff --git a/platform/macos/app/ja.lproj/Localizable.strings b/platform/macos/app/ja.lproj/Localizable.strings
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/platform/macos/app/ja.lproj/Localizable.strings
diff --git a/platform/macos/app/lt.lproj/Localizable.strings b/platform/macos/app/lt.lproj/Localizable.strings
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/platform/macos/app/lt.lproj/Localizable.strings
diff --git a/platform/macos/app/pl.lproj/Localizable.strings b/platform/macos/app/pl.lproj/Localizable.strings
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/platform/macos/app/pl.lproj/Localizable.strings
diff --git a/platform/macos/app/pt-BR.lproj/Localizable.strings b/platform/macos/app/pt-BR.lproj/Localizable.strings
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/platform/macos/app/pt-BR.lproj/Localizable.strings
diff --git a/platform/macos/app/sv.lproj/Localizable.strings b/platform/macos/app/sv.lproj/Localizable.strings
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/platform/macos/app/sv.lproj/Localizable.strings
diff --git a/platform/macos/app/uk.lproj/Localizable.strings b/platform/macos/app/uk.lproj/Localizable.strings
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/platform/macos/app/uk.lproj/Localizable.strings
diff --git a/platform/macos/app/vi.lproj/Localizable.strings b/platform/macos/app/vi.lproj/Localizable.strings
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/platform/macos/app/vi.lproj/Localizable.strings
diff --git a/platform/macos/app/zh-Hans.lproj/Localizable.strings b/platform/macos/app/zh-Hans.lproj/Localizable.strings
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/platform/macos/app/zh-Hans.lproj/Localizable.strings
diff --git a/platform/macos/app/zh-Hant.lproj/Localizable.strings b/platform/macos/app/zh-Hant.lproj/Localizable.strings
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/platform/macos/app/zh-Hant.lproj/Localizable.strings
diff --git a/platform/macos/config.cmake b/platform/macos/config.cmake
index d7a9c894b8..309d8e82f3 100644
--- a/platform/macos/config.cmake
+++ b/platform/macos/config.cmake
@@ -1,9 +1,9 @@
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.10)
-mason_use(glfw VERSION 3.2.1)
+mason_use(glfw VERSION 2017-02-09-77a8f10)
mason_use(boost_libprogram_options VERSION 1.62.0)
-mason_use(gtest VERSION 1.7.0${MASON_CXXABI_SUFFIX})
-mason_use(benchmark VERSION 1.0.0)
+mason_use(gtest VERSION 1.8.0)
+mason_use(benchmark VERSION 1.0.0-1)
mason_use(icu VERSION 58.1)
include(cmake/loop-darwin.cmake)
@@ -40,7 +40,9 @@ macro(mbgl_platform_core)
PRIVATE platform/default/utf.cpp
# Image handling
+ PRIVATE platform/darwin/mbgl/util/image+MGLAdditions.hpp
PRIVATE platform/darwin/src/image.mm
+ PRIVATE platform/default/png_writer.cpp
# Headless view
PRIVATE platform/default/mbgl/gl/headless_backend.cpp
@@ -52,6 +54,8 @@ macro(mbgl_platform_core)
PRIVATE platform/default/mbgl/gl/offscreen_view.hpp
# Thread pool
+ PRIVATE platform/default/mbgl/util/shared_thread_pool.cpp
+ PRIVATE platform/default/mbgl/util/shared_thread_pool.hpp
PRIVATE platform/default/mbgl/util/default_thread_pool.cpp
PRIVATE platform/default/mbgl/util/default_thread_pool.cpp
)
diff --git a/platform/macos/docs/guides/For Style Authors.md b/platform/macos/docs/guides/For Style Authors.md
index cf25ae09c4..78a3063b06 100644
--- a/platform/macos/docs/guides/For Style Authors.md
+++ b/platform/macos/docs/guides/For Style Authors.md
@@ -26,6 +26,8 @@ style is present. Standard user interface elements such as toolbars, sidebars,
and sheets often overlap the map view with a translucent, blurred background, so
make sure the contents of these elements remain legible with the map view
underneath.
+If you intend your style to be used in the dark, consider the impact that Night
+Shift may have on your style’s colors.
### Typography and graphics
@@ -115,7 +117,7 @@ In style JSON | In the SDK
`raster` | `MGLRasterSource`
`vector` | `MGLVectorSource`
-`image` and `video` sources are not supported.
+`canvas`, `image`, and `video` sources are not supported.
### Tile sources
@@ -263,9 +265,10 @@ Array (`-offset`, `-translate`) | `NSValue` containing `CGVector` | `NSValue` co
Array (`-padding`) | `NSValue.edgeInsetsValue` | `NSValue.edgeInsetsValue`
For padding attributes, note that the arguments to
-`NSEdgeInsetsMake()` in Objective-C and
-`EdgeInsets(top:left:bottom:right:)` in Swift are specified in counterclockwise
-order, in contrast to the clockwise order defined by the style specification.
+`NSEdgeInsetsMake()` in Objective-C and `EdgeInsets(top:left:bottom:right:)` in
+Swift
+are specified in counterclockwise order, in contrast to the clockwise order
+defined by the style specification.
Additionally, on macOS, a screen coordinate of (0, 0) is located at the
lower-left corner of the screen. Therefore, a positive `CGVector.dy` means an
diff --git a/platform/macos/docs/pod-README.md b/platform/macos/docs/pod-README.md
index 6d45a68c34..33386340c6 100644
--- a/platform/macos/docs/pod-README.md
+++ b/platform/macos/docs/pod-README.md
@@ -2,7 +2,7 @@
Put interactive, scalable world maps into your native Cocoa application with the open-source Mapbox macOS SDK.
-* Mapbox-curated [map styles](https://www.mapbox.com/maps/) and [vector tiles](https://www.mapbox.com/vector-tiles/) make it easy to get started.
+* Mapbox-curated [map styles](https://www.mapbox.com/maps/) and [OpenStreetMap-based](https://www.mapbox.com/vector-tiles/mapbox-streets-v7/) [vector tiles](https://www.mapbox.com/vector-tiles/) make it easy to get started.
* Customize every aspect of the map’s appearance in code or visually using [Mapbox Studio](https://www.mapbox.com/mapbox-studio/).
* High-performance OpenGL rendering and multitouch gestures keep your users happy.
* A well-designed, fully documented API helps you stay productive.
@@ -12,10 +12,10 @@ Put interactive, scalable world maps into your native Cocoa application with the
The Mapbox macOS SDK is compatible with macOS 10.10.0 and above for Cocoa applications developed in Objective-C, Swift, Interface Builder, or AppleScript. For hybrid applications, consider [Mapbox GL JS](https://www.mapbox.com/mapbox-gl-js/).
-Mapbox macOS SDK releases are [available on GitHub](https://github.com/mapbox/mapbox-gl-native/releases/) – look for the releases that begin with “macos-”. You can also integrate the Mapbox macOS SDK into your application using CocoaPods.
-
## 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.)
+
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/).
diff --git a/platform/macos/jazzy.yml b/platform/macos/jazzy.yml
index 8aa93a41f7..65a3451043 100644
--- a/platform/macos/jazzy.yml
+++ b/platform/macos/jazzy.yml
@@ -105,3 +105,4 @@ custom_categories:
- MGLClockDirectionFormatter
- MGLCompassDirectionFormatter
- MGLCoordinateFormatter
+ - MGLDistanceFormatter
diff --git a/platform/macos/macos.xcodeproj/project.pbxproj b/platform/macos/macos.xcodeproj/project.pbxproj
index 6b8a038a68..4315698741 100644
--- a/platform/macos/macos.xcodeproj/project.pbxproj
+++ b/platform/macos/macos.xcodeproj/project.pbxproj
@@ -7,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
+ 1753ED401E53CE6100A9FD90 /* MGLConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = 1753ED3F1E53CE5200A9FD90 /* MGLConversion.h */; };
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 */; };
@@ -42,6 +43,9 @@
35C5D8481D6DD66D00E95907 /* NSComparisonPredicate+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35C5D8441D6DD66D00E95907 /* NSComparisonPredicate+MGLAdditions.mm */; };
35C5D8491D6DD66D00E95907 /* NSCompoundPredicate+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 35C5D8451D6DD66D00E95907 /* NSCompoundPredicate+MGLAdditions.h */; };
35C5D84A1D6DD66D00E95907 /* NSCompoundPredicate+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35C5D8461D6DD66D00E95907 /* NSCompoundPredicate+MGLAdditions.mm */; };
+ 35C6DF841E214C0400ACA483 /* MGLDistanceFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = 35C6DF821E214C0400ACA483 /* MGLDistanceFormatter.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 35C6DF851E214C0400ACA483 /* MGLDistanceFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 35C6DF831E214C0400ACA483 /* MGLDistanceFormatter.m */; };
+ 35C6DF871E214C1800ACA483 /* MGLDistanceFormatterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 35C6DF861E214C1800ACA483 /* MGLDistanceFormatterTests.m */; };
35D65C5A1D65AD5500722C23 /* NSDate+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 35D65C581D65AD5500722C23 /* NSDate+MGLAdditions.h */; };
35D65C5B1D65AD5500722C23 /* NSDate+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35D65C591D65AD5500722C23 /* NSDate+MGLAdditions.mm */; };
4049C2A51DB6CE7F00B3F799 /* MGLPointCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 4049C2A11DB6CE7800B3F799 /* MGLPointCollection.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -61,8 +65,12 @@
5548BE781D09E718005DDE81 /* libmbgl-core.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DAE6C3451CC31D1200DB3429 /* libmbgl-core.a */; };
556660C61E1BEA0100E2C41B /* MGLFoundation.h in Headers */ = {isa = PBXBuildFile; fileRef = 556660C51E1BEA0100E2C41B /* MGLFoundation.h */; settings = {ATTRIBUTES = (Public, ); }; };
556660D61E1D07E400E2C41B /* MGLVersionNumber.m in Sources */ = {isa = PBXBuildFile; fileRef = 556660D51E1D07E400E2C41B /* MGLVersionNumber.m */; };
+ 558DE7A61E56161C00C7916D /* MGLFoundation_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 558DE7A41E56161C00C7916D /* MGLFoundation_Private.h */; };
+ 558DE7A71E56161C00C7916D /* MGLFoundation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 558DE7A51E56161C00C7916D /* MGLFoundation.mm */; };
558F18221D0B13B100123F46 /* libmbgl-loop.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 558F18211D0B13B000123F46 /* libmbgl-loop.a */; };
55D9B4B11D005D3900C1CCE2 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 55D9B4B01D005D3900C1CCE2 /* libz.tbd */; };
+ 55E2AD111E5B0A6900E8C587 /* MGLOfflineStorageTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 55E2AD101E5B0A6900E8C587 /* MGLOfflineStorageTests.mm */; };
+ 96E027311E57C9A7004B8E66 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 96E027331E57C9A7004B8E66 /* Localizable.strings */; };
8877024C1E37977D0097E255 /* MGLComputedShapeSource.mm in Sources */ = {isa = PBXBuildFile; fileRef = 88B079B01E3794F300834FAB /* MGLComputedShapeSource.mm */; };
88B079AC1E37941300834FAB /* MGLAbstractShapeSource.mm in Sources */ = {isa = PBXBuildFile; fileRef = 88B079AA1E3793E000834FAB /* MGLAbstractShapeSource.mm */; };
88B079AD1E37942700834FAB /* MGLAbstractShapeSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 88B079A91E3793E000834FAB /* MGLAbstractShapeSource.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -213,7 +221,6 @@
DAE6C3D21CC34C9900DB3429 /* MGLGeometryTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = DAE6C3C81CC34BD800DB3429 /* MGLGeometryTests.mm */; };
DAE6C3D31CC34C9900DB3429 /* MGLOfflinePackTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DAE6C3C91CC34BD800DB3429 /* MGLOfflinePackTests.m */; };
DAE6C3D41CC34C9900DB3429 /* MGLOfflineRegionTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DAE6C3CA1CC34BD800DB3429 /* MGLOfflineRegionTests.m */; };
- DAE6C3D51CC34C9900DB3429 /* MGLOfflineStorageTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DAE6C3CB1CC34BD800DB3429 /* MGLOfflineStorageTests.m */; };
DAE6C3D61CC34C9900DB3429 /* MGLStyleTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = DAE6C3CC1CC34BD800DB3429 /* MGLStyleTests.mm */; };
DAE7DEC41E24549F007505A6 /* MGLNSStringAdditionsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DAE7DEC31E24549F007505A6 /* MGLNSStringAdditionsTests.m */; };
DAED385F1D62CED700D7640F /* NSURL+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = DAED385D1D62CED700D7640F /* NSURL+MGLAdditions.h */; };
@@ -260,6 +267,7 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
+ 1753ED3F1E53CE5200A9FD90 /* MGLConversion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLConversion.h; 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>"; };
@@ -296,6 +304,9 @@
35C5D8451D6DD66D00E95907 /* NSCompoundPredicate+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSCompoundPredicate+MGLAdditions.h"; sourceTree = "<group>"; };
35C5D8461D6DD66D00E95907 /* NSCompoundPredicate+MGLAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSCompoundPredicate+MGLAdditions.mm"; sourceTree = "<group>"; };
35C5D84B1D6DD75B00E95907 /* MGLPredicateTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLPredicateTests.mm; path = ../../darwin/test/MGLPredicateTests.mm; sourceTree = "<group>"; };
+ 35C6DF821E214C0400ACA483 /* MGLDistanceFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLDistanceFormatter.h; sourceTree = "<group>"; };
+ 35C6DF831E214C0400ACA483 /* MGLDistanceFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLDistanceFormatter.m; sourceTree = "<group>"; };
+ 35C6DF861E214C1800ACA483 /* MGLDistanceFormatterTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLDistanceFormatterTests.m; path = ../../darwin/test/MGLDistanceFormatterTests.m; sourceTree = "<group>"; };
35D65C581D65AD5500722C23 /* NSDate+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDate+MGLAdditions.h"; sourceTree = "<group>"; };
35D65C591D65AD5500722C23 /* NSDate+MGLAdditions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSDate+MGLAdditions.mm"; sourceTree = "<group>"; };
4049C2A11DB6CE7800B3F799 /* MGLPointCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLPointCollection.h; sourceTree = "<group>"; };
@@ -318,17 +329,35 @@
5548BE7B1D0ACBBD005DDE81 /* libmbgl-loop-darwin.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libmbgl-loop-darwin.a"; path = "cmake/Debug/libmbgl-loop-darwin.a"; sourceTree = "<group>"; };
556660C51E1BEA0100E2C41B /* MGLFoundation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGLFoundation.h; sourceTree = "<group>"; };
556660D51E1D07E400E2C41B /* MGLVersionNumber.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = MGLVersionNumber.m; path = ../../darwin/test/MGLVersionNumber.m; sourceTree = "<group>"; };
+ 558DE7A41E56161C00C7916D /* MGLFoundation_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLFoundation_Private.h; sourceTree = "<group>"; };
+ 558DE7A51E56161C00C7916D /* MGLFoundation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLFoundation.mm; sourceTree = "<group>"; };
558F18211D0B13B000123F46 /* libmbgl-loop.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libmbgl-loop.a"; path = "../../build/osx/Debug/libmbgl-loop.a"; sourceTree = "<group>"; };
55D9B4B01D005D3900C1CCE2 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
+ 55E2AD101E5B0A6900E8C587 /* MGLOfflineStorageTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLOfflineStorageTests.mm; path = ../../darwin/test/MGLOfflineStorageTests.mm; sourceTree = "<group>"; };
55FE0E8D1D100A0900FD240B /* config.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = config.xcconfig; path = ../../build/macos/config.xcconfig; sourceTree = "<group>"; };
+ 966091701E5BBFF700A9A03B /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = "<group>"; };
+ 966091711E5BBFF900A9A03B /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/Localizable.strings; sourceTree = "<group>"; };
+ 966091721E5BBFFA00A9A03B /* uk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = uk; path = uk.lproj/Localizable.strings; sourceTree = "<group>"; };
+ 966091731E5BBFFA00A9A03B /* lt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = lt; path = lt.lproj/Localizable.strings; sourceTree = "<group>"; };
88B079A81E3793E000834FAB /* MGLAbstractShapeSource_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLAbstractShapeSource_Private.h; sourceTree = "<group>"; };
+ 96E027321E57C9A7004B8E66 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/Localizable.strings; sourceTree = "<group>"; };
+ 96E027341E57C9A9004B8E66 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = "<group>"; };
88B079A91E3793E000834FAB /* MGLAbstractShapeSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLAbstractShapeSource.h; sourceTree = "<group>"; };
+ 96E027351E57C9AB004B8E66 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Localizable.strings"; sourceTree = "<group>"; };
+ 96E027361E57C9AC004B8E66 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = "<group>"; };
88B079AA1E3793E000834FAB /* MGLAbstractShapeSource.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLAbstractShapeSource.mm; sourceTree = "<group>"; };
+ 96E027371E57C9B5004B8E66 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = "<group>"; };
+ 96E027381E57C9B7004B8E66 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Localizable.strings; sourceTree = "<group>"; };
88B079AF1E3794F300834FAB /* MGLComputedShapeSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLComputedShapeSource.h; sourceTree = "<group>"; };
+ 96E027391E57C9B9004B8E66 /* sv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sv; path = sv.lproj/Localizable.strings; sourceTree = "<group>"; };
+ 96E0273A1E57C9BB004B8E66 /* vi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = vi; path = vi.lproj/Localizable.strings; sourceTree = "<group>"; };
88B079B01E3794F300834FAB /* MGLComputedShapeSource.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLComputedShapeSource.mm; sourceTree = "<group>"; };
+ 96E0273B1E57C9BC004B8E66 /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-BR"; path = "pt-BR.lproj/Localizable.strings"; sourceTree = "<group>"; };
DA00FC881D5EEAC3009AABC8 /* MGLAttributionInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLAttributionInfo.h; sourceTree = "<group>"; };
DA00FC891D5EEAC3009AABC8 /* MGLAttributionInfo.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLAttributionInfo.mm; sourceTree = "<group>"; };
DA0CD58D1CF56F5800A5F5A5 /* MGLFeatureTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLFeatureTests.mm; path = ../../darwin/test/MGLFeatureTests.mm; sourceTree = "<group>"; };
+ DA1AC01E1E5B8826006DF1D6 /* lt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = lt; path = lt.lproj/Localizable.strings; sourceTree = "<group>"; };
+ DA1AC01F1E5B8904006DF1D6 /* uk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = uk; path = uk.lproj/Foundation.stringsdict; sourceTree = "<group>"; };
DA2207BA1DC076930002F84D /* test-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "test-Bridging-Header.h"; sourceTree = "<group>"; };
DA2207BB1DC076940002F84D /* MGLStyleValueTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MGLStyleValueTests.swift; sourceTree = "<group>"; };
DA2784FD1DF03060001D5B8D /* Media.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Media.xcassets; path = ../../darwin/test/Media.xcassets; sourceTree = "<group>"; };
@@ -349,10 +378,17 @@
DA551B801DB496AC0009AFAF /* MGLTileSource_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLTileSource_Private.h; sourceTree = "<group>"; };
DA551B811DB496AC0009AFAF /* MGLTileSource.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLTileSource.mm; sourceTree = "<group>"; };
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>"; };
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>"; };
DA7262061DEEDD460043BB89 /* MGLOpenGLStyleLayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLOpenGLStyleLayer.mm; sourceTree = "<group>"; };
+ DA737ADE1E5914AD00AD2CDE /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = es; path = es.lproj/Foundation.stringsdict; sourceTree = "<group>"; };
+ DA737ADF1E5914D300AD2CDE /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = "<group>"; };
+ DA737AE31E5915A500AD2CDE /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = pl; path = pl.lproj/Foundation.stringsdict; sourceTree = "<group>"; };
+ DA737AE41E5915B000AD2CDE /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/Localizable.strings; sourceTree = "<group>"; };
+ DA737AEC1E59180E00AD2CDE /* uk */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = uk; path = uk.lproj/Localizable.strings; sourceTree = "<group>"; };
DA7DC9801DED5F5C0027472F /* MGLVectorSource_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLVectorSource_Private.h; sourceTree = "<group>"; };
DA7DC9821DED647F0027472F /* MGLRasterSource_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLRasterSource_Private.h; sourceTree = "<group>"; };
DA839E921CC2E3400062CAFB /* Mapbox GL.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Mapbox GL.app"; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -398,7 +434,19 @@
DA8F25B51D51D2240010E6B5 /* MGLStyleLayerTests.mm.ejs */ = {isa = PBXFileReference; lastKnownFileType = text; name = MGLStyleLayerTests.mm.ejs; path = ../test/MGLStyleLayerTests.mm.ejs; sourceTree = "<group>"; };
DA8F25B61D51D2240010E6B5 /* MGLStyleLayer.h.ejs */ = {isa = PBXFileReference; lastKnownFileType = text; path = MGLStyleLayer.h.ejs; sourceTree = "<group>"; };
DA8F25B71D51D2240010E6B5 /* MGLStyleLayer.mm.ejs */ = {isa = PBXFileReference; lastKnownFileType = text; path = MGLStyleLayer.mm.ejs; sourceTree = "<group>"; };
+ DA9C01301E4C7B9300C4742A /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = "pt-BR"; path = "pt-BR.lproj/Foundation.stringsdict"; sourceTree = "<group>"; };
+ DA9C01311E4C7B9F00C4742A /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-BR"; path = "pt-BR.lproj/Localizable.strings"; sourceTree = "<group>"; };
DAA1BB491E2D425C00ABB750 /* libmbgl-loop.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libmbgl-loop.a"; path = "../../build/macos/Debug/libmbgl-loop.a"; sourceTree = "<group>"; };
+ DAA32CA61E4C4849006F8D24 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = "<group>"; };
+ DAA32CA71E4C486D006F8D24 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Foundation.strings; sourceTree = "<group>"; };
+ DAA32CA81E4C48B9006F8D24 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = de; path = de.lproj/Foundation.stringsdict; sourceTree = "<group>"; };
+ DAA32CAE1E4C4B03006F8D24 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = fr; path = fr.lproj/Foundation.stringsdict; sourceTree = "<group>"; };
+ DAA32CAF1E4C4B0D006F8D24 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = "<group>"; };
+ DAA32CB21E4C4CB7006F8D24 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Foundation.strings; sourceTree = "<group>"; };
+ DAA32CB31E4C4CC3006F8D24 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Localizable.strings; sourceTree = "<group>"; };
+ DAA32CBA1E4C4F10006F8D24 /* sv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sv; path = sv.lproj/Localizable.strings; sourceTree = "<group>"; };
+ DAA32CC01E4C4F89006F8D24 /* vi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = vi; path = vi.lproj/Foundation.strings; sourceTree = "<group>"; };
+ DAA32CC11E4C4F93006F8D24 /* vi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = vi; path = vi.lproj/Localizable.strings; sourceTree = "<group>"; };
DAA48EFB1D6A4731006A7E36 /* StyleLayerIconTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleLayerIconTransformer.h; sourceTree = "<group>"; };
DAA48EFC1D6A4731006A7E36 /* StyleLayerIconTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StyleLayerIconTransformer.m; sourceTree = "<group>"; };
DAB2CCE31DF632ED001B2FE1 /* LimeGreenStyleLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LimeGreenStyleLayer.h; sourceTree = "<group>"; };
@@ -489,7 +537,6 @@
DAE6C3C81CC34BD800DB3429 /* MGLGeometryTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLGeometryTests.mm; path = ../../darwin/test/MGLGeometryTests.mm; sourceTree = "<group>"; };
DAE6C3C91CC34BD800DB3429 /* MGLOfflinePackTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLOfflinePackTests.m; path = ../../darwin/test/MGLOfflinePackTests.m; sourceTree = "<group>"; };
DAE6C3CA1CC34BD800DB3429 /* MGLOfflineRegionTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLOfflineRegionTests.m; path = ../../darwin/test/MGLOfflineRegionTests.m; sourceTree = "<group>"; };
- DAE6C3CB1CC34BD800DB3429 /* MGLOfflineStorageTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLOfflineStorageTests.m; path = ../../darwin/test/MGLOfflineStorageTests.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>"; };
DAED385D1D62CED700D7640F /* NSURL+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSURL+MGLAdditions.h"; sourceTree = "<group>"; };
@@ -500,6 +547,8 @@
DAF0D8151DFE6B1800B28378 /* MGLAttributionInfo_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLAttributionInfo_Private.h; sourceTree = "<group>"; };
DAF0D81A1DFF567C00B28378 /* MGLVectorSource+MBXAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MGLVectorSource+MBXAdditions.h"; sourceTree = "<group>"; };
DAF0D81B1DFF567C00B28378 /* MGLVectorSource+MBXAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MGLVectorSource+MBXAdditions.m"; sourceTree = "<group>"; };
+ DAFBD0D51E3FA969000CD6BF /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Localizable.strings"; sourceTree = "<group>"; };
+ DAFBD0D61E3FA983000CD6BF /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Foundation.strings"; sourceTree = "<group>"; };
DD0902AF1DB1AC6400C5BDCE /* MGLNetworkConfiguration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLNetworkConfiguration.m; sourceTree = "<group>"; };
DD0902B01DB1AC6400C5BDCE /* MGLNetworkConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLNetworkConfiguration.h; sourceTree = "<group>"; };
DD58A4C71D822C6200E1F038 /* MGLExpressionTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLExpressionTests.mm; path = ../../darwin/test/MGLExpressionTests.mm; sourceTree = "<group>"; };
@@ -606,6 +655,7 @@
3527429B1D4C259500A1ECE6 /* Styling */ = {
isa = PBXGroup;
children = (
+ 1753ED3F1E53CE5200A9FD90 /* MGLConversion.h */,
352742791D4C235C00A1ECE6 /* Categories */,
35136D471D42295400C20EFD /* Layers */,
3527427E1D4C242B00A1ECE6 /* Sources */,
@@ -668,6 +718,7 @@
DA5589761D320C41006B7F64 /* wms.json */,
DAE6C2E11CC304F900DB3429 /* Credits.rtf */,
DA839EA61CC2E3400062CAFB /* Info.plist */,
+ 96E027331E57C9A7004B8E66 /* Localizable.strings */,
DA839E981CC2E3400062CAFB /* Supporting Files */,
);
name = "Demo App";
@@ -772,6 +823,8 @@
DA35A2AC1CCA091800E826B2 /* MGLCompassDirectionFormatter.m */,
DA35A2A31CC9EB1A00E826B2 /* MGLCoordinateFormatter.h */,
DA35A2A51CC9EB2700E826B2 /* MGLCoordinateFormatter.m */,
+ 35C6DF821E214C0400ACA483 /* MGLDistanceFormatter.h */,
+ 35C6DF831E214C0400ACA483 /* MGLDistanceFormatter.m */,
);
name = Formatters;
sourceTree = "<group>";
@@ -906,12 +959,13 @@
DA35A2A71CC9F41600E826B2 /* MGLCoordinateFormatterTests.m */,
DA2987591E1A4290002299F5 /* MGLDocumentationExampleTests.swift */,
DD58A4C71D822C6200E1F038 /* MGLExpressionTests.mm */,
+ 35C6DF861E214C1800ACA483 /* MGLDistanceFormatterTests.m */,
DA0CD58D1CF56F5800A5F5A5 /* MGLFeatureTests.mm */,
DAE6C3C81CC34BD800DB3429 /* MGLGeometryTests.mm */,
DAE7DEC31E24549F007505A6 /* MGLNSStringAdditionsTests.m */,
DAE6C3C91CC34BD800DB3429 /* MGLOfflinePackTests.m */,
DAE6C3CA1CC34BD800DB3429 /* MGLOfflineRegionTests.m */,
- DAE6C3CB1CC34BD800DB3429 /* MGLOfflineStorageTests.m */,
+ 55E2AD101E5B0A6900E8C587 /* MGLOfflineStorageTests.mm */,
35C5D84B1D6DD75B00E95907 /* MGLPredicateTests.mm */,
DAE6C3CC1CC34BD800DB3429 /* MGLStyleTests.mm */,
556660D51E1D07E400E2C41B /* MGLVersionNumber.m */,
@@ -938,6 +992,8 @@
DAF0D8151DFE6B1800B28378 /* MGLAttributionInfo_Private.h */,
DA00FC891D5EEAC3009AABC8 /* MGLAttributionInfo.mm */,
556660C51E1BEA0100E2C41B /* MGLFoundation.h */,
+ 558DE7A41E56161C00C7916D /* MGLFoundation_Private.h */,
+ 558DE7A51E56161C00C7916D /* MGLFoundation.mm */,
DAE6C34D1CC31E0400DB3429 /* MGLMapCamera.h */,
DAE6C36E1CC31E2A00DB3429 /* MGLMapCamera.mm */,
DD0902B01DB1AC6400C5BDCE /* MGLNetworkConfiguration.h */,
@@ -997,6 +1053,7 @@
3508EC641D749D39009B0EE4 /* NSExpression+MGLAdditions.h in Headers */,
DAE6C38D1CC31E2A00DB3429 /* MGLOfflineRegion_Private.h in Headers */,
DA7DC9831DED647F0027472F /* MGLRasterSource_Private.h in Headers */,
+ 1753ED401E53CE6100A9FD90 /* MGLConversion.h in Headers */,
408AA8651DAEEE3400022900 /* MGLPolygon+MGLAdditions.h in Headers */,
DA8F259C1D51CB000010E6B5 /* MGLStyleValue_Private.h in Headers */,
DAE6C35B1CC31E0400DB3429 /* MGLAnnotation.h in Headers */,
@@ -1047,6 +1104,7 @@
DAE6C3651CC31E0400DB3429 /* MGLPolyline.h in Headers */,
DAE6C39A1CC31E2A00DB3429 /* NSProcessInfo+MGLAdditions.h in Headers */,
DA8F258B1D51CA540010E6B5 /* MGLLineStyleLayer.h in Headers */,
+ 35C6DF841E214C0400ACA483 /* MGLDistanceFormatter.h in Headers */,
DA8F25B21D51CB270010E6B5 /* NSValue+MGLStyleAttributeAdditions.h in Headers */,
359819591E02F611008FC139 /* NSCoder+MGLAdditions.h in Headers */,
DAE6C38E1CC31E2A00DB3429 /* MGLOfflineStorage_Private.h in Headers */,
@@ -1057,6 +1115,7 @@
DA35A2CF1CCAAED300E826B2 /* NSValue+MGLAdditions.h in Headers */,
DAE6C3A61CC31E9400DB3429 /* MGLMapViewDelegate.h in Headers */,
DAE6C38B1CC31E2A00DB3429 /* MGLOfflinePack_Private.h in Headers */,
+ 558DE7A61E56161C00C7916D /* MGLFoundation_Private.h in Headers */,
88B079B21E37957000834FAB /* MGLComputedShapeSource.h in Headers */,
DACC22141CF3D3E200D220D9 /* MGLFeature.h in Headers */,
3538AA231D542685008EC33D /* MGLStyleLayer.h in Headers */,
@@ -1195,6 +1254,17 @@
en,
Base,
"zh-Hans",
+ "zh-Hant",
+ de,
+ fr,
+ ja,
+ sv,
+ vi,
+ "pt-BR",
+ es,
+ pl,
+ uk,
+ lt,
);
mainGroup = DA839E891CC2E3400062CAFB;
productRefGroup = DA839E931CC2E3400062CAFB /* Products */;
@@ -1217,6 +1287,7 @@
DA839EA21CC2E3400062CAFB /* Assets.xcassets in Resources */,
DA839EA01CC2E3400062CAFB /* MapDocument.xib in Resources */,
353BAEF81D6463B8009A8DA9 /* amsterdam.geojson in Resources */,
+ 96E027311E57C9A7004B8E66 /* Localizable.strings in Resources */,
DA839EA51CC2E3400062CAFB /* MainMenu.xib in Resources */,
DA5589771D320C41006B7F64 /* wms.json in Resources */,
DAE6C2E21CC304F900DB3429 /* Credits.rtf in Resources */,
@@ -1288,6 +1359,7 @@
35602BFB1D3EA99F0050646F /* MGLFillStyleLayer.mm in Sources */,
DAE6C3931CC31E2A00DB3429 /* MGLShape.mm in Sources */,
352742861D4C244700A1ECE6 /* MGLRasterSource.mm in Sources */,
+ 558DE7A71E56161C00C7916D /* MGLFoundation.mm in Sources */,
DAE6C39D1CC31E2A00DB3429 /* NSString+MGLAdditions.m in Sources */,
3598195A1E02F611008FC139 /* NSCoder+MGLAdditions.mm in Sources */,
DAE6C3941CC31E2A00DB3429 /* MGLStyle.mm in Sources */,
@@ -1311,6 +1383,7 @@
DA6408D81DA4E5DA00908C90 /* MGLVectorStyleLayer.m in Sources */,
DA8F25B31D51CB270010E6B5 /* NSValue+MGLStyleAttributeAdditions.mm in Sources */,
DAE6C3911CC31E2A00DB3429 /* MGLPolygon.mm in Sources */,
+ 35C6DF851E214C0400ACA483 /* MGLDistanceFormatter.m in Sources */,
DAE6C39B1CC31E2A00DB3429 /* NSProcessInfo+MGLAdditions.m in Sources */,
DAE6C38F1CC31E2A00DB3429 /* MGLOfflineStorage.mm in Sources */,
DAED38601D62CED700D7640F /* NSURL+MGLAdditions.m in Sources */,
@@ -1346,9 +1419,9 @@
DAE6C3D61CC34C9900DB3429 /* MGLStyleTests.mm in Sources */,
DAEDC4371D606291000224FF /* MGLAttributionButtonTests.m in Sources */,
DA35A2B61CCA14D700E826B2 /* MGLCompassDirectionFormatterTests.m in Sources */,
+ 35C6DF871E214C1800ACA483 /* MGLDistanceFormatterTests.m in Sources */,
DAE6C3D21CC34C9900DB3429 /* MGLGeometryTests.mm in Sources */,
DA87A9A41DCACC5000810D09 /* MGLSymbolStyleLayerTests.mm in Sources */,
- DAE6C3D51CC34C9900DB3429 /* MGLOfflineStorageTests.m in Sources */,
40E1601D1DF217D6005EA6D9 /* MGLStyleLayerTests.m in Sources */,
DA87A9A61DCACC5000810D09 /* MGLCircleStyleLayerTests.mm in Sources */,
DA87A99E1DC9DC2100810D09 /* MGLPredicateTests.mm in Sources */,
@@ -1362,6 +1435,7 @@
DA35A2A81CC9F41600E826B2 /* MGLCoordinateFormatterTests.m in Sources */,
DAE7DEC41E24549F007505A6 /* MGLNSStringAdditionsTests.m in Sources */,
DA87A9981DC9D88400810D09 /* MGLShapeSourceTests.mm in Sources */,
+ 55E2AD111E5B0A6900E8C587 /* MGLOfflineStorageTests.mm in Sources */,
3526EABD1DF9B19800006B43 /* MGLCodingTests.m in Sources */,
DA87A9A21DC9DCF100810D09 /* MGLFillStyleLayerTests.mm in Sources */,
3599A3E81DF70E2000E77FB2 /* MGLStyleValueTests.m in Sources */,
@@ -1388,6 +1462,26 @@
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
+ 96E027331E57C9A7004B8E66 /* Localizable.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 96E027321E57C9A7004B8E66 /* Base */,
+ 96E027341E57C9A9004B8E66 /* zh-Hans */,
+ 96E027351E57C9AB004B8E66 /* zh-Hant */,
+ 96E027361E57C9AC004B8E66 /* de */,
+ 96E027371E57C9B5004B8E66 /* fr */,
+ 96E027381E57C9B7004B8E66 /* ja */,
+ 96E027391E57C9B9004B8E66 /* sv */,
+ 96E0273A1E57C9BB004B8E66 /* vi */,
+ 96E0273B1E57C9BC004B8E66 /* pt-BR */,
+ 966091701E5BBFF700A9A03B /* es */,
+ 966091711E5BBFF900A9A03B /* pl */,
+ 966091721E5BBFFA00A9A03B /* uk */,
+ 966091731E5BBFFA00A9A03B /* lt */,
+ );
+ name = Localizable.strings;
+ sourceTree = "<group>";
+ };
DA839E9E1CC2E3400062CAFB /* MapDocument.xib */ = {
isa = PBXVariantGroup;
children = (
@@ -1417,6 +1511,17 @@
children = (
DA8933AC1CCD290700E68420 /* Base */,
DA88520F1E0A4D0D009D7AD6 /* zh-Hans */,
+ DAFBD0D51E3FA969000CD6BF /* zh-Hant */,
+ DAA32CA61E4C4849006F8D24 /* de */,
+ DAA32CAF1E4C4B0D006F8D24 /* fr */,
+ DAA32CB31E4C4CC3006F8D24 /* ja */,
+ DAA32CBA1E4C4F10006F8D24 /* sv */,
+ DAA32CC11E4C4F93006F8D24 /* vi */,
+ DA9C01311E4C7B9F00C4742A /* pt-BR */,
+ DA737ADF1E5914D300AD2CDE /* es */,
+ DA737AE41E5915B000AD2CDE /* pl */,
+ DA737AEC1E59180E00AD2CDE /* uk */,
+ DA1AC01E1E5B8826006DF1D6 /* lt */,
);
name = Localizable.strings;
sourceTree = "<group>";
@@ -1426,6 +1531,11 @@
children = (
DA8933B41CCD2C2500E68420 /* Base */,
DA8852101E0A4D3A009D7AD6 /* zh-Hans */,
+ DAFBD0D61E3FA983000CD6BF /* zh-Hant */,
+ DAA32CA71E4C486D006F8D24 /* de */,
+ DAA32CB21E4C4CB7006F8D24 /* ja */,
+ DAA32CC01E4C4F89006F8D24 /* vi */,
+ DA6023EF1E4CE8E500DBFF23 /* sv */,
);
name = Foundation.strings;
sourceTree = "<group>";
@@ -1434,6 +1544,13 @@
isa = PBXVariantGroup;
children = (
DA8933B71CCD2C2D00E68420 /* en */,
+ DAA32CA81E4C48B9006F8D24 /* de */,
+ DAA32CAE1E4C4B03006F8D24 /* fr */,
+ DA9C01301E4C7B9300C4742A /* pt-BR */,
+ DA6023F01E4CE8FF00DBFF23 /* sv */,
+ DA737ADE1E5914AD00AD2CDE /* es */,
+ DA737AE31E5915A500AD2CDE /* pl */,
+ DA1AC01F1E5B8904006DF1D6 /* uk */,
);
name = Foundation.stringsdict;
sourceTree = "<group>";
diff --git a/platform/macos/scripts/deploy-packages.sh b/platform/macos/scripts/deploy-packages.sh
index d0c545f8f5..8f61519244 100755
--- a/platform/macos/scripts/deploy-packages.sh
+++ b/platform/macos/scripts/deploy-packages.sh
@@ -9,7 +9,7 @@ set -u
# GITHUB_RELEASE=true: Upload to github
# BINARY_DIRECTORY=build/macos/deploy: Directory in which to save test packages
-# environment variables and dependencies:
+# environment variables and dependencies:
# - You must run "mbx auth ..." before running
# - Set GITHUB_TOKEN to a GitHub API access token in your environment to use GITHUB_RELEASE
# - "wget" is required for downloading the zip files from s3
@@ -20,19 +20,19 @@ function finish { >&2 echo -en "\033[0m"; }
trap finish EXIT
buildPackageStyle() {
- local package=$1 style=""
+ local package=$1 style=""
if [[ ${#} -eq 2 ]]; then
style="$2"
- fi
+ fi
step "Building: make ${package} ${style}"
make ${package}
step "Publishing ${package} with ${style}"
local file_name=""
- if [ -z ${style} ]
+ if [ -z ${style} ]
then
- file_name=mapbox-macos-sdk-${PUBLISH_VERSION}.zip
+ file_name=mapbox-macos-sdk-${PUBLISH_VERSION}.zip
else
- file_name=mapbox-macos-sdk-${PUBLISH_VERSION}-${style}.zip
+ file_name=mapbox-macos-sdk-${PUBLISH_VERSION}-${style}.zip
fi
step "Compressing ${file_name}…"
cd build/macos/pkg
@@ -98,7 +98,7 @@ step "Deploying version ${PUBLISH_VERSION}…"
if [[ ${#} -eq 3 && $3 == "-g" ]]; then
GITHUB_RELEASE=true
fi
-
+
make clean && make distclean
mkdir -p ${BINARY_DIRECTORY}
diff --git a/platform/macos/sdk/de.lproj/Localizable.strings b/platform/macos/sdk/de.lproj/Localizable.strings
new file mode 100644
index 0000000000..fe3d979a31
--- /dev/null
+++ b/platform/macos/sdk/de.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" = "Vergrößern";
+
+/* Label of Zoom Out button; U+2212 MINUS SIGN */
+"ZOOM_OUT_LABEL" = "−";
+
+/* Tooltip of Zoom Out button */
+"ZOOM_OUT_TOOLTIP" = "Verkleinern";
+
diff --git a/platform/macos/sdk/es.lproj/Localizable.strings b/platform/macos/sdk/es.lproj/Localizable.strings
new file mode 100644
index 0000000000..4ebb97b440
--- /dev/null
+++ b/platform/macos/sdk/es.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" = "Acercar";
+
+/* Label of Zoom Out button; U+2212 MINUS SIGN */
+"ZOOM_OUT_LABEL" = "−";
+
+/* Tooltip of Zoom Out button */
+"ZOOM_OUT_TOOLTIP" = "Alejar";
+
diff --git a/platform/macos/sdk/fr.lproj/Localizable.strings b/platform/macos/sdk/fr.lproj/Localizable.strings
new file mode 100644
index 0000000000..34e085ef2b
--- /dev/null
+++ b/platform/macos/sdk/fr.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" = "Zoomer";
+
+/* Label of Zoom Out button; U+2212 MINUS SIGN */
+"ZOOM_OUT_LABEL" = "−";
+
+/* Tooltip of Zoom Out button */
+"ZOOM_OUT_TOOLTIP" = "Dézoomer";
+
diff --git a/platform/macos/sdk/ja.lproj/Localizable.strings b/platform/macos/sdk/ja.lproj/Localizable.strings
new file mode 100644
index 0000000000..def56d1a9d
--- /dev/null
+++ b/platform/macos/sdk/ja.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/sdk/lt.lproj/Localizable.strings b/platform/macos/sdk/lt.lproj/Localizable.strings
new file mode 100644
index 0000000000..8e93c86963
--- /dev/null
+++ b/platform/macos/sdk/lt.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" = "Priartinti";
+
+/* Label of Zoom Out button; U+2212 MINUS SIGN */
+"ZOOM_OUT_LABEL" = "−";
+
+/* Tooltip of Zoom Out button */
+"ZOOM_OUT_TOOLTIP" = "Nutolinti";
+
diff --git a/platform/macos/sdk/pl.lproj/Localizable.strings b/platform/macos/sdk/pl.lproj/Localizable.strings
new file mode 100644
index 0000000000..d86155cbde
--- /dev/null
+++ b/platform/macos/sdk/pl.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" = "Powiększ";
+
+/* Label of Zoom Out button; U+2212 MINUS SIGN */
+"ZOOM_OUT_LABEL" = "−";
+
+/* Tooltip of Zoom Out button */
+"ZOOM_OUT_TOOLTIP" = "Pomniejsz";
+
diff --git a/platform/macos/sdk/pt-BR.lproj/Localizable.strings b/platform/macos/sdk/pt-BR.lproj/Localizable.strings
new file mode 100644
index 0000000000..c7490ec8d8
--- /dev/null
+++ b/platform/macos/sdk/pt-BR.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" = "Aumentar Zoom";
+
+/* Label of Zoom Out button; U+2212 MINUS SIGN */
+"ZOOM_OUT_LABEL" = "−";
+
+/* Tooltip of Zoom Out button */
+"ZOOM_OUT_TOOLTIP" = "Reduzir Zoom";
+
diff --git a/platform/macos/sdk/sv.lproj/Localizable.strings b/platform/macos/sdk/sv.lproj/Localizable.strings
new file mode 100644
index 0000000000..34841108a7
--- /dev/null
+++ b/platform/macos/sdk/sv.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" = "Zooma in";
+
+/* Label of Zoom Out button; U+2212 MINUS SIGN */
+"ZOOM_OUT_LABEL" = "−";
+
+/* Tooltip of Zoom Out button */
+"ZOOM_OUT_TOOLTIP" = "Zooma ut";
+
diff --git a/platform/macos/sdk/uk.lproj/Localizable.strings b/platform/macos/sdk/uk.lproj/Localizable.strings
new file mode 100644
index 0000000000..1be17a4d49
--- /dev/null
+++ b/platform/macos/sdk/uk.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/sdk/vi.lproj/Localizable.strings b/platform/macos/sdk/vi.lproj/Localizable.strings
new file mode 100644
index 0000000000..086820b034
--- /dev/null
+++ b/platform/macos/sdk/vi.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" = "Phóng to";
+
+/* Label of Zoom Out button; U+2212 MINUS SIGN */
+"ZOOM_OUT_LABEL" = "−";
+
+/* Tooltip of Zoom Out button */
+"ZOOM_OUT_TOOLTIP" = "Thu nhỏ";
+
diff --git a/platform/macos/sdk/zh-Hant.lproj/Localizable.strings b/platform/macos/sdk/zh-Hant.lproj/Localizable.strings
new file mode 100644
index 0000000000..4447371d71
--- /dev/null
+++ b/platform/macos/sdk/zh-Hant.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/MGLAnnotationImage.h b/platform/macos/src/MGLAnnotationImage.h
index 0f248c721c..d7336133d1 100644
--- a/platform/macos/src/MGLAnnotationImage.h
+++ b/platform/macos/src/MGLAnnotationImage.h
@@ -17,7 +17,7 @@ MGL_EXPORT
/**
Initializes and returns a new annotation image object.
-
+
@param image The image to display for the annotation.
@param reuseIdentifier The string that identifies this annotation image in the
reuse queue.
@@ -34,11 +34,11 @@ MGL_EXPORT
/**
The string that identifies this annotation image in the reuse queue.
(read-only)
-
+
You specify the reuse identifier when you create the image object. You use this
type later to retrieve an annotation image object that was created previously
but which is currently unused because its annotation is not on-screen.
-
+
If you define distinctly different types of annotations (with distinctly
different annotation images to go with them), you can differentiate between the
annotation types by specifying different reuse identifiers for each one.
@@ -47,7 +47,7 @@ MGL_EXPORT
/**
A Boolean value indicating whether the annotation is selectable.
-
+
The default value of this property is `YES`. If the value of this property is
`NO`, the annotation image ignores click events and cannot be selected.
*/
@@ -55,7 +55,7 @@ MGL_EXPORT
/**
The cursor that appears above any annotation using this annotation image.
-
+
By default, this property is set to `nil`, representing the current cursor.
*/
@property (nonatomic, nullable) NSCursor *cursor;
diff --git a/platform/macos/src/MGLAnnotationImage.m b/platform/macos/src/MGLAnnotationImage.m
index d19dbe5dfc..8d715b427b 100644
--- a/platform/macos/src/MGLAnnotationImage.m
+++ b/platform/macos/src/MGLAnnotationImage.m
@@ -47,9 +47,9 @@
- (BOOL)isEqual:(id)other {
if (self == other) return YES;
if (![other isKindOfClass:[MGLAnnotationImage class]]) return NO;
-
+
MGLAnnotationImage *otherAnnotationImage = other;
-
+
return ((!_reuseIdentifier && !otherAnnotationImage.reuseIdentifier) || [_reuseIdentifier isEqualToString:otherAnnotationImage.reuseIdentifier])
&& _selectable == otherAnnotationImage.selectable
&& ((!_cursor && !otherAnnotationImage.cursor) || [_cursor isEqual:otherAnnotationImage.cursor])
diff --git a/platform/macos/src/MGLAttributionButton.mm b/platform/macos/src/MGLAttributionButton.mm
index ed8bb18a66..3df415f60d 100644
--- a/platform/macos/src/MGLAttributionButton.mm
+++ b/platform/macos/src/MGLAttributionButton.mm
@@ -10,25 +10,25 @@
if (self = [super initWithFrame:NSZeroRect]) {
self.bordered = NO;
self.bezelStyle = NSRegularSquareBezelStyle;
-
+
// Extract any prefix consisting of intellectual property symbols.
NSScanner *scanner = [NSScanner scannerWithString:info.title.string];
NSCharacterSet *symbolSet = [NSCharacterSet characterSetWithCharactersInString:@"©℗®℠™ &"];
NSString *symbol;
[scanner scanCharactersFromSet:symbolSet intoString:&symbol];
-
+
// Remove the underline from the symbol for aesthetic reasons.
NSMutableAttributedString *title = info.title.mutableCopy;
[title removeAttribute:NSUnderlineStyleAttributeName range:NSMakeRange(0, symbol.length)];
-
+
self.attributedTitle = title;
[self sizeToFit];
-
+
_URL = info.URL;
if (_URL) {
self.toolTip = _URL.absoluteString;
}
-
+
self.target = self;
self.action = @selector(openURL:);
}
diff --git a/platform/macos/src/MGLMapView+IBAdditions.h b/platform/macos/src/MGLMapView+IBAdditions.h
index 81f4506a57..8a4a90917b 100644
--- a/platform/macos/src/MGLMapView+IBAdditions.h
+++ b/platform/macos/src/MGLMapView+IBAdditions.h
@@ -20,7 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
// underscores for display.
/** URL of the style currently displayed in the receiver.
-
+
The URL may be a full HTTP or HTTPS URL, a Mapbox URL indicating the style’s
map ID (`mapbox://styles/<user>/<style>`), or a path to a local file
relative to the application’s resource path. Leave this field blank for the
diff --git a/platform/macos/src/MGLMapView.h b/platform/macos/src/MGLMapView.h
index efe83d1573..4d1a2fc2c4 100644
--- a/platform/macos/src/MGLMapView.h
+++ b/platform/macos/src/MGLMapView.h
@@ -19,11 +19,11 @@ NS_ASSUME_NONNULL_BEGIN
/**
An interactive, customizable map view with an interface similar to the one
provided by Apple’s MapKit.
-
+
Using `MGLMapView`, you can embed the map inside a view, allow users to
manipulate it with standard gestures, animate the map between different
viewpoints, and present information in the form of annotations and overlays.
-
+
The map view loads scalable vector tiles that conform to the
<a href="https://github.com/mapbox/vector-tile-spec">Mapbox Vector Tile Specification</a>.
It styles them with a style that conforms to the
@@ -31,20 +31,35 @@ NS_ASSUME_NONNULL_BEGIN
Such styles can be designed in
<a href="https://www.mapbox.com/studio/">Mapbox Studio</a> and hosted on
mapbox.com.
-
+
A collection of Mapbox-hosted styles is available through the `MGLStyle` class.
These basic styles use
<a href="https://www.mapbox.com/developers/vector-tiles/mapbox-streets">Mapbox Streets</a>
or <a href="https://www.mapbox.com/satellite/">Mapbox Satellite</a> data
sources, but you can specify a custom style that makes use of your own data.
-
+
Mapbox-hosted vector tiles and styles require an API access token, which you
can obtain from the
<a href="https://www.mapbox.com/studio/account/tokens/">Mapbox account page</a>.
Access tokens associate requests to Mapbox’s vector tile and style APIs with
your Mapbox account. They also deter other developers from using your styles
without your permission.
-
+
+ Adding your own gesture recognizer to `MGLMapView` will block the corresponding
+ gesture recognizer built into `MGLMapView`. To avoid conflicts, define which
+ gesture recognizer takes precedence. For example, you can subclass
+ `NSClickGestureRecognizer` and override `-[NSGestureRecognizer shouldRequireFailureOfGestureRecognizer:]`,
+ so that your subclass will be invoked only if the default `MGLMapView` click
+ gesture recognizer fails:
+
+ ```swift
+ class MapClickGestureRecognizer: NSClickGestureRecognizer {
+ override func shouldRequireFailure(of otherGestureRecognizer: NSGestureRecognizer) -> Bool {
+ return otherGestureRecognizer is NSClickGestureRecognizer
+ }
+ }
+ ```
+
@note You are responsible for getting permission to use the map data and for
ensuring that your use adheres to the relevant terms of use.
*/
@@ -56,7 +71,7 @@ MGL_EXPORT IB_DESIGNABLE
/**
Initializes and returns a newly allocated map view with the specified frame and
the default style.
-
+
@param frame The frame for the view, measured in points.
@return An initialized map view.
*/
@@ -65,7 +80,7 @@ MGL_EXPORT IB_DESIGNABLE
/**
Initializes and returns a newly allocated map view with the specified frame and
style URL.
-
+
@param frame The frame for the view, measured in points.
@param styleURL URL of the map style to display. The URL may be a full HTTP or
HTTPS URL, a Mapbox URL indicating the style’s map ID
@@ -79,7 +94,7 @@ MGL_EXPORT IB_DESIGNABLE
/**
The receiver’s delegate.
-
+
A map view sends messages to its delegate to notify it of changes to its
contents or the viewpoint. The delegate also provides information about
annotations displayed on the map, such as the styles to apply to individual
@@ -91,36 +106,36 @@ MGL_EXPORT IB_DESIGNABLE
/**
The style currently displayed in the receiver.
-
+
Unlike the `styleURL` property, this property is set to an object that allows
you to manipulate every aspect of the style locally.
-
+
If the style is loading, this property is set to `nil` until the style finishes
loading. If the style has failed to load, this property is set to `nil`.
Because the style loads asynchronously, you should manipulate it in the
`-[MGLMapViewDelegate mapView:didFinishLoadingStyle:]` or
`-[MGLMapViewDelegate mapViewDidFinishLoadingMap:]` method. It is not possible
to manipulate the style before it has finished loading.
-
+
@note The default styles provided by Mapbox contain sources and layers with
identifiers that will change over time. Applications that use APIs that
manipulate a style's sources and layers must first set the style URL to an
explicitly versioned style using a convenience method like
- `+[MGLStyle outdoorsStyleURLWithVersion:]`, `MGLMapView`'s “Style URL”
+ `+[MGLStyle outdoorsStyleURLWithVersion:]`, `MGLMapView`’s “Style URL”
inspectable in Interface Builder, or a manually constructed `NSURL`.
*/
@property (nonatomic, readonly, nullable) MGLStyle *style;
/**
URL of the style currently displayed in the receiver.
-
+
The URL may be a full HTTP or HTTPS URL, a Mapbox URL indicating the style’s
map ID (`mapbox://styles/<user>/<style>`), or a path to a local file relative
to the application’s resource path.
-
+
If you set this property to `nil`, the receiver will use the default style and
this property will automatically be set to that style’s URL.
-
+
If you want to modify the current style without replacing it outright, or if
you want to introspect individual style attributes, use the `style` property.
*/
@@ -128,7 +143,7 @@ MGL_EXPORT IB_DESIGNABLE
/**
Reloads the style.
-
+
You do not normally need to call this method. The map view automatically
responds to changes in network connectivity by reloading the style. You may
need to call this method if you change the access token after a style has
@@ -149,7 +164,7 @@ MGL_EXPORT IB_DESIGNABLE
/**
The Mapbox logo, positioned in the lower-left corner.
-
+
@note The Mapbox terms of service, which governs the use of Mapbox-hosted
vector tiles and styles,
<a href="https://www.mapbox.com/help/mapbox-logo/">requires</a> most Mapbox
@@ -161,7 +176,7 @@ MGL_EXPORT IB_DESIGNABLE
/**
A view showing legally required copyright notices, positioned along the bottom
of the map view, to the left of the Mapbox logo.
-
+
@note The Mapbox terms of service, which governs the use of Mapbox-hosted
vector tiles and styles,
<a href="https://www.mapbox.com/help/attribution/">requires</a> these
@@ -176,10 +191,10 @@ MGL_EXPORT IB_DESIGNABLE
/**
The geographic coordinate at the center of the map view.
-
+
Changing the value of this property centers the map on the new coordinate
without changing the current zoom level.
-
+
Changing the value of this property updates the map view immediately. If you
want to animate the change, use the `-setCenterCoordinate:animated:` method
instead.
@@ -188,10 +203,10 @@ MGL_EXPORT IB_DESIGNABLE
/**
Changes the center coordinate of the map and optionally animates the change.
-
+
Changing the center coordinate centers the map on the new coordinate without
changing the current zoom level.
-
+
@param coordinate The new center coordinate for the map.
@param animated Specify `YES` if you want the map view to scroll to the new
location or `NO` if you want the map to display the new location
@@ -201,12 +216,12 @@ MGL_EXPORT IB_DESIGNABLE
/**
The zoom level of the receiver.
-
+
In addition to affecting the visual size and detail of features on the map, the
zoom level affects the size of the vector tiles that are loaded. At zoom level
0, each tile covers the entire world map; at zoom level 1, it covers ¼ of the
world; at zoom level 2, <sup>1</sup>⁄<sub>16</sub> of the world, and so on.
-
+
Changing the value of this property updates the map view immediately. If you
want to animate the change, use the `-setZoomLevel:animated:` method instead.
*/
@@ -214,34 +229,34 @@ MGL_EXPORT IB_DESIGNABLE
/**
The minimum zoom level at which the map can be shown.
-
+
Depending on the map view’s aspect ratio, the map view may be prevented from
reaching the minimum zoom level, in order to keep the map from repeating within
the current viewport.
-
+
If the value of this property is greater than that of the `maximumZoomLevel`
property, the behavior is undefined.
-
+
The default value of this property is 0.
*/
@property (nonatomic) double minimumZoomLevel;
/**
The maximum zoom level the map can be shown at.
-
+
If the value of this property is smaller than that of the `minimumZoomLevel`
property, the behavior is undefined.
-
+
The default value of this property is 20.
*/
@property (nonatomic) double maximumZoomLevel;
/**
Changes the zoom level of the map and optionally animates the change.
-
+
Changing the zoom level scales the map without changing the current center
coordinate.
-
+
@param zoomLevel The new zoom level for the map.
@param animated Specify `YES` if you want the map view to animate the change
to the new zoom level or `NO` if you want the map to display the new zoom
@@ -251,11 +266,11 @@ MGL_EXPORT IB_DESIGNABLE
/**
The heading of the map, measured in degrees clockwise from true north.
-
+
The value `0` means that the top edge of the map view corresponds to true
north. The value `90` means the top of the map is pointing due east. The value
`180` means the top of the map points due south, and so on.
-
+
Changing the value of this property updates the map view immediately. If you
want to animate the change, use the `-setDirection:animated:` method instead.
*/
@@ -263,10 +278,10 @@ MGL_EXPORT IB_DESIGNABLE
/**
Changes the heading of the map and optionally animates the change.
-
+
Changing the heading rotates the map without changing the current center
coordinate or zoom level.
-
+
@param direction The heading of the map, measured in degrees clockwise from
true north.
@param animated Specify `YES` if you want the map view to animate the change
@@ -283,7 +298,7 @@ MGL_EXPORT IB_DESIGNABLE
/**
Moves the viewpoint to a different location with respect to the map with an
optional transition animation.
-
+
@param camera The new viewpoint.
@param animated Specify `YES` if you want the map view to animate the change to
the new viewpoint or `NO` if you want the map to display the new viewpoint
@@ -294,7 +309,7 @@ MGL_EXPORT IB_DESIGNABLE
/**
Moves the viewpoint to a different location with respect to the map with an
optional transition duration and timing function.
-
+
@param camera The new viewpoint.
@param duration The amount of time, measured in seconds, that the transition
animation should take. Specify `0` to jump to the new viewpoint
@@ -310,10 +325,10 @@ MGL_EXPORT IB_DESIGNABLE
Moves the viewpoint to a different location using a transition animation that
evokes powered flight and a default duration based on the length of the flight
path.
-
+
The transition animation seamlessly incorporates zooming and panning to help
the user find his or her bearings even after traversing a great distance.
-
+
@param camera The new viewpoint.
@param completion The block to execute after the animation finishes.
*/
@@ -322,10 +337,10 @@ MGL_EXPORT IB_DESIGNABLE
/**
Moves the viewpoint to a different location using a transition animation that
evokes powered flight and an optional transition duration.
-
+
The transition animation seamlessly incorporates zooming and panning to help
the user find his or her bearings even after traversing a great distance.
-
+
@param camera The new viewpoint.
@param duration The amount of time, measured in seconds, that the transition
animation should take. Specify `0` to jump to the new viewpoint
@@ -338,10 +353,10 @@ MGL_EXPORT IB_DESIGNABLE
/**
Moves the viewpoint to a different location using a transition animation that
evokes powered flight and an optional transition duration and peak altitude.
-
+
The transition animation seamlessly incorporates zooming and panning to help
the user find his or her bearings even after traversing a great distance.
-
+
@param camera The new viewpoint.
@param duration The amount of time, measured in seconds, that the transition
animation should take. Specify `0` to jump to the new viewpoint
@@ -357,7 +372,7 @@ MGL_EXPORT IB_DESIGNABLE
/**
The geographic coordinate bounds visible in the receiver’s viewport.
-
+
Changing the value of this property updates the receiver immediately. If you
want to animate the change, use the `-setVisibleCoordinateBounds:animated:`
method instead.
@@ -367,7 +382,7 @@ MGL_EXPORT IB_DESIGNABLE
/**
Changes the receiver’s viewport to fit the given coordinate bounds, optionally
animating the change.
-
+
@param bounds The bounds that the viewport will show in its entirety.
@param animated Specify `YES` to animate the change by smoothly scrolling and
zooming or `NO` to immediately display the given bounds.
@@ -377,7 +392,7 @@ MGL_EXPORT IB_DESIGNABLE
/**
Changes the receiver’s viewport to fit the given coordinate bounds and
optionally some additional padding on each side.
-
+
@param bounds The bounds that the viewport will show in its entirety.
@param insets The minimum padding (in screen points) that will be visible
around the given coordinate bounds.
@@ -417,7 +432,7 @@ MGL_EXPORT IB_DESIGNABLE
/**
Returns the camera that best fits the given coordinate bounds.
-
+
@param bounds The coordinate bounds to fit to the receiver’s viewport.
@return A camera object centered on the same location as the coordinate bounds
with zoom level as high (close to the ground) as possible while still
@@ -429,7 +444,7 @@ MGL_EXPORT IB_DESIGNABLE
/**
Returns the camera that best fits the given coordinate bounds, optionally with
some additional padding on each side.
-
+
@param bounds The coordinate bounds to fit to the receiver’s viewport.
@param insets The minimum padding (in screen points) that would be visible
around the returned camera object if it were set as the receiver’s camera.
@@ -443,13 +458,13 @@ MGL_EXPORT IB_DESIGNABLE
/**
A Boolean value indicating whether the receiver automatically adjusts its
content insets.
-
+
When the value of this property is `YES`, the map view automatically updates
its `contentInsets` property to account for any overlapping title bar or
toolbar. To overlap with the title bar or toolbar, the containing window’s
style mask must have `NSFullSizeContentViewWindowMask` set, and the title bar
must not be transparent.
-
+
The default value of this property is `YES`.
*/
@property (nonatomic, assign) BOOL automaticallyAdjustsContentInsets;
@@ -457,16 +472,16 @@ MGL_EXPORT IB_DESIGNABLE
/**
The distance from the edges of the map view’s frame to the edges of the map
view’s logical viewport.
-
+
When the value of this property is equal to `NSEdgeInsetsZero`, viewport
properties such as `centerCoordinate` assume a viewport that matches the map
view’s frame. Otherwise, those properties are inset, excluding part of the
frame from the viewport. For instance, if the only the top edge is inset, the
map center is effectively shifted downward.
-
+
When the value of the `automaticallyAdjustsContentInsets` property is `YES`,
the value of this property may be overridden at any time.
-
+
Changing the value of this property updates the map view immediately. If you
want to animate the change, use the `-setContentInsets:animated:` method
instead.
@@ -476,16 +491,16 @@ MGL_EXPORT IB_DESIGNABLE
/**
Sets the distance from the edges of the map view’s frame to the edges of the
map view’s logical viewport, with an optional transition animation.
-
+
When the value of this property is equal to `NSEdgeInsetsZero`, viewport
properties such as `centerCoordinate` assume a viewport that matches the map
view’s frame. Otherwise, those properties are inset, excluding part of the
frame from the viewport. For instance, if the only the top edge is inset, the
map center is effectively shifted downward.
-
+
When the value of the `automaticallyAdjustsContentInsets` property is `YES`,
the value of this property may be overridden at any time.
-
+
@param contentInsets The new values to inset the content by.
@param animated Specify `YES` if you want the map view to animate the change to
the content insets or `NO` if you want the map to inset the content
@@ -498,13 +513,13 @@ MGL_EXPORT IB_DESIGNABLE
/**
A Boolean value that determines whether the user may zoom the map in and out,
changing the zoom level.
-
+
When this property is set to `YES`, the default, the user may zoom the map in
and out by pinching two fingers, by using a scroll wheel on a traditional
mouse, or by dragging the mouse cursor up and down while holding down the Shift
key. When the receiver has focus, the user may also zoom by pressing the up and
down arrow keys while holding down the Option key.
-
+
This property controls only user interactions with the map. If you set the
value of this property to `NO`, you may still change the map zoom
programmatically.
@@ -514,11 +529,11 @@ MGL_EXPORT IB_DESIGNABLE
/**
A Boolean value that determines whether the user may scroll around the map,
changing the center coordinate.
-
+
When this property is set to `YES`, the default, the user may scroll the map by
swiping with two fingers or dragging the mouse cursor. When the receiver has
focus, the user may also scroll around the map by pressing the arrow keys.
-
+
This property controls only user interactions with the map. If you set the
value of this property to `NO`, you may still change the map location
programmatically.
@@ -528,13 +543,13 @@ MGL_EXPORT IB_DESIGNABLE
/**
A Boolean value that determines whether the user may rotate the map, changing
the direction.
-
+
When this property is set to `YES`, the default, the user may rotate the map by
moving two fingers in a circular motion or by dragging the mouse cursor left
and right while holding down the Option key. When the receiver has focus, the
user may also zoom by pressing the left and right arrow keys while holding down
the Option key.
-
+
This property controls only user interactions with the map. If you set the
value of this property to `NO`, you may still rotate the map programmatically.
*/
@@ -543,10 +558,10 @@ MGL_EXPORT IB_DESIGNABLE
/**
A Boolean value that determines whether the user may tilt of the map, changing
the pitch.
-
+
When this property is set to `YES`, the default, the user may rotate the map by
dragging the mouse cursor up and down while holding down the Option key.
-
+
This property controls only user interactions with the map. If you set the
value of this property to `NO`, you may still change the pitch of the map
programmatically.
@@ -557,7 +572,7 @@ MGL_EXPORT IB_DESIGNABLE
/**
The complete list of annotations associated with the receiver. (read-only)
-
+
The objects in this array must adopt the `MGLAnnotation` protocol. If no
annotations are associated with the map view, the value of this property is
`nil`.
@@ -566,13 +581,13 @@ MGL_EXPORT IB_DESIGNABLE
/**
Adds an annotation to the map view.
-
+
@note `MGLMultiPolyline`, `MGLMultiPolygon`, and `MGLShapeCollection` objects
cannot be added to the map view at this time. Nor can `MGLMultiPoint`
objects that are not instances of `MGLPolyline` or `MGLPolygon`. Any
multipoint, multipolyline, multipolygon, or shape collection object that is
specified is silently ignored.
-
+
@param annotation The annotation object to add to the receiver. This object
must conform to the `MGLAnnotation` protocol. The map view retains the
annotation object.
@@ -581,13 +596,13 @@ MGL_EXPORT IB_DESIGNABLE
/**
Adds an array of annotations to the map view.
-
+
@note `MGLMultiPolyline`, `MGLMultiPolygon`, and `MGLShapeCollection` objects
cannot be added to the map view at this time. Nor can `MGLMultiPoint`
objects that are not instances of `MGLPolyline` or `MGLPolygon`. Any
multipoint, multipolyline, multipolygon, or shape collection objects that
are specified are silently ignored.
-
+
@param annotations An array of annotation objects. Each object in the array
must conform to the `MGLAnnotation` protocol. The map view retains each
individual annotation object.
@@ -597,7 +612,7 @@ MGL_EXPORT IB_DESIGNABLE
/**
The complete list of annotations associated with the receiver that are
currently visible.
-
+
The objects in this array must adopt the `MGLAnnotation` protocol. If no
annotations are associated with the map view or if no annotations associated
with the map view are currently visible, the value of this property is `nil`.
@@ -606,11 +621,11 @@ MGL_EXPORT IB_DESIGNABLE
/**
Removes an annotation from the map view, deselecting it if it is selected.
-
+
Removing an annotation object dissociates it from the map view entirely,
preventing it from being displayed on the map. Thus you would typically call
this method only when you want to hide or delete a given annotation.
-
+
@param annotation The annotation object to remove. This object must conform to
the `MGLAnnotation` protocol.
*/
@@ -619,11 +634,11 @@ MGL_EXPORT IB_DESIGNABLE
/**
Removes an array of annotations from the map view, deselecting any selected
annotations in the array.
-
+
Removing annotation objects dissociates them from the map view entirely,
preventing them from being displayed on the map. Thus you would typically call
this method only when you want to hide or delete the given annotations.
-
+
@param annotations The array of annotation objects to remove. Objects in the
array must conform to the `MGLAnnotation` protocol.
*/
@@ -631,11 +646,11 @@ MGL_EXPORT IB_DESIGNABLE
/**
Returns a reusable annotation image object associated with its identifier.
-
+
For performance reasons, you should generally reuse `MGLAnnotationImage`
objects for identical-looking annotations in your map views. Dequeueing saves
time and memory during performance-critical operations such as scrolling.
-
+
@param identifier A string identifying the annotation image to be reused. This
string is the same one you specify when initially returning the annotation
image object using the `-mapView:imageForAnnotation:` method.
@@ -647,7 +662,7 @@ MGL_EXPORT IB_DESIGNABLE
/**
Returns the list of annotations associated with the receiver that intersect with
the given rectangle.
-
+
@param rect A rectangle expressed in the map view’s coordinate system.
@return An array of objects that adopt the `MGLAnnotation` protocol or `nil` if
no annotations associated with the map view are currently visible in the
@@ -659,7 +674,7 @@ MGL_EXPORT IB_DESIGNABLE
/**
The currently selected annotations.
-
+
Assigning a new array to this property selects only the first annotation in the
array.
*/
@@ -667,30 +682,30 @@ MGL_EXPORT IB_DESIGNABLE
/**
Selects an annotation and displays a callout popover for it.
-
+
If the given annotation is not visible within the current viewport, this method
has no effect.
-
+
@param annotation The annotation object to select.
*/
- (void)selectAnnotation:(id <MGLAnnotation>)annotation;
/**
Deselects an annotation and hides its callout popover.
-
+
@param annotation The annotation object to deselect.
*/
- (void)deselectAnnotation:(nullable id <MGLAnnotation>)annotation;
/**
A common view controller for managing a callout popover’s content view.
-
+
Like any instance of `NSPopover`, an annotation callout manages its contents
with a view controller. The annotation object is the view controller’s
represented object. This means that you can bind controls in the view
controller’s content view to KVO-compliant properties of the annotation object,
such as `title` and `subtitle`.
-
+
This property defines a common view controller that is used for every
annotation’s callout view. If you set this property to `nil`, a default view
controller will be used that manages a simple title label and subtitle label.
@@ -704,7 +719,7 @@ MGL_EXPORT IB_DESIGNABLE
/**
Returns a point annotation located at the given point.
-
+
@param point A point in the view’s coordinate system.
@return A point annotation whose annotation image coincides with the point. If
multiple point annotations coincide with the point, the return value is the
@@ -716,9 +731,9 @@ MGL_EXPORT IB_DESIGNABLE
/**
Adds a single overlay to the map.
-
+
To remove an overlay from a map, use the `-removeOverlay:` method.
-
+
@param overlay The overlay object to add. This object must conform to the
`MGLOverlay` protocol.
*/
@@ -726,9 +741,9 @@ MGL_EXPORT IB_DESIGNABLE
/**
Adds an array of overlays to the map.
-
+
To remove multiple overlays from a map, use the `-removeOverlays:` method.
-
+
@param overlays An array of objects, each of which must conform to the
`MGLOverlay` protocol.
*/
@@ -736,19 +751,19 @@ MGL_EXPORT IB_DESIGNABLE
/**
Removes a single overlay from the map.
-
+
If the specified overlay is not currently associated with the map view, this
method does nothing.
-
+
@param overlay The overlay object to remove.
*/
- (void)removeOverlay:(id <MGLOverlay>)overlay;
/**
Removes an array of overlays from the map.
-
+
If a given overlay object is not associated with the map view, it is ignored.
-
+
@param overlays An array of objects, each of which conforms to the `MGLOverlay`
protocol.
*/
@@ -758,12 +773,12 @@ MGL_EXPORT IB_DESIGNABLE
/**
Returns an array of rendered map features that intersect with a given point.
-
+
This method may return features from any of the map’s style layers. To restrict
the search to a particular layer or layers, use the
`-visibleFeaturesAtPoint:inStyleLayersWithIdentifiers:` 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.
@return An array of objects conforming to the `MGLFeature` protocol that
represent features in the sources used by the current style.
@@ -773,13 +788,13 @@ MGL_EXPORT IB_DESIGNABLE
/**
Returns an array of rendered map features that intersect with a given point,
restricted to the given style layers.
-
+
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
<a href="https://www.mapbox.com/vector-tiles/mapbox-streets/">Mapbox Streets source</a>,
@@ -792,26 +807,26 @@ MGL_EXPORT IB_DESIGNABLE
attributes). The dictionary contains only the attributes provided by the
tile source; it does not include computed attribute values or rules about how
the feature is rendered by the current style.
-
+
The returned array is sorted by z-order, starting with the topmost rendered
feature and ending with the bottommost rendered feature. A feature that is
rendered multiple times due to wrapping across the antimeridian at low zoom
levels is included only once, subject to the caveat that follows.
-
+
Features come from tiled vector data or GeoJSON 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 the specified point
lies along a road that spans the screen. The resulting array includes those
parts of the road that lie within the map tile that contain the specified
point, even if the road extends into other tiles.
-
+
To find out the layer names in a particular style, view the style in
<a href="https://www.mapbox.com/studio/">Mapbox Studio</a>.
-
+
@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”
+ `+[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.
@@ -828,12 +843,12 @@ MGL_EXPORT IB_DESIGNABLE
/**
Returns an array of rendered map features that intersect with the given
rectangle.
-
+
This method may return features from any of the map’s style layers. To restrict
the search to a particular layer or layers, use the
`-visibleFeaturesAtPoint:inStyleLayersWithIdentifiers:` method. For more
information about searching for map features, see that method’s documentation.
-
+
@param rect A rectangle expressed in the map view’s coordinate system.
@return An array of objects conforming to the `MGLFeature` protocol that
represent features in the sources used by the current style.
@@ -843,13 +858,13 @@ MGL_EXPORT IB_DESIGNABLE
/**
Returns an array of rendered map features that intersect with the given
rectangle, restricted to the given style layers.
-
+
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
<a href="https://www.mapbox.com/vector-tiles/mapbox-streets/">Mapbox Streets source</a>,
@@ -862,12 +877,12 @@ MGL_EXPORT IB_DESIGNABLE
contains only the attributes provided by the tile source; it does not include
computed attribute values or rules about how the feature is rendered by the
current style.
-
+
The returned array is sorted by z-order, starting with the topmost rendered
feature and ending with the bottommost rendered feature. A feature that is
rendered multiple times due to wrapping across the antimeridian at low zoom
levels is included only once, subject to the caveat that follows.
-
+
Features come from tiled vector data or GeoJSON 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 the specified
@@ -875,14 +890,14 @@ MGL_EXPORT IB_DESIGNABLE
includes those parts of the road that lie within the map tiles covering the
specified rectangle, even if the road extends into other tiles. The portion of
the road within each map tile is included individually.
-
+
To find out the layer names in a particular style, view the style in
<a href="https://www.mapbox.com/studio/">Mapbox Studio</a>.
-
+
@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”
+ `+[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.
@@ -901,7 +916,7 @@ MGL_EXPORT IB_DESIGNABLE
/**
Converts a geographic coordinate to a point in the given view’s coordinate
system.
-
+
@param coordinate The geographic coordinate to convert.
@param view The view in whose coordinate system the returned point should be
expressed. If this parameter is `nil`, the returned point is expressed in
@@ -915,7 +930,7 @@ MGL_EXPORT IB_DESIGNABLE
/**
Converts a point in the given view’s coordinate system to a geographic
coordinate.
-
+
@param point The point to convert.
@param view The view in whose coordinate system the point is expressed.
@return The geographic coordinate at the given point.
@@ -925,7 +940,7 @@ MGL_EXPORT IB_DESIGNABLE
/**
Converts a geographic bounding box to a rectangle in the given view’s
coordinate system.
-
+
@param bounds The geographic bounding box to convert.
@param view The view in whose coordinate system the returned rectangle should
be expressed. If this parameter is `nil`, the returned rectangle is
@@ -937,7 +952,7 @@ MGL_EXPORT IB_DESIGNABLE
/**
Converts a rectangle in the given view’s coordinate system to a geographic
bounding box.
-
+
@param rect The rectangle to convert.
@param view The view in whose coordinate system the rectangle is expressed.
@return The geographic bounding box coextensive with the given rectangle.
@@ -947,11 +962,11 @@ MGL_EXPORT IB_DESIGNABLE
/**
Returns the distance spanned by one point in the map view’s coordinate system
at the given latitude and current zoom level.
-
+
The distance between points decreases as the latitude approaches the poles.
This relationship parallels the relationship between longitudinal coordinates
at different latitudes.
-
+
@param latitude The latitude of the geographic coordinate represented by the
point.
@return The distance in meters spanned by a single point.
@@ -963,11 +978,11 @@ MGL_EXPORT IB_DESIGNABLE
/**
Opens one or more webpages in the default Web browser in which the user can
provide feedback about the map data.
-
+
You should add a menu item to the Help menu of your application that invokes
this method. Title it “Improve This Map” or similar. Set its target to the
first responder and its action to `giveFeedback:`.
-
+
This map view searches the current style’s sources for webpages to open.
Specifically, each source’s tile set has an `attribution` property containing
HTML code; if an <code>&lt;a></code> tag (link) within that code has an
@@ -981,7 +996,7 @@ MGL_EXPORT IB_DESIGNABLE
/**
The options that determine which debugging aids are shown on the map.
-
+
These options are all disabled by default and should remain disabled in
released software for performance and aesthetic reasons.
*/
diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm
index e9d8fc5f45..827da35076 100644
--- a/platform/macos/src/MGLMapView.mm
+++ b/platform/macos/src/MGLMapView.mm
@@ -11,6 +11,7 @@
#import "MGLMultiPoint_Private.h"
#import "MGLOfflineStorage_Private.h"
#import "MGLStyle_Private.h"
+#import "MGLFoundation_Private.h"
#import "MGLAccountManager.h"
#import "MGLMapCamera.h"
@@ -35,6 +36,7 @@
#import <mbgl/util/constants.hpp>
#import <mbgl/util/chrono.hpp>
#import <mbgl/util/run_loop.hpp>
+#import <mbgl/util/shared_thread_pool.hpp>
#import <map>
#import <unordered_map>
@@ -105,11 +107,6 @@ NSImage *MGLDefaultMarkerImage() {
return [[NSImage alloc] initWithContentsOfFile:path];
}
-/// Initializes the run loop shim that lives on the main thread.
-void MGLinitializeRunLoop() {
- static mbgl::util::RunLoop mainRunLoop;
-}
-
/// Converts a media timing function into a unit bezier object usable in mbgl.
mbgl::util::UnitBezier MGLUnitBezierForMediaTimingFunction(CAMediaTimingFunction *function) {
if (!function) {
@@ -151,7 +148,7 @@ public:
/// Cross-platform map view controller.
mbgl::Map *_mbglMap;
MGLMapViewImpl *_mbglView;
- mbgl::ThreadPool *_mbglThreadPool;
+ std::shared_ptr<mbgl::ThreadPool> _mbglThreadPool;
NSPanGestureRecognizer *_panGestureRecognizer;
NSMagnificationGestureRecognizer *_magnificationGestureRecognizer;
@@ -193,6 +190,9 @@ public:
/// True if the view is currently printing itself.
BOOL _isPrinting;
+
+ /// reachability instance
+ MGLReachability *_reachability;
}
#pragma mark Lifecycle
@@ -231,7 +231,11 @@ public:
- (void)awakeFromNib {
[super awakeFromNib];
- self.styleURL = nil;
+ // If the Style URL inspectable was not set, make sure to go through
+ // -setStyleURL: to load the default style.
+ if (_mbglMap->getStyleURL().empty()) {
+ self.styleURL = nil;
+ }
}
+ (NSArray *)restorableStateKeyPaths {
@@ -239,8 +243,6 @@ public:
}
- (void)commonInit {
- MGLinitializeRunLoop();
-
_isTargetingInterfaceBuilder = NSProcessInfo.processInfo.mgl_isInterfaceBuilderDesignablesAgent;
// Set up cross-platform controllers and resources.
@@ -260,7 +262,7 @@ public:
mbgl::DefaultFileSource* mbglFileSource = [MGLOfflineStorage sharedOfflineStorage].mbglFileSource;
- _mbglThreadPool = new mbgl::ThreadPool(4);
+ _mbglThreadPool = mbgl::sharedThreadPool();
_mbglMap = new mbgl::Map(*_mbglView, self.size, [NSScreen mainScreen].backingScaleFactor, *mbglFileSource, *_mbglThreadPool, mbgl::MapMode::Continuous, mbgl::GLContextMode::Unique, mbgl::ConstrainMode::None, mbgl::ViewportMode::Default);
[self validateTileCacheSize];
@@ -269,11 +271,11 @@ public:
self.layer = _isTargetingInterfaceBuilder ? [CALayer layer] : [MGLOpenGLLayer layer];
// Notify map object when network reachability status changes.
- MGLReachability *reachability = [MGLReachability reachabilityForInternetConnection];
- reachability.reachableBlock = ^(MGLReachability *) {
+ _reachability = [MGLReachability reachabilityForInternetConnection];
+ _reachability.reachableBlock = ^(MGLReachability *) {
mbgl::NetworkStatus::Reachable();
};
- [reachability startNotifier];
+ [_reachability startNotifier];
// Install ornaments and gesture recognizers.
[self installZoomControls];
@@ -432,7 +434,7 @@ public:
}
attributionView.subviews = @[];
[attributionView removeConstraints:attributionView.constraints];
-
+
// Make the whole string mini by default.
// Force links to be black, because the default blue is distracting.
CGFloat miniSize = [NSFont systemFontSizeForControlSize:NSMiniControlSize];
@@ -442,7 +444,7 @@ public:
if (info.feedbackLink) {
continue;
}
-
+
// For each attribution, add a borderless button that responds to clicks
// and feels like a hyperlink.
NSButton *button = [[MGLAttributionButton alloc] initWithAttributionInfo:info];
@@ -479,7 +481,7 @@ public:
multiplier:1
constant:0]];
}
-
+
if (attributionInfos.count) {
[attributionView addConstraint:
[NSLayoutConstraint constraintWithItem:attributionView
@@ -493,6 +495,10 @@ public:
}
- (void)dealloc {
+
+ [_reachability stopNotifier];
+
+
[self.window removeObserver:self forKeyPath:@"contentLayoutRect"];
[self.window removeObserver:self forKeyPath:@"titlebarAppearsTransparent"];
@@ -511,10 +517,6 @@ public:
delete _mbglView;
_mbglView = nullptr;
}
- if (_mbglThreadPool) {
- delete _mbglThreadPool;
- _mbglThreadPool = nullptr;
- }
}
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(__unused NSDictionary *)change context:(void *)context {
@@ -611,16 +613,17 @@ public:
if (_isTargetingInterfaceBuilder) {
return;
}
-
+
// Default to Streets.
if (!styleURL) {
- // An access token is required to load any default style, including
- // Streets.
- if (![MGLAccountManager accessToken]) {
- return;
- }
styleURL = [MGLStyle streetsStyleURLWithVersion:MGLStyleDefaultVersion];
}
+
+ // An access token is required to load any default style, including Streets.
+ if (![MGLAccountManager accessToken] && [styleURL.scheme isEqualToString:@"mapbox"]) {
+ NSLog(@"Cannot set the style URL to %@ because no access token has been specified.", styleURL);
+ return;
+ }
styleURL = styleURL.mgl_URLByStandardizingScheme;
self.style = nil;
@@ -787,9 +790,7 @@ public:
if (_isPrinting) {
_isPrinting = NO;
- std::string png = encodePNG(_mbglView->readStillImage());
- NSData *data = [[NSData alloc] initWithBytes:png.data() length:png.size()];
- NSImage *image = [[NSImage alloc] initWithData:data];
+ NSImage *image = [[NSImage alloc] initWithMGLPremultipliedImage:_mbglView->readStillImage()];
[self performSelector:@selector(printWithImage:) withObject:image afterDelay:0];
}
@@ -986,8 +987,13 @@ public:
- (void)offsetCenterCoordinateBy:(NSPoint)delta animated:(BOOL)animated {
[self willChangeValueForKey:@"centerCoordinate"];
_mbglMap->cancelTransitions();
+ MGLMapCamera *oldCamera = self.camera;
_mbglMap->moveBy({ delta.x, delta.y },
MGLDurationInSecondsFromTimeInterval(animated ? MGLAnimationDuration : 0));
+ if ([self.delegate respondsToSelector:@selector(mapView:shouldChangeFromCamera:toCamera:)]
+ && ![self.delegate mapView:self shouldChangeFromCamera:oldCamera toCamera:self.camera]) {
+ self.camera = oldCamera;
+ }
[self didChangeValueForKey:@"centerCoordinate"];
}
@@ -1028,14 +1034,34 @@ public:
}
- (void)zoomBy:(double)zoomDelta animated:(BOOL)animated {
- [self setZoomLevel:self.zoomLevel + zoomDelta animated:animated];
+ [self setZoomLevel:round(self.zoomLevel) + zoomDelta animated:animated];
+}
+
+- (void)zoomBy:(double)zoomDelta atPoint:(NSPoint)point animated:(BOOL)animated {
+ [self willChangeValueForKey:@"centerCoordinate"];
+ [self willChangeValueForKey:@"zoomLevel"];
+ 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));
+ if ([self.delegate respondsToSelector:@selector(mapView:shouldChangeFromCamera:toCamera:)]
+ && ![self.delegate mapView:self shouldChangeFromCamera:oldCamera toCamera:self.camera]) {
+ self.camera = oldCamera;
+ }
+ [self didChangeValueForKey:@"zoomLevel"];
+ [self didChangeValueForKey:@"centerCoordinate"];
}
- (void)scaleBy:(double)scaleFactor atPoint:(NSPoint)point animated:(BOOL)animated {
[self willChangeValueForKey:@"centerCoordinate"];
[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));
+ if ([self.delegate respondsToSelector:@selector(mapView:shouldChangeFromCamera:toCamera:)]
+ && ![self.delegate mapView:self shouldChangeFromCamera:oldCamera toCamera:self.camera]) {
+ self.camera = oldCamera;
+ }
[self didChangeValueForKey:@"zoomLevel"];
[self didChangeValueForKey:@"centerCoordinate"];
}
@@ -1118,12 +1144,6 @@ public:
}
- (void)setCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration animationTimingFunction:(nullable CAMediaTimingFunction *)function completionHandler:(nullable void (^)(void))completion {
- _mbglMap->cancelTransitions();
- if ([self.camera isEqual:camera]) {
- return;
- }
-
- mbgl::CameraOptions cameraOptions = [self cameraOptionsObjectForAnimatingToCamera:camera];
mbgl::AnimationOptions animationOptions;
if (duration > 0) {
animationOptions.duration.emplace(MGLDurationInSecondsFromTimeInterval(duration));
@@ -1139,8 +1159,19 @@ public:
});
};
}
+
+ if ([self.camera isEqualToMapCamera:camera]) {
+ if (completion) {
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+ completion();
+ });
+ }
+ return;
+ }
[self willChangeValueForKey:@"camera"];
+ _mbglMap->cancelTransitions();
+ mbgl::CameraOptions cameraOptions = [self cameraOptionsObjectForAnimatingToCamera:camera];
_mbglMap->easeTo(cameraOptions, animationOptions);
[self didChangeValueForKey:@"camera"];
}
@@ -1154,12 +1185,6 @@ public:
}
- (void)flyToCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration peakAltitude:(CLLocationDistance)peakAltitude completionHandler:(nullable void (^)(void))completion {
- _mbglMap->cancelTransitions();
- if ([self.camera isEqual:camera]) {
- return;
- }
-
- mbgl::CameraOptions cameraOptions = [self cameraOptionsObjectForAnimatingToCamera:camera];
mbgl::AnimationOptions animationOptions;
if (duration >= 0) {
animationOptions.duration = MGLDurationInSecondsFromTimeInterval(duration);
@@ -1180,8 +1205,19 @@ public:
});
};
}
+
+ if ([self.camera isEqualToMapCamera:camera]) {
+ if (completion) {
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+ completion();
+ });
+ }
+ return;
+ }
[self willChangeValueForKey:@"camera"];
+ _mbglMap->cancelTransitions();
+ mbgl::CameraOptions cameraOptions = [self cameraOptionsObjectForAnimatingToCamera:camera];
_mbglMap->flyTo(cameraOptions, animationOptions);
[self didChangeValueForKey:@"camera"];
}
@@ -1230,6 +1266,11 @@ public:
if (animated) {
animationOptions.duration = MGLDurationInSecondsFromTimeInterval(MGLAnimationDuration);
}
+
+ MGLMapCamera *camera = [self cameraForCameraOptions:cameraOptions];
+ if ([self.camera isEqualToMapCamera:camera]) {
+ return;
+ }
[self willChangeValueForKey:@"visibleCoordinateBounds"];
animationOptions.transitionFinishFn = ^() {
@@ -1252,7 +1293,7 @@ public:
- (MGLMapCamera *)cameraForCameraOptions:(const mbgl::CameraOptions &)cameraOptions {
CLLocationCoordinate2D centerCoordinate = MGLLocationCoordinate2DFromLatLng(cameraOptions.center ? *cameraOptions.center : _mbglMap->getLatLng());
double zoomLevel = cameraOptions.zoom ? *cameraOptions.zoom : self.zoomLevel;
- CLLocationDirection direction = cameraOptions.angle ? -MGLDegreesFromRadians(*cameraOptions.angle) : self.direction;
+ CLLocationDirection direction = cameraOptions.angle ? mbgl::util::wrap(-MGLDegreesFromRadians(*cameraOptions.angle), 0., 360.) : self.direction;
CGFloat pitch = cameraOptions.pitch ? MGLDegreesFromRadians(*cameraOptions.pitch) : _mbglMap->getPitch();
CLLocationDistance altitude = MGLAltitudeForZoomLevel(zoomLevel, pitch,
centerCoordinate.latitude,
@@ -1342,7 +1383,7 @@ public:
// the illusion that it has stayed in place during the entire gesture.
CGPoint cursorPoint = [self convertPoint:startPoint toView:nil];
cursorPoint = [self.window convertRectToScreen:{ startPoint, NSZeroSize }].origin;
- cursorPoint.y = [NSScreen mainScreen].frame.size.height - cursorPoint.y;
+ cursorPoint.y = self.window.screen.frame.size.height - cursorPoint.y;
CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, cursorPoint);
CGDisplayShowCursor(kCGDirectMainDisplay);
}
@@ -1370,15 +1411,25 @@ public:
_directionAtBeginningOfGesture = self.direction;
_pitchAtBeginningOfGesture = _mbglMap->getPitch();
} else if (gestureRecognizer.state == NSGestureRecognizerStateChanged) {
+ MGLMapCamera *oldCamera = self.camera;
+ BOOL didChangeCamera = NO;
mbgl::ScreenCoordinate center(startPoint.x, self.bounds.size.height - startPoint.y);
if (self.rotateEnabled) {
CLLocationDirection newDirection = _directionAtBeginningOfGesture - delta.x / 10;
[self willChangeValueForKey:@"direction"];
_mbglMap->setBearing(newDirection, center);
+ didChangeCamera = YES;
[self didChangeValueForKey:@"direction"];
}
if (self.pitchEnabled) {
_mbglMap->setPitch(_pitchAtBeginningOfGesture + delta.y / 5, center);
+ didChangeCamera = YES;
+ }
+
+ if (didChangeCamera
+ && [self.delegate respondsToSelector:@selector(mapView:shouldChangeFromCamera:toCamera:)]
+ && ![self.delegate mapView:self shouldChangeFromCamera:oldCamera toCamera:self.camera]) {
+ self.camera = oldCamera;
}
}
} else if (self.scrollEnabled) {
@@ -1418,7 +1469,12 @@ public:
if (gestureRecognizer.magnification > -1) {
[self willChangeValueForKey:@"zoomLevel"];
[self willChangeValueForKey:@"centerCoordinate"];
+ MGLMapCamera *oldCamera = self.camera;
_mbglMap->setScale(_scaleAtBeginningOfGesture * (1 + gestureRecognizer.magnification), center);
+ if ([self.delegate respondsToSelector:@selector(mapView:shouldChangeFromCamera:toCamera:)]
+ && ![self.delegate mapView:self shouldChangeFromCamera:oldCamera toCamera:self.camera]) {
+ self.camera = oldCamera;
+ }
[self didChangeValueForKey:@"centerCoordinate"];
[self didChangeValueForKey:@"zoomLevel"];
}
@@ -1466,7 +1522,7 @@ public:
_mbglMap->cancelTransitions();
NSPoint gesturePoint = [gestureRecognizer locationInView:self];
- [self scaleBy:2 atPoint:gesturePoint animated:YES];
+ [self zoomBy:1 atPoint:gesturePoint animated:YES];
}
- (void)smartMagnifyWithEvent:(NSEvent *)event {
@@ -1478,7 +1534,7 @@ public:
// Tap with two fingers (“right-click”) to zoom out on mice but not trackpads.
NSPoint gesturePoint = [self convertPoint:event.locationInWindow fromView:nil];
- [self scaleBy:0.5 atPoint:gesturePoint animated:YES];
+ [self zoomBy:-1 atPoint:gesturePoint animated:YES];
}
/// Rotate fingers to rotate.
@@ -1493,9 +1549,16 @@ public:
_mbglMap->setGestureInProgress(true);
_directionAtBeginningOfGesture = self.direction;
} else if (gestureRecognizer.state == NSGestureRecognizerStateChanged) {
+ MGLMapCamera *oldCamera = self.camera;
+
NSPoint rotationPoint = [gestureRecognizer locationInView:self];
mbgl::ScreenCoordinate center(rotationPoint.x, self.bounds.size.height - rotationPoint.y);
_mbglMap->setBearing(_directionAtBeginningOfGesture + gestureRecognizer.rotationInDegrees, center);
+
+ if ([self.delegate respondsToSelector:@selector(mapView:shouldChangeFromCamera:toCamera:)]
+ && ![self.delegate mapView:self shouldChangeFromCamera:oldCamera toCamera:self.camera]) {
+ self.camera = oldCamera;
+ }
} else if (gestureRecognizer.state == NSGestureRecognizerStateEnded
|| gestureRecognizer.state == NSGestureRecognizerStateCancelled) {
_mbglMap->setGestureInProgress(false);
@@ -1577,13 +1640,40 @@ public:
#pragma mark Keyboard events
- (void)keyDown:(NSEvent *)event {
- if (event.modifierFlags & NSNumericPadKeyMask) {
- // This is the recommended way to handle arrow key presses, causing
- // methods like -moveUp: and -moveToBeginningOfParagraph: to be called
- // for various standard keybindings.
- [self interpretKeyEvents:@[event]];
- } else {
- [super keyDown:event];
+ // This is the recommended way to handle arrow key presses, causing
+ // methods like -moveUp: and -moveToBeginningOfParagraph: to be called
+ // for various standard keybindings.
+ [self interpretKeyEvents:@[event]];
+}
+
+// The following action methods are declared in NSResponder.h.
+
+- (void)insertTab:(id)sender {
+ if (self.window.firstResponder == self) {
+ [self.window selectNextKeyView:self];
+ }
+}
+
+- (void)insertBacktab:(id)sender {
+ if (self.window.firstResponder == self) {
+ [self.window selectPreviousKeyView:self];
+ }
+}
+
+- (void)insertText:(NSString *)insertString {
+ switch (insertString.length == 1 ? [insertString characterAtIndex:0] : 0) {
+ case '-':
+ [self moveToEndOfParagraph:nil];
+ break;
+
+ case '+':
+ case '=':
+ [self moveToBeginningOfParagraph:nil];
+ break;
+
+ default:
+ [super insertText:insertString];
+ break;
}
}
@@ -1704,12 +1794,12 @@ public:
{
return nil;
}
-
+
std::vector<MGLAnnotationTag> annotationTags = [self annotationTagsInRect:rect];
if (annotationTags.size())
{
NSMutableArray *annotations = [NSMutableArray arrayWithCapacity:annotationTags.size()];
-
+
for (auto const& annotationTag: annotationTags)
{
if (!_annotationContextsByAnnotationTag.count(annotationTag))
@@ -1719,10 +1809,10 @@ public:
MGLAnnotationContext annotationContext = _annotationContextsByAnnotationTag.at(annotationTag);
[annotations addObject:annotationContext.annotation];
}
-
+
return [annotations copy];
}
-
+
return nil;
}
@@ -1827,7 +1917,7 @@ public:
}
// Opt into potentially expensive tooltip tracking areas.
- if (annotation.toolTip.length) {
+ if ([annotation respondsToSelector:@selector(toolTip)] && annotation.toolTip.length) {
_wantsToolTipRects = YES;
}
}
@@ -2362,7 +2452,7 @@ public:
for (MGLAnnotationTag annotationTag : annotationTags) {
MGLAnnotationImage *annotationImage = [self imageOfAnnotationWithTag:annotationTag];
id <MGLAnnotation> annotation = [self annotationWithTag:annotationTag];
- if (annotation.toolTip.length) {
+ if ([annotation respondsToSelector:@selector(toolTip)] && annotation.toolTip.length) {
// Add a tooltip tracking area over the annotation image’s
// frame, accounting for the image’s alignment rect.
NSImage *image = annotationImage.image;
diff --git a/platform/macos/src/MGLMapViewDelegate.h b/platform/macos/src/MGLMapViewDelegate.h
index 1cf86263f3..08a9f7eff4 100644
--- a/platform/macos/src/MGLMapViewDelegate.h
+++ b/platform/macos/src/MGLMapViewDelegate.h
@@ -26,10 +26,10 @@ NS_ASSUME_NONNULL_BEGIN
/**
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.
*/
@@ -37,14 +37,14 @@ NS_ASSUME_NONNULL_BEGIN
/**
Tells the delegate that the viewpoint depicted by the map view is changing.
-
+
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.
-
+
@param mapView The map view whose viewpoint is changing.
*/
- (void)mapViewCameraIsChanging:(MGLMapView *)mapView;
@@ -52,33 +52,55 @@ NS_ASSUME_NONNULL_BEGIN
/**
Tells the delegate that the viewpoint depicted by the map view has finished
changing.
-
+
This method is called whenever the currently displayed map camera has finished
changing, after any calls to `-mapViewRegionIsChanging:` due to animation.
-
+
@param mapView The map view whose viewpoint has changed.
@param animated Whether the change caused an animated effect on the map.
*/
- (void)mapView:(MGLMapView *)mapView cameraDidChangeAnimated:(BOOL)animated;
+/**
+ Asks the delegate whether the map view should be allowed to change from the
+ existing camera to the new camera in response to a user gesture.
+
+ This method is called as soon as the user gesture is recognized. It is not
+ called in response to a programmatic camera change, such as by setting the
+ `centerCoordinate` property or calling `-flyToCamera:completionHandler:`.
+
+ This method is called many times during gesturing, so you should avoid performing
+ complex or performance-intensive tasks in your implementation.
+
+ @param mapView The map view that the user is manipulating.
+ @param oldCamera The camera representing the viewpoint at the moment the
+ gesture is recognized. If this method returns `NO`, the map view’s camera
+ continues to be this camera.
+ @param newCamera The expected camera after the gesture completes. If this
+ method returns `YES`, this camera becomes the map view’s camera.
+ @return A Boolean value indicating whether the map view should stay at
+ `oldCamera` or change to `newCamera`.
+ */
+- (BOOL)mapView:(MGLMapView *)mapView shouldChangeFromCamera:(MGLMapCamera *)oldCamera toCamera:(MGLMapCamera *)newCamera;
+
#pragma mark Loading the Map
/**
Tells the delegate that the map view will begin to load.
-
+
This method is called whenever the map view starts loading, including when a
new style has been set and the map must reload.
-
+
@param mapView The map view that is starting to load.
*/
- (void)mapViewWillStartLoadingMap:(MGLMapView *)mapView;
/**
Tells the delegate that the map view has finished loading.
-
+
This method is called whenever the map view finishes loading, either after the
initial load or after a style change has forced a reload.
-
+
@param mapView The map view that has finished loading.
*/
- (void)mapViewDidFinishLoadingMap:(MGLMapView *)mapView;
@@ -86,11 +108,11 @@ NS_ASSUME_NONNULL_BEGIN
/**
Tells the delegate that the map view was unable to load data needed for
displaying the map.
-
+
This method may be called for a variety of reasons, including a network
connection failure or a failure to fetch the style from the server. You can use
the given error message to notify the user that map data is unavailable.
-
+
@param mapView The map view that is unable to load the data.
@param error The reason the data could not be loaded.
*/
@@ -101,26 +123,26 @@ NS_ASSUME_NONNULL_BEGIN
/**
Tells the delegate that the map view is about to redraw.
-
+
This method is called any time the map view needs to redraw due to a change in
the viewpoint or style property transition. This method may be called very
frequently, even moreso than `-mapViewRegionIsChanging:`. Therefore, your
implementation of this method should be as lightweight as possible to avoid
affecting performance.
-
+
@param mapView The map view that is about to redraw.
*/
- (void)mapViewWillStartRenderingFrame:(MGLMapView *)mapView;
/**
Tells the delegate that the map view has just redrawn.
-
+
This method is called any time the map view needs to redraw due to a change in
the viewpoint or style property transition. This method may be called very
frequently, even moreso than `-mapViewRegionIsChanging:`. Therefore, your
implementation of this method should be as lightweight as possible to avoid
affecting performance.
-
+
@param mapView The map view that has just redrawn.
*/
- (void)mapViewDidFinishRenderingFrame:(MGLMapView *)mapView fullyRendered:(BOOL)fullyRendered;
@@ -147,7 +169,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
Returns an annotation image object to mark the given point annotation object on
the map.
-
+
@param mapView The map view that requested the annotation image.
@param annotation The object representing the annotation that is about to be
displayed.
@@ -161,7 +183,7 @@ NS_ASSUME_NONNULL_BEGIN
A value of 0.0 results in a completely transparent shape. A value of 1.0, the
default, results in a completely opaque shape.
-
+
This method sets the opacity of an entire shape, inclusive of its stroke and
fill. To independently set the values for stroke or fill, specify an alpha
component in the color returned by `-mapView:strokeColorForShapeAnnotation:` or
@@ -175,13 +197,13 @@ NS_ASSUME_NONNULL_BEGIN
/**
Returns the color to use when rendering the outline of a shape annotation.
-
+
The default stroke color is the selected menu item color. If a pattern color is
specified, the result is undefined.
-
+
Opacity may be set by specifying an alpha component. The default alpha value is
`1.0` and results in a completely opaque stroke.
-
+
@param mapView The map view rendering the shape annotation.
@param annotation The annotation being rendered.
@return A color to use for the shape outline.
@@ -190,13 +212,13 @@ NS_ASSUME_NONNULL_BEGIN
/**
Returns the color to use when rendering the fill of a polygon annotation.
-
+
The default fill color is the selected menu item color. If a pattern color is
specified, the result is undefined.
-
+
Opacity may be set by specifying an alpha component. The default alpha value is
`1.0` and results in a completely opaque shape.
-
+
@param mapView The map view rendering the polygon annotation.
@param annotation The annotation being rendered.
@return The polygon’s interior fill color.
@@ -206,9 +228,9 @@ NS_ASSUME_NONNULL_BEGIN
/**
Returns the line width in points to use when rendering the outline of a
polyline annotation.
-
+
By default, the polyline is outlined with a line 3.0 points wide.
-
+
@param mapView The map view rendering the polygon annotation.
@param annotation The annotation being rendered.
@return A line width for the polyline, measured in points.
@@ -219,9 +241,9 @@ NS_ASSUME_NONNULL_BEGIN
/**
Tells the delegate that one of its annotations has been selected.
-
+
You can use this method to track changes to the selection state of annotations.
-
+
@param mapView The map view containing the annotation.
@param annotation The annotation that was selected.
*/
@@ -229,9 +251,9 @@ NS_ASSUME_NONNULL_BEGIN
/**
Tells the delegate that one of its annotations has been deselected.
-
+
You can use this method to track changes in the selection state of annotations.
-
+
@param mapView The map view containing the annotation.
@param annotation The annotation that was deselected.
*/
@@ -242,19 +264,19 @@ NS_ASSUME_NONNULL_BEGIN
/**
Returns a Boolean value indicating whether the annotation is able to display
extra information in a callout popover.
-
+
This method is called after an annotation is selected, before any callout is
displayed for the annotation.
-
+
If the return value is `YES`, a callout popover is shown when the user clicks
on an annotation, selecting it. The default callout displays the annotation’s
title and subtitle. You can customize the popover’s contents by implementing
the `-mapView:calloutViewControllerForAnnotation:` method.
-
+
If the return value is `NO`, or if this method is absent from the delegate, or
if the annotation lacks a title, the annotation will not show a callout even
when selected.
-
+
@param mapView The map view that has selected the annotation.
@param annotation The object representing the annotation.
@return A Boolean value indicating whether the annotation should show a
@@ -264,16 +286,16 @@ NS_ASSUME_NONNULL_BEGIN
/**
Returns a view controller to manage the callout popover’s content view.
-
+
Like any instance of `NSPopover`, an annotation callout manages its contents
with a view controller. The annotation object is the view controller’s
represented object. This means that you can bind controls in the view
controller’s content view to KVO-compliant properties of the annotation object,
such as `title` and `subtitle`.
-
+
If each annotation should have an identical callout, you can set the
`MGLMapView.calloutViewController` property instead.
-
+
@param mapView The map view that is requesting a callout view controller.
@param annotation The object representing the annotation.
@return A view controller for the given annotation.
diff --git a/platform/macos/src/MGLOpenGLLayer.mm b/platform/macos/src/MGLOpenGLLayer.mm
index 296e30179b..fde2b52404 100644
--- a/platform/macos/src/MGLOpenGLLayer.mm
+++ b/platform/macos/src/MGLOpenGLLayer.mm
@@ -2,15 +2,17 @@
#import "MGLMapView_Private.h"
-@implementation MGLOpenGLLayer
+@implementation MGLOpenGLLayer {
+ NSOpenGLContext *_context;
+}
- (MGLMapView *)mapView {
return (MGLMapView *)super.view;
}
-//- (BOOL)isAsynchronous {
+// - (BOOL)isAsynchronous {
// return YES;
-//}
+// }
- (BOOL)needsDisplayOnBoundsChange {
return YES;
@@ -20,8 +22,16 @@
return self.view.bounds;
}
+- (NSOpenGLContext *)openGLContextForPixelFormat:(NSOpenGLPixelFormat *)pixelFormat {
+ if (!_context) {
+ _context = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:nil];
+ }
+ return _context;
+}
+
- (NSOpenGLPixelFormat *)openGLPixelFormatForDisplayMask:(uint32_t)mask {
NSOpenGLPixelFormatAttribute pfas[] = {
+ NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersionLegacy,
NSOpenGLPFAAccelerated,
NSOpenGLPFAClosestPolicy,
NSOpenGLPFAAccumSize, 32,
@@ -30,6 +40,7 @@
NSOpenGLPFADepthSize, 16,
NSOpenGLPFAStencilSize, 8,
NSOpenGLPFAScreenMask, mask,
+ NSOpenGLPFAAllowOfflineRenderers, // Allows using the integrated GPU
0
};
return [[NSOpenGLPixelFormat alloc] initWithAttributes:pfas];
diff --git a/platform/macos/src/Mapbox.h b/platform/macos/src/Mapbox.h
index 80fa1cfe31..6f1bdd22bf 100644
--- a/platform/macos/src/Mapbox.h
+++ b/platform/macos/src/Mapbox.h
@@ -14,6 +14,7 @@ FOUNDATION_EXPORT MGL_EXPORT const unsigned char MapboxVersionString[];
#import "MGLClockDirectionFormatter.h"
#import "MGLCompassDirectionFormatter.h"
#import "MGLCoordinateFormatter.h"
+#import "MGLDistanceFormatter.h"
#import "MGLFeature.h"
#import "MGLGeometry.h"
#import "MGLMapCamera.h"
diff --git a/platform/macos/src/NSColor+MGLAdditions.mm b/platform/macos/src/NSColor+MGLAdditions.mm
index 2a55af5cad..5288f2bc61 100644
--- a/platform/macos/src/NSColor+MGLAdditions.mm
+++ b/platform/macos/src/NSColor+MGLAdditions.mm
@@ -5,9 +5,9 @@
- (mbgl::Color)mgl_color
{
CGFloat r, g, b, a;
-
+
[[self colorUsingColorSpaceName:NSCalibratedRGBColorSpace] getRed:&r green:&g blue:&b alpha:&a];
-
+
return { (float)r, (float)g, (float)b, (float)a };
}
diff --git a/platform/macos/src/NSImage+MGLAdditions.h b/platform/macos/src/NSImage+MGLAdditions.h
index ee01a763a3..c6a80e372d 100644
--- a/platform/macos/src/NSImage+MGLAdditions.h
+++ b/platform/macos/src/NSImage+MGLAdditions.h
@@ -6,6 +6,8 @@ NS_ASSUME_NONNULL_BEGIN
@interface NSImage (MGLAdditions)
+- (nullable instancetype)initWithMGLPremultipliedImage:(mbgl::PremultipliedImage&&)image;
+
- (nullable instancetype)initWithMGLSpriteImage:(const mbgl::SpriteImage *)spriteImage;
- (std::unique_ptr<mbgl::SpriteImage>)mgl_spriteImage;
diff --git a/platform/macos/src/NSImage+MGLAdditions.mm b/platform/macos/src/NSImage+MGLAdditions.mm
index 9c30d3c37b..397e291431 100644
--- a/platform/macos/src/NSImage+MGLAdditions.mm
+++ b/platform/macos/src/NSImage+MGLAdditions.mm
@@ -1,11 +1,28 @@
#import "NSImage+MGLAdditions.h"
+#include <mbgl/util/image+MGLAdditions.hpp>
+
@implementation NSImage (MGLAdditions)
+- (nullable instancetype)initWithMGLPremultipliedImage:(mbgl::PremultipliedImage&&)src {
+ CGImageRef image = CGImageFromMGLPremultipliedImage(std::move(src));
+ if (!image) {
+ return nil;
+ }
+
+ self = [self initWithCGImage:image size:NSZeroSize];
+ CGImageRelease(image);
+ return self;
+}
+
- (nullable instancetype)initWithMGLSpriteImage:(const mbgl::SpriteImage *)spriteImage {
- std::string png = encodePNG(spriteImage->image);
- NSData *data = [[NSData alloc] initWithBytes:png.data() length:png.size()];
- NSBitmapImageRep *rep = [NSBitmapImageRep imageRepWithData:data];
+ CGImageRef image = CGImageFromMGLPremultipliedImage(spriteImage->image.clone());
+ if (!image) {
+ return nil;
+ }
+
+ NSBitmapImageRep *rep = [[NSBitmapImageRep alloc] initWithCGImage:image];
+ CGImageRelease(image);
if (self = [self initWithSize:NSMakeSize(spriteImage->getWidth(), spriteImage->getHeight())]) {
[self addRepresentation:rep];
[self setTemplate:spriteImage->sdf];
diff --git a/platform/macos/test/MGLAttributionButtonTests.m b/platform/macos/test/MGLAttributionButtonTests.m
index f5c0aac856..b41de95317 100644
--- a/platform/macos/test/MGLAttributionButtonTests.m
+++ b/platform/macos/test/MGLAttributionButtonTests.m
@@ -16,12 +16,12 @@
}];
MGLAttributionInfo *info = [[MGLAttributionInfo alloc] initWithTitle:title URL:nil];
MGLAttributionButton *button = [[MGLAttributionButton alloc] initWithAttributionInfo:info];
-
+
NSRange symbolUnderlineRange;
NSNumber *symbolUnderline = [button.attributedTitle attribute:NSUnderlineStyleAttributeName atIndex:0 effectiveRange:&symbolUnderlineRange];
XCTAssertNil(symbolUnderline);
XCTAssertEqual(symbolUnderlineRange.length, 6);
-
+
NSRange wordUnderlineRange;
NSNumber *wordUnderline = [button.attributedTitle attribute:NSUnderlineStyleAttributeName atIndex:6 effectiveRange:&wordUnderlineRange];
XCTAssertEqualObjects(wordUnderline, @(NSUnderlineStyleSingle));