summaryrefslogtreecommitdiff
path: root/platform/macos
diff options
context:
space:
mode:
authorWilhelm Berg <wb@BergWerk-GIS.at>2018-08-22 16:56:32 +0200
committerWilhelm Berg <wb@BergWerk-GIS.at>2018-08-22 16:56:32 +0200
commit797f622a26b34db5a30e7f1728d87c6700a2ec1e (patch)
tree75ea93979db2baf3eb2234c6fbb3d1a9c5b70329 /platform/macos
parent86fc3f525e42d042f239876b93525ff411ad7182 (diff)
parent520df7f02049cdbbb9e68041e755d6c3a8d5b21f (diff)
downloadqtlocation-mapboxgl-797f622a26b34db5a30e7f1728d87c6700a2ec1e.tar.gz
Merge branch 'master' of github.com:mapbox/mapbox-gl-native into bwg-vs2017
Diffstat (limited to 'platform/macos')
-rw-r--r--platform/macos/CHANGELOG.md16
-rw-r--r--platform/macos/Mapbox-macOS-SDK-symbols.podspec2
-rw-r--r--platform/macos/Mapbox-macOS-SDK.podspec2
-rw-r--r--platform/macos/app/AppDelegate.h2
-rw-r--r--platform/macos/app/AppDelegate.m26
-rw-r--r--platform/macos/app/Base.lproj/MapDocument.xib185
-rw-r--r--platform/macos/app/MapDocument.m68
-rw-r--r--platform/macos/docs/guides/For Style Authors.md1
-rw-r--r--platform/macos/docs/guides/Migrating to Expressions.md4
-rw-r--r--platform/macos/docs/pod-README.md2
-rw-r--r--platform/macos/jazzy.yml2
-rw-r--r--platform/macos/macos.xcodeproj/project.pbxproj20
-rw-r--r--platform/macos/src/MGLMapView+IBAdditions.mm4
-rw-r--r--platform/macos/src/MGLMapView.mm6
-rw-r--r--platform/macos/src/MGLMapViewDelegate.h12
-rw-r--r--platform/macos/src/Mapbox.h1
-rw-r--r--platform/macos/test/MGLMapViewDelegateIntegrationTests.swift2
17 files changed, 314 insertions, 41 deletions
diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md
index 001b3792d5..d8a0067ad6 100644
--- a/platform/macos/CHANGELOG.md
+++ b/platform/macos/CHANGELOG.md
@@ -2,10 +2,26 @@
# master
+* When a symbol in an `MGLSymbolStyleLayer` has both an icon and text, both are shown or hidden together based on available space. ([#12521](https://github.com/mapbox/mapbox-gl-native/pull/12521))
+* The `-[MGLMapView annotationAtPoint:]` method can now return annotations near tile boundaries at high zoom levels. ([#12570](https://github.com/mapbox/mapbox-gl-native/pull/12570))
+* Fixed inconsistencies in exception naming. ([#12583](https://github.com/mapbox/mapbox-gl-native/issues/12583))
+* Added `MGLShapeOfflineRegion` for defining arbitrarily shaped offline regions [#11447](https://github.com/mapbox/mapbox-gl-native/pull/11447)
+* Added an `-[MGLMapViewDelegate mapView:shapeAnnotationIsEnabled:]` method to specify whether an annotation is selectable. ([#12352](https://github.com/mapbox/mapbox-gl-native/pull/12352))
+
+# 0.10.0 - August 15, 2018
+
## Styles and rendering
* Token string syntax (`"{token}"`) in `MGLSymbolStyleLayer` `text` and `iconImageName` properties is now correctly converted to the appropriate `NSExpression` equivalent. ([#11659](https://github.com/mapbox/mapbox-gl-native/issues/11659))
* Fixed a crash when switching between two styles having layers with the same identifier but different layer types. ([#12432](https://github.com/mapbox/mapbox-gl-native/issues/12432))
+* Added a new option to `MGLSymbolPlacement`, `MGLSymbolPlacementLineCenter`, that places the label relative to the center of the geometry. ([#12337](https://github.com/mapbox/mapbox-gl-native/pull/12337))
+* Added a `MGLShapeSourceOptionLineDistanceMetrics` property that enables or disables calculating line distance metrics.
+
+## Other changes
+
+* Fixed an issue where the symbols for `MGLMapPointForCoordinate` could not be found. ([#12445](https://github.com/mapbox/mapbox-gl-native/issues/12445))
+* Fixed an issue causing country and ocean labels to disappear after calling `-[MGLStyle localizeLabelsIntoLocale:]` when the system language is set to Simplified Chinese. ([#12164](https://github.com/mapbox/mapbox-gl-native/issues/12164))
+* Closed a security vulnerability introduced in 0.8.0 that would potentially allow the owner of a style to compromise apps loading that style. ([#12571](https://github.com/mapbox/mapbox-gl-native/pull/12571))
# 0.9.0 - July 18, 2018
diff --git a/platform/macos/Mapbox-macOS-SDK-symbols.podspec b/platform/macos/Mapbox-macOS-SDK-symbols.podspec
index 58f4bad09b..7ab9aa4de2 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.8.0'
+ version = '0.10.0'
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 6af7cb001f..756f3828b6 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.8.0'
+ version = '0.10.0'
m.name = 'Mapbox-macOS-SDK'
m.version = version
diff --git a/platform/macos/app/AppDelegate.h b/platform/macos/app/AppDelegate.h
index a1d9297b2f..87b7514292 100644
--- a/platform/macos/app/AppDelegate.h
+++ b/platform/macos/app/AppDelegate.h
@@ -21,4 +21,6 @@ extern NSString * const MGLMapboxAccessTokenDefaultsKey;
@property (copy) NSURL *pendingStyleURL;
@property (assign) MGLMapDebugMaskOptions pendingDebugMask;
+- (void)watchOfflinePack:(MGLOfflinePack *)pack;
+
@end
diff --git a/platform/macos/app/AppDelegate.m b/platform/macos/app/AppDelegate.m
index f7b35d0c83..eda989d7f9 100644
--- a/platform/macos/app/AppDelegate.m
+++ b/platform/macos/app/AppDelegate.m
@@ -135,6 +135,8 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask";
}
- (void)applicationWillTerminate:(NSNotification *)notification {
+ [[NSNotificationCenter defaultCenter] removeObserver:self name:nil object:nil];
+
if (![[NSUserDefaults standardUserDefaults] boolForKey:@"NSQuitAlwaysKeepsWindows"]) {
NSDocument *currentDocument = [NSDocumentController sharedDocumentController].currentDocument;
if ([currentDocument isKindOfClass:[MapDocument class]]) {
@@ -204,6 +206,7 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask";
- (IBAction)delete:(id)sender {
for (MGLOfflinePack *pack in self.offlinePacksArrayController.selectedObjects) {
+ [self unwatchOfflinePack:pack];
[[MGLOfflineStorage sharedOfflineStorage] removePack:pack withCompletionHandler:^(NSError * _Nullable error) {
if (error) {
[[NSAlert alertWithError:error] runModal];
@@ -228,11 +231,13 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask";
}
case MGLOfflinePackStateInactive:
+ [self watchOfflinePack:pack];
[pack resume];
break;
case MGLOfflinePackStateActive:
[pack suspend];
+ [self unwatchOfflinePack:pack];
break;
default:
@@ -241,6 +246,27 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask";
}
}
+- (void)watchOfflinePack:(MGLOfflinePack *)pack {
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(offlinePackDidChangeProgress:) name:MGLOfflinePackProgressChangedNotification object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(offlinePackDidReceiveError:) name:MGLOfflinePackErrorNotification object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(offlinePackDidReceiveError:) name:MGLOfflinePackMaximumMapboxTilesReachedNotification object:nil];
+}
+
+- (void)unwatchOfflinePack:(MGLOfflinePack *)pack {
+ [[NSNotificationCenter defaultCenter] removeObserver:self name:nil object:pack];
+}
+
+- (void)offlinePackDidChangeProgress:(NSNotification *)notification {
+ MGLOfflinePack *pack = notification.object;
+ if (pack.state == MGLOfflinePackStateComplete) {
+ [[NSSound soundNamed:@"Glass"] play];
+ }
+}
+
+- (void)offlinePackDidReceiveError:(NSNotification *)notification {
+ [[NSSound soundNamed:@"Basso"] play];
+}
+
#pragma mark Help methods
- (IBAction)showShortcuts:(id)sender {
diff --git a/platform/macos/app/Base.lproj/MapDocument.xib b/platform/macos/app/Base.lproj/MapDocument.xib
index 5d0525a29d..72fa024fcc 100644
--- a/platform/macos/app/Base.lproj/MapDocument.xib
+++ b/platform/macos/app/Base.lproj/MapDocument.xib
@@ -1,15 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13771" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14306.4" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13771"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14306.4"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="MapDocument">
<connections>
+ <outlet property="addOfflinePackWindow" destination="NmZ-Tf-v2O" id="ZPE-9L-vPJ"/>
<outlet property="mapView" destination="q4d-kF-8Hi" id="7hI-dS-A5R"/>
<outlet property="mapViewContextMenu" destination="XbX-6a-Mgy" id="YD0-1r-5N2"/>
+ <outlet property="maximumOfflinePackZoomLevelField" destination="5sj-XD-neD" id="Edu-lU-3j9"/>
+ <outlet property="maximumOfflinePackZoomLevelFormatter" destination="4cD-xh-teT" id="IOh-5e-4FO"/>
+ <outlet property="minimumOfflinePackZoomLevelField" destination="Xo1-tZ-WQ6" id="ETh-er-ReB"/>
+ <outlet property="minimumOfflinePackZoomLevelFormatter" destination="LGN-Et-RKY" id="Klk-iF-fM0"/>
+ <outlet property="offlinePackNameField" destination="tUU-DX-RxU" id="r7P-uL-4qo"/>
<outlet property="splitView" destination="IPR-fm-vk8" id="9xt-ar-uad"/>
<outlet property="styleLayersArrayController" destination="GXW-3J-Gff" id="Ygs-7o-juz"/>
<outlet property="styleLayersTableView" destination="Mm4-6F-qEb" id="TB5-ha-JJE"/>
@@ -57,7 +63,7 @@
<splitView autosaveName="MBXLayersSplitView" dividerStyle="thin" vertical="YES" translatesAutoresizingMaskIntoConstraints="NO" id="IPR-fm-vk8">
<rect key="frame" x="0.0" y="0.0" width="642" height="480"/>
<subviews>
- <scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" id="sMc-vT-RwH">
+ <scrollView misplaced="YES" borderType="none" autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" id="sMc-vT-RwH">
<rect key="frame" x="0.0" y="0.0" width="163" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<clipView key="contentView" id="bSc-hK-bzQ">
@@ -71,7 +77,7 @@
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
- <tableColumn identifier="" editable="NO" width="16" minWidth="16" maxWidth="1000" id="P3U-a3-c8q">
+ <tableColumn editable="NO" width="16" minWidth="16" maxWidth="1000" id="P3U-a3-c8q">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
@@ -88,7 +94,7 @@
</binding>
</connections>
</tableColumn>
- <tableColumn identifier="" editable="NO" width="141" minWidth="40" maxWidth="1000" id="BwD-ww-7uw">
+ <tableColumn editable="NO" width="141" minWidth="40" maxWidth="1000" id="BwD-ww-7uw">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
@@ -133,7 +139,7 @@
<autoresizingMask key="autoresizingMask"/>
</scroller>
</scrollView>
- <customView id="q4d-kF-8Hi" customClass="MGLMapView">
+ <customView misplaced="YES" id="q4d-kF-8Hi" customClass="MGLMapView">
<rect key="frame" x="164" y="0.0" width="478" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<constraints>
@@ -301,8 +307,175 @@
<outlet property="delegate" destination="-2" id="yvb-NB-VGl"/>
</connections>
</menu>
+ <window title="Add Offline Pack" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="NmZ-Tf-v2O">
+ <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
+ <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
+ <rect key="contentRect" x="109" y="131" width="392" height="192"/>
+ <rect key="screenRect" x="0.0" y="0.0" width="1280" height="777"/>
+ <view key="contentView" id="Aqq-bl-feU">
+ <rect key="frame" x="0.0" y="0.0" width="392" height="192"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <subviews>
+ <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Xjw-df-oAz">
+ <rect key="frame" x="98" y="155" width="276" height="17"/>
+ <textFieldCell key="cell" lineBreakMode="clipping" title="Add offline pack" id="Iec-RB-iqn">
+ <font key="font" metaFont="systemBold"/>
+ <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
+ <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="sui-dp-hbb">
+ <rect key="frame" x="98" y="78" width="44" height="17"/>
+ <textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="Name:" id="2El-Zw-T6E">
+ <font key="font" metaFont="system"/>
+ <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
+ <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="D3l-hX-2Dh">
+ <rect key="frame" x="98" y="105" width="276" height="42"/>
+ <textFieldCell key="cell" selectable="YES" title="Mapbox GL will download all the resources needed for viewing the currently visible coordinate bounds in the current style." id="3Gw-Zy-sBT">
+ <font key="font" metaFont="smallSystem"/>
+ <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
+ <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="tUU-DX-RxU">
+ <rect key="frame" x="148" y="75" width="224" height="22"/>
+ <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" usesSingleLineMode="YES" id="lwQ-N1-PTI">
+ <font key="font" metaFont="system"/>
+ <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ <connections>
+ <outlet property="nextKeyView" destination="Xo1-tZ-WQ6" id="VIu-TG-LQu"/>
+ </connections>
+ </textField>
+ <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="p5T-3H-wqL">
+ <rect key="frame" x="20" y="108" width="64" height="64"/>
+ <constraints>
+ <constraint firstAttribute="height" constant="64" id="2Xy-pC-rE3"/>
+ <constraint firstAttribute="width" constant="64" id="SWY-Rg-9R8"/>
+ </constraints>
+ <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSApplicationIcon" id="cww-fO-sNX"/>
+ </imageView>
+ <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="hhq-J9-mzB">
+ <rect key="frame" x="98" y="52" width="44" height="17"/>
+ <textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="From:" id="fkO-YX-Yzt">
+ <font key="font" metaFont="system"/>
+ <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
+ <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Xo1-tZ-WQ6">
+ <rect key="frame" x="148" y="49" width="96" height="22"/>
+ <constraints>
+ <constraint firstAttribute="width" constant="96" id="8Rw-FU-HGV"/>
+ </constraints>
+ <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" usesSingleLineMode="YES" id="g7z-bq-I00">
+ <numberFormatter key="formatter" formatterBehavior="custom10_4" positiveFormat="z#,##0" numberStyle="decimal" allowsFloats="NO" minimumIntegerDigits="1" maximumIntegerDigits="2000000000" id="LGN-Et-RKY">
+ <real key="minimum" value="0.0"/>
+ </numberFormatter>
+ <font key="font" metaFont="system"/>
+ <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ <connections>
+ <outlet property="nextKeyView" destination="5sj-XD-neD" id="90r-pR-v8j"/>
+ </connections>
+ </textField>
+ <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8r0-F0-e5i">
+ <rect key="frame" x="250" y="52" width="20" height="17"/>
+ <textFieldCell key="cell" lineBreakMode="clipping" alignment="right" title="to:" id="RBS-Uj-AVT">
+ <font key="font" metaFont="system"/>
+ <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
+ <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="5sj-XD-neD">
+ <rect key="frame" x="276" y="49" width="96" height="22"/>
+ <constraints>
+ <constraint firstAttribute="width" constant="96" id="faj-tE-bfc"/>
+ </constraints>
+ <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" usesSingleLineMode="YES" id="dUq-Vg-vgQ">
+ <numberFormatter key="formatter" formatterBehavior="custom10_4" positiveFormat="z#,##0" numberStyle="decimal" allowsFloats="NO" minimumIntegerDigits="1" maximumIntegerDigits="2000000000" id="4cD-xh-teT">
+ <real key="minimum" value="0.0"/>
+ </numberFormatter>
+ <font key="font" metaFont="system"/>
+ <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ <connections>
+ <outlet property="nextKeyView" destination="tUU-DX-RxU" id="o5A-2J-9Sl"/>
+ </connections>
+ </textField>
+ <button verticalHuggingPriority="750" tag="1" translatesAutoresizingMaskIntoConstraints="NO" id="EyW-0r-iV7">
+ <rect key="frame" x="313" y="13" width="65" height="32"/>
+ <buttonCell key="cell" type="push" title="Add" bezelStyle="rounded" alignment="center" borderStyle="border" tag="1" imageScaling="proportionallyDown" inset="2" id="5xR-IX-Qnp">
+ <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+ <font key="font" metaFont="system"/>
+ <string key="keyEquivalent" base64-UTF8="YES">
+DQ
+</string>
+ </buttonCell>
+ <connections>
+ <action selector="confirmAddingOfflinePack:" target="-2" id="7ic-hp-A2O"/>
+ </connections>
+ </button>
+ <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ggP-hg-92n">
+ <rect key="frame" x="231" y="13" width="82" height="32"/>
+ <buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="L4F-7l-Wwq">
+ <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+ <font key="font" metaFont="system"/>
+ <string key="keyEquivalent" base64-UTF8="YES">
+Gw
+</string>
+ </buttonCell>
+ <connections>
+ <action selector="confirmAddingOfflinePack:" target="-2" id="Ljo-bK-4BU"/>
+ </connections>
+ </button>
+ </subviews>
+ <constraints>
+ <constraint firstItem="hhq-J9-mzB" firstAttribute="firstBaseline" secondItem="Xo1-tZ-WQ6" secondAttribute="firstBaseline" id="0Rv-Ze-u9B"/>
+ <constraint firstAttribute="trailing" secondItem="Xjw-df-oAz" secondAttribute="trailing" constant="20" id="0gu-PF-adU"/>
+ <constraint firstItem="p5T-3H-wqL" firstAttribute="top" secondItem="Aqq-bl-feU" secondAttribute="top" constant="20" id="2bA-hD-M6H"/>
+ <constraint firstItem="ggP-hg-92n" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="Aqq-bl-feU" secondAttribute="leading" constant="20" symbolic="YES" id="493-sg-uf0"/>
+ <constraint firstItem="Xo1-tZ-WQ6" firstAttribute="top" secondItem="tUU-DX-RxU" secondAttribute="bottom" constant="4" id="4Ql-yp-7Kv"/>
+ <constraint firstAttribute="bottom" secondItem="EyW-0r-iV7" secondAttribute="bottom" constant="20" id="7cm-ds-QeW"/>
+ <constraint firstItem="D3l-hX-2Dh" firstAttribute="leading" secondItem="p5T-3H-wqL" secondAttribute="trailing" constant="16" id="7xT-tt-0Wx"/>
+ <constraint firstItem="EyW-0r-iV7" firstAttribute="leading" secondItem="ggP-hg-92n" secondAttribute="trailing" constant="12" id="9AJ-g9-XXg"/>
+ <constraint firstItem="D3l-hX-2Dh" firstAttribute="top" secondItem="Xjw-df-oAz" secondAttribute="bottom" constant="8" id="BwZ-hX-4t5"/>
+ <constraint firstItem="sui-dp-hbb" firstAttribute="firstBaseline" secondItem="tUU-DX-RxU" secondAttribute="firstBaseline" id="MUq-FE-BiZ"/>
+ <constraint firstItem="sui-dp-hbb" firstAttribute="leading" secondItem="D3l-hX-2Dh" secondAttribute="leading" id="NU2-ve-0Mo"/>
+ <constraint firstItem="tUU-DX-RxU" firstAttribute="top" secondItem="D3l-hX-2Dh" secondAttribute="bottom" constant="8" id="Rn0-66-xYg"/>
+ <constraint firstItem="8r0-F0-e5i" firstAttribute="firstBaseline" secondItem="5sj-XD-neD" secondAttribute="firstBaseline" id="Shc-KJ-NR4"/>
+ <constraint firstItem="Xo1-tZ-WQ6" firstAttribute="leading" secondItem="tUU-DX-RxU" secondAttribute="leading" id="Usc-k5-8R9"/>
+ <constraint firstItem="8r0-F0-e5i" firstAttribute="leading" secondItem="Xo1-tZ-WQ6" secondAttribute="trailing" constant="8" id="W7y-oQ-Tsb"/>
+ <constraint firstItem="Xo1-tZ-WQ6" firstAttribute="leading" secondItem="hhq-J9-mzB" secondAttribute="trailing" constant="8" id="g3w-AE-VVQ"/>
+ <constraint firstItem="5sj-XD-neD" firstAttribute="trailing" secondItem="tUU-DX-RxU" secondAttribute="trailing" id="gWo-ar-g0U"/>
+ <constraint firstItem="Xjw-df-oAz" firstAttribute="leading" secondItem="p5T-3H-wqL" secondAttribute="trailing" constant="16" id="jRa-3D-tbZ"/>
+ <constraint firstItem="Xjw-df-oAz" firstAttribute="top" secondItem="Aqq-bl-feU" secondAttribute="top" constant="20" id="nrG-fO-QE5"/>
+ <constraint firstItem="D3l-hX-2Dh" firstAttribute="trailing" secondItem="Xjw-df-oAz" secondAttribute="trailing" id="o5U-kq-Wbz"/>
+ <constraint firstItem="tUU-DX-RxU" firstAttribute="leading" secondItem="sui-dp-hbb" secondAttribute="trailing" constant="8" id="oVs-7V-Dxq"/>
+ <constraint firstItem="tUU-DX-RxU" firstAttribute="trailing" secondItem="D3l-hX-2Dh" secondAttribute="trailing" id="p3o-y4-fNP"/>
+ <constraint firstItem="hhq-J9-mzB" firstAttribute="leading" secondItem="sui-dp-hbb" secondAttribute="leading" id="sff-ty-Y6C"/>
+ <constraint firstItem="5sj-XD-neD" firstAttribute="leading" secondItem="8r0-F0-e5i" secondAttribute="trailing" constant="8" id="tf8-pK-DZR"/>
+ <constraint firstItem="Xo1-tZ-WQ6" firstAttribute="firstBaseline" secondItem="8r0-F0-e5i" secondAttribute="firstBaseline" id="vdt-kP-ISY"/>
+ <constraint firstItem="EyW-0r-iV7" firstAttribute="trailing" secondItem="5sj-XD-neD" secondAttribute="trailing" id="wWy-ra-Uqt"/>
+ <constraint firstItem="p5T-3H-wqL" firstAttribute="leading" secondItem="Aqq-bl-feU" secondAttribute="leading" constant="20" id="whj-f7-Iu6"/>
+ <constraint firstItem="ggP-hg-92n" firstAttribute="firstBaseline" secondItem="EyW-0r-iV7" secondAttribute="firstBaseline" id="yl0-vC-sO8"/>
+ <constraint firstItem="EyW-0r-iV7" firstAttribute="top" secondItem="5sj-XD-neD" secondAttribute="bottom" constant="8" id="zxS-ci-Can"/>
+ </constraints>
+ </view>
+ <connections>
+ <outlet property="initialFirstResponder" destination="tUU-DX-RxU" id="W2D-pZ-p0s"/>
+ </connections>
+ <point key="canvasLocation" x="79" y="867"/>
+ </window>
</objects>
<resources>
+ <image name="NSApplicationIcon" width="128" height="128"/>
<image name="NSListViewTemplate" width="14" height="10"/>
<image name="NSShareTemplate" width="11" height="16"/>
<image name="symbol" width="13" height="13"/>
diff --git a/platform/macos/app/MapDocument.m b/platform/macos/app/MapDocument.m
index 9ba28f3b37..447929201c 100644
--- a/platform/macos/app/MapDocument.m
+++ b/platform/macos/app/MapDocument.m
@@ -75,6 +75,12 @@ NSArray<id <MGLAnnotation>> *MBXFlattenedShapes(NSArray<id <MGLAnnotation>> *sha
@property (weak) IBOutlet NSTableView *styleLayersTableView;
@property (weak) IBOutlet NSMenu *mapViewContextMenu;
@property (weak) IBOutlet NSSplitView *splitView;
+@property (weak) IBOutlet NSWindow *addOfflinePackWindow;
+@property (weak) IBOutlet NSTextField *offlinePackNameField;
+@property (weak) IBOutlet NSTextField *minimumOfflinePackZoomLevelField;
+@property (weak) IBOutlet NSNumberFormatter *minimumOfflinePackZoomLevelFormatter;
+@property (weak) IBOutlet NSTextField *maximumOfflinePackZoomLevelField;
+@property (weak) IBOutlet NSNumberFormatter *maximumOfflinePackZoomLevelFormatter;
@end
@@ -915,33 +921,49 @@ NSArray<id <MGLAnnotation>> *MBXFlattenedShapes(NSArray<id <MGLAnnotation>> *sha
#pragma mark Offline packs
- (IBAction)addOfflinePack:(id)sender {
- NSAlert *namePrompt = [[NSAlert alloc] init];
- namePrompt.messageText = @"Add offline pack";
- namePrompt.informativeText = @"Choose a name for the pack:";
- NSTextField *nameTextField = [[NSTextField alloc] initWithFrame:NSZeroRect];
- nameTextField.placeholderString = MGLStringFromCoordinateBounds(self.mapView.visibleCoordinateBounds);
- [nameTextField sizeToFit];
- NSRect textFieldFrame = nameTextField.frame;
- textFieldFrame.size.width = 300;
- nameTextField.frame = textFieldFrame;
- namePrompt.accessoryView = nameTextField;
- [namePrompt addButtonWithTitle:@"Add"];
- [namePrompt addButtonWithTitle:@"Cancel"];
- 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) {
- if (error) {
- [[NSAlert alertWithError:error] runModal];
- } else {
- [pack resume];
+ self.offlinePackNameField.stringValue = @"";
+ self.offlinePackNameField.placeholderString = MGLStringFromCoordinateBounds(self.mapView.visibleCoordinateBounds);
+ self.minimumOfflinePackZoomLevelField.doubleValue = floor(self.mapView.zoomLevel);
+ self.maximumOfflinePackZoomLevelField.doubleValue = ceil(self.mapView.maximumZoomLevel);
+ self.minimumOfflinePackZoomLevelFormatter.minimum = @(floor(self.mapView.minimumZoomLevel));
+ self.maximumOfflinePackZoomLevelFormatter.minimum = @(floor(self.mapView.minimumZoomLevel));
+ self.minimumOfflinePackZoomLevelFormatter.maximum = @(ceil(self.mapView.maximumZoomLevel));
+ self.maximumOfflinePackZoomLevelFormatter.maximum = @(ceil(self.mapView.maximumZoomLevel));
+
+ [self.addOfflinePackWindow makeFirstResponder:self.offlinePackNameField];
+
+ __weak __typeof__(self) weakSelf = self;
+ [self.window beginSheet:self.addOfflinePackWindow completionHandler:^(NSModalResponse returnCode) {
+ __typeof__(self) strongSelf = weakSelf;
+ if (!strongSelf || returnCode != NSModalResponseOK) {
+ return;
+ }
+
+ id <MGLOfflineRegion> region =
+ [[MGLTilePyramidOfflineRegion alloc] initWithStyleURL:strongSelf.mapView.styleURL
+ bounds:strongSelf.mapView.visibleCoordinateBounds
+ fromZoomLevel:strongSelf.minimumOfflinePackZoomLevelField.integerValue
+ toZoomLevel:strongSelf.maximumOfflinePackZoomLevelField.integerValue];
+ NSString *name = strongSelf.offlinePackNameField.stringValue;
+ if (!name.length) {
+ name = strongSelf.offlinePackNameField.placeholderString;
}
+ NSData *context = [[NSValueTransformer valueTransformerForName:@"OfflinePackNameValueTransformer"] reverseTransformedValue:name];
+ [[MGLOfflineStorage sharedOfflineStorage] addPackForRegion:region withContext:context completionHandler:^(MGLOfflinePack * _Nullable pack, NSError * _Nullable error) {
+ if (error) {
+ [[NSAlert alertWithError:error] runModal];
+ } else {
+ [(AppDelegate *)NSApp.delegate watchOfflinePack:pack];
+ [pack resume];
+ }
+ }];
}];
}
+- (IBAction)confirmAddingOfflinePack:(id)sender {
+ [self.window endSheet:self.addOfflinePackWindow returnCode:[sender tag] ? NSModalResponseOK : NSModalResponseCancel];
+}
+
#pragma mark Mouse events
- (void)handlePressGesture:(NSPressGestureRecognizer *)gestureRecognizer {
diff --git a/platform/macos/docs/guides/For Style Authors.md b/platform/macos/docs/guides/For Style Authors.md
index 40d1edef22..fd110b5bf7 100644
--- a/platform/macos/docs/guides/For Style Authors.md
+++ b/platform/macos/docs/guides/For Style Authors.md
@@ -158,6 +158,7 @@ In style JSON | In the SDK
`cluster` | `MGLShapeSourceOptionClustered`
`clusterRadius` | `MGLShapeSourceOptionClusterRadius`
`clusterMaxZoom` | `MGLShapeSourceOptionMaximumZoomLevelForClustering`
+`lineMetrics` | `MGLShapeSourceOptionLineDistanceMetrics`
To create a shape source from local GeoJSON data, first
[convert the GeoJSON data into a shape](working-with-geojson-data.html#converting-geojson-data-into-shape-objects),
diff --git a/platform/macos/docs/guides/Migrating to Expressions.md b/platform/macos/docs/guides/Migrating to Expressions.md
index e8d038dbb0..44e14a6eec 100644
--- a/platform/macos/docs/guides/Migrating to Expressions.md
+++ b/platform/macos/docs/guides/Migrating to Expressions.md
@@ -5,7 +5,7 @@
# Migrating from Style Functions to Expressions
-[Runtime Styling](runtime-styling.html) enables you to modify every aspect of the map’s appearance dynamically as a user interacts with your application. Developers can specify in advance how a layout or paint attribute will vary as the zoom level changes or how the appearance of individual features vary based on metadata provided by a content source.
+[Runtime Styling](https://www.mapbox.com/ios-sdk/maps/overview/runtime-styling/) enables you to modify every aspect of the map’s appearance dynamically as a user interacts with your application. Developers can specify in advance how a layout or paint attribute will vary as the zoom level changes or how the appearance of individual features vary based on metadata provided by a content source.
With Mapbox Maps SDK for macOS v0.7.0, style functions have been replaced with expressions. These provide even more tools for developers who want to style their maps dynamically. This guide outlines some tips for migrating from style functions to expressions, and offers an overview of some things that developers can do with expressions.
@@ -113,7 +113,7 @@ mapView.style?.insertLayer(layer, below: symbolLayer)
If you previously used an interpolation base greater than `0` (other than `1`), you can use `MGLExpressionInterpolationMode.exponential` as the curve type for `+[NSExpression(MGLAdditions) mgl_expressionForInterpolatingExpression:withCurveType:parameters:stops:]` or `'exponential'` as the curve type for [`mgl_interpolate:withCurveType:parameters:stops:`](predicates-and-expressions.html#code-mgl_interpolate-withcurvetype-parameters-stops-code). The `parameters` argument takes that interpolation base. This interpolates between values exponentially, creating an accelerated ramp effect.
-Here’s a visualization from Mapbox Studio (see [Working with Mapbox Studio](working-with-mapbox-studio.html)) comparing interpolation base values of `1.5` and `0.5` based on zoom. In order to convert camera style functions, use `$zoomLevel` or `MGL_FUNCTION('zoomLevel')` as the attribute key.
+Here’s a visualization from Mapbox Studio (see [Mapbox Studio and iOS](https://www.mapbox.com/ios-sdk/maps/overview/mapbox-studio/)) comparing interpolation base values of `1.5` and `0.5` based on zoom. In order to convert camera style functions, use `$zoomLevel` or `MGL_FUNCTION('zoomLevel')` as the attribute key.
<img src="img/data-driven-styling/exponential-function.png" height=344/>
<img src="img/data-driven-styling/exponential-function-1.png" height=344/>
diff --git a/platform/macos/docs/pod-README.md b/platform/macos/docs/pod-README.md
index 4827124be0..5dbef70efb 100644
--- a/platform/macos/docs/pod-README.md
+++ b/platform/macos/docs/pod-README.md
@@ -40,7 +40,7 @@ Create a [Podfile](https://guides.cocoapods.org/syntax/podfile.html) with the fo
platform :osx, '10.11'
target 'TargetNameForYourApp' do
- pod 'Mapbox-iOS-SDK', '~> x.y'
+ pod 'Mapbox-macOS-SDK', '~> x.y'
end
```
diff --git a/platform/macos/jazzy.yml b/platform/macos/jazzy.yml
index 915c1f46a9..5f1a214541 100644
--- a/platform/macos/jazzy.yml
+++ b/platform/macos/jazzy.yml
@@ -15,7 +15,7 @@ umbrella_header: src/Mapbox.h
framework_root: ../darwin/src
custom_categories:
- - name: Guides
+ - name: Appendices
children:
- Working with GeoJSON Data
- Predicates and Expressions
diff --git a/platform/macos/macos.xcodeproj/project.pbxproj b/platform/macos/macos.xcodeproj/project.pbxproj
index ffb7b524c6..1785caddb9 100644
--- a/platform/macos/macos.xcodeproj/project.pbxproj
+++ b/platform/macos/macos.xcodeproj/project.pbxproj
@@ -93,7 +93,11 @@
92092EF01F5EB10E00AF5130 /* MGLMapSnapshotter.h in Headers */ = {isa = PBXBuildFile; fileRef = 92092EEE1F5EB10E00AF5130 /* MGLMapSnapshotter.h */; settings = {ATTRIBUTES = (Public, ); }; };
92092EF11F5EB10E00AF5130 /* MGLMapSnapshotter.mm in Sources */ = {isa = PBXBuildFile; fileRef = 92092EEF1F5EB10E00AF5130 /* MGLMapSnapshotter.mm */; };
920A3E591E6F859D00C16EFC /* MGLSourceQueryTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 920A3E581E6F859D00C16EFC /* MGLSourceQueryTests.m */; };
+ 9221BAAF20699CBB0054BDF4 /* MGLTilePyramidOfflineRegion_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 9221BAAE20699CBA0054BDF4 /* MGLTilePyramidOfflineRegion_Private.h */; };
+ 9250B8C32073C69100EF338C /* MGLShapeOfflineRegion.h in Headers */ = {isa = PBXBuildFile; fileRef = 9250B8C22073C69000EF338C /* MGLShapeOfflineRegion.h */; settings = {ATTRIBUTES = (Public, ); }; };
92F2C3EB1F0E3A1900268EC0 /* MGLRendererFrontend.h in Headers */ = {isa = PBXBuildFile; fileRef = 92F2C3EA1F0E3A1900268EC0 /* MGLRendererFrontend.h */; };
+ 92FC0AE4207CC8DA007B6B54 /* MGLShapeOfflineRegion_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 92FC0AE3207CC8DA007B6B54 /* MGLShapeOfflineRegion_Private.h */; };
+ 92FC0AE6207CDD8D007B6B54 /* MGLShapeOfflineRegion.mm in Sources */ = {isa = PBXBuildFile; fileRef = 92FC0AE5207CDD8D007B6B54 /* MGLShapeOfflineRegion.mm */; };
9654C12B1FFC38E000DB6A19 /* MGLPolyline_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 9654C12A1FFC38E000DB6A19 /* MGLPolyline_Private.h */; };
9654C12D1FFC394700DB6A19 /* MGLPolygon_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 9654C12C1FFC394700DB6A19 /* MGLPolygon_Private.h */; };
96E027311E57C9A7004B8E66 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 96E027331E57C9A7004B8E66 /* Localizable.strings */; };
@@ -383,7 +387,11 @@
92092EEE1F5EB10E00AF5130 /* MGLMapSnapshotter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLMapSnapshotter.h; sourceTree = "<group>"; };
92092EEF1F5EB10E00AF5130 /* MGLMapSnapshotter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLMapSnapshotter.mm; sourceTree = "<group>"; };
920A3E581E6F859D00C16EFC /* MGLSourceQueryTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLSourceQueryTests.m; sourceTree = "<group>"; };
+ 9221BAAE20699CBA0054BDF4 /* MGLTilePyramidOfflineRegion_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLTilePyramidOfflineRegion_Private.h; sourceTree = "<group>"; };
+ 9250B8C22073C69000EF338C /* MGLShapeOfflineRegion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLShapeOfflineRegion.h; sourceTree = "<group>"; };
92F2C3EA1F0E3A1900268EC0 /* MGLRendererFrontend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLRendererFrontend.h; sourceTree = "<group>"; };
+ 92FC0AE3207CC8DA007B6B54 /* MGLShapeOfflineRegion_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLShapeOfflineRegion_Private.h; sourceTree = "<group>"; };
+ 92FC0AE5207CDD8D007B6B54 /* MGLShapeOfflineRegion.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLShapeOfflineRegion.mm; sourceTree = "<group>"; };
9654C12A1FFC38E000DB6A19 /* MGLPolyline_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLPolyline_Private.h; sourceTree = "<group>"; };
9654C12C1FFC394700DB6A19 /* MGLPolygon_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLPolygon_Private.h; sourceTree = "<group>"; };
966091701E5BBFF700A9A03B /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = "<group>"; };
@@ -1007,7 +1015,11 @@
DAE6C3511CC31E0400DB3429 /* MGLOfflineStorage.h */,
DAE6C3741CC31E2A00DB3429 /* MGLOfflineStorage_Private.h */,
DAE6C3751CC31E2A00DB3429 /* MGLOfflineStorage.mm */,
+ 9250B8C22073C69000EF338C /* MGLShapeOfflineRegion.h */,
+ 92FC0AE3207CC8DA007B6B54 /* MGLShapeOfflineRegion_Private.h */,
+ 92FC0AE5207CDD8D007B6B54 /* MGLShapeOfflineRegion.mm */,
DAE6C3581CC31E0400DB3429 /* MGLTilePyramidOfflineRegion.h */,
+ 9221BAAE20699CBA0054BDF4 /* MGLTilePyramidOfflineRegion_Private.h */,
DAE6C37B1CC31E2A00DB3429 /* MGLTilePyramidOfflineRegion.mm */,
);
name = "Offline Maps";
@@ -1214,6 +1226,7 @@
352742781D4C220900A1ECE6 /* MGLStyleValue.h in Headers */,
DAE6C35E1CC31E0400DB3429 /* MGLMultiPoint.h in Headers */,
35602BFF1D3EA9B40050646F /* MGLStyleLayer_Private.h in Headers */,
+ 92FC0AE4207CC8DA007B6B54 /* MGLShapeOfflineRegion_Private.h in Headers */,
DAF0D8161DFE6B1800B28378 /* MGLAttributionInfo_Private.h in Headers */,
DAE6C3971CC31E2A00DB3429 /* NSBundle+MGLAdditions.h in Headers */,
DAED385F1D62CED700D7640F /* NSURL+MGLAdditions.h in Headers */,
@@ -1246,6 +1259,7 @@
35602BFA1D3EA99F0050646F /* MGLFillStyleLayer.h in Headers */,
DA35A2A41CC9EB1A00E826B2 /* MGLCoordinateFormatter.h in Headers */,
35C5D8491D6DD66D00E95907 /* NSCompoundPredicate+MGLAdditions.h in Headers */,
+ 9250B8C32073C69100EF338C /* MGLShapeOfflineRegion.h in Headers */,
DD0902B31DB1AC6400C5BDCE /* MGLNetworkConfiguration.h in Headers */,
DAE6C3621CC31E0400DB3429 /* MGLOverlay.h in Headers */,
DAE6C3651CC31E0400DB3429 /* MGLPolyline.h in Headers */,
@@ -1287,6 +1301,7 @@
352742851D4C244700A1ECE6 /* MGLRasterTileSource.h in Headers */,
9654C12D1FFC394700DB6A19 /* MGLPolygon_Private.h in Headers */,
408AA85B1DAEECFE00022900 /* MGLShape_Private.h in Headers */,
+ 9221BAAF20699CBB0054BDF4 /* MGLTilePyramidOfflineRegion_Private.h in Headers */,
DACC22181CF3D4F700D220D9 /* MGLFeature_Private.h in Headers */,
9654C12B1FFC38E000DB6A19 /* MGLPolyline_Private.h in Headers */,
DA6408D71DA4E5DA00908C90 /* MGLVectorStyleLayer.h in Headers */,
@@ -1568,6 +1583,7 @@
DAE6C3B51CC31EF300DB3429 /* MGLCompassCell.m in Sources */,
DA8F25901D51CA600010E6B5 /* MGLRasterStyleLayer.mm in Sources */,
DAD165751CF4CD7A001FF4B9 /* MGLShapeCollection.mm in Sources */,
+ 92FC0AE6207CDD8D007B6B54 /* MGLShapeOfflineRegion.mm in Sources */,
35C5D8481D6DD66D00E95907 /* NSComparisonPredicate+MGLAdditions.mm in Sources */,
DA35A2AE1CCA091800E826B2 /* MGLCompassDirectionFormatter.m in Sources */,
DACA8623201920BE00E9693A /* MGLRasterDEMSource.mm in Sources */,
@@ -1967,10 +1983,6 @@
INFOPLIST_FILE = "$(SRCROOT)/sdk/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
- LIBRARY_SEARCH_PATHS = (
- "$(inherited)",
- "$(PROJECT_DIR)/cmake/Debug",
- );
OTHER_CFLAGS = "-fvisibility=hidden";
OTHER_LDFLAGS = (
"$(mbgl_core_LINK_LIBRARIES)",
diff --git a/platform/macos/src/MGLMapView+IBAdditions.mm b/platform/macos/src/MGLMapView+IBAdditions.mm
index cef2863ee6..0c65abc031 100644
--- a/platform/macos/src/MGLMapView+IBAdditions.mm
+++ b/platform/macos/src/MGLMapView+IBAdditions.mm
@@ -1,5 +1,7 @@
#import "MGLMapView+IBAdditions.h"
+#import "MGLStyle.h"
+
#import "MGLMapView_Private.h"
@implementation MGLMapView (IBAdditions)
@@ -17,7 +19,7 @@
[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSURL *url = URLString.length ? [NSURL URLWithString:URLString] : nil;
if (URLString.length && !url) {
- [NSException raise:@"Invalid style URL"
+ [NSException raise:MGLInvalidStyleURLException
format:@"“%@” is not a valid style URL.", URLString];
}
self.styleURL = url;
diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm
index 154b716377..3c1fe18499 100644
--- a/platform/macos/src/MGLMapView.mm
+++ b/platform/macos/src/MGLMapView.mm
@@ -2108,7 +2108,11 @@ public:
if ([annotation isKindOfClass:[MGLMultiPoint class]])
{
- return false;
+ if ([self.delegate respondsToSelector:@selector(mapView:shapeAnnotationIsEnabled:)]) {
+ return !!(![self.delegate mapView:self shapeAnnotationIsEnabled:(MGLMultiPoint *)annotation]);
+ } else {
+ return false;
+ }
}
MGLAnnotationImage *annotationImage = [self imageOfAnnotationWithTag:annotationTag];
diff --git a/platform/macos/src/MGLMapViewDelegate.h b/platform/macos/src/MGLMapViewDelegate.h
index dae5b40286..2a8b28c1b4 100644
--- a/platform/macos/src/MGLMapViewDelegate.h
+++ b/platform/macos/src/MGLMapViewDelegate.h
@@ -244,6 +244,18 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark Selecting Annotations
/**
+ Returns a Boolean value indicating whether the shape annotation can be selected.
+
+ If the return value is `YES`, the user can select the annotation by clicking
+ on it. If the delegate does not implement this method, the default value is `YES`.
+
+ @param mapView The map view that has selected the annotation.
+ @param annotation The object representing the shape annotation.
+ @return A Boolean value indicating whether the annotation can be selected.
+ */
+- (BOOL)mapView:(MGLMapView *)mapView shapeAnnotationIsEnabled:(MGLShape *)annotation;
+
+/**
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.
diff --git a/platform/macos/src/Mapbox.h b/platform/macos/src/Mapbox.h
index 198998a874..dcffd73dfc 100644
--- a/platform/macos/src/Mapbox.h
+++ b/platform/macos/src/Mapbox.h
@@ -56,6 +56,7 @@ FOUNDATION_EXPORT MGL_EXPORT const unsigned char MapboxVersionString[];
#import "MGLRasterDEMSource.h"
#import "MGLImageSource.h"
#import "MGLTilePyramidOfflineRegion.h"
+#import "MGLShapeOfflineRegion.h"
#import "MGLTypes.h"
#import "NSValue+MGLAdditions.h"
#import "MGLStyleValue.h"
diff --git a/platform/macos/test/MGLMapViewDelegateIntegrationTests.swift b/platform/macos/test/MGLMapViewDelegateIntegrationTests.swift
index 3f82e7c61a..00635d97eb 100644
--- a/platform/macos/test/MGLMapViewDelegateIntegrationTests.swift
+++ b/platform/macos/test/MGLMapViewDelegateIntegrationTests.swift
@@ -26,6 +26,8 @@ extension MGLMapViewDelegateIntegrationTests: MGLMapViewDelegate {
func mapViewDidFinishRenderingMap(_ mapView: MGLMapView, fullyRendered: Bool) {}
func mapViewDidFailLoadingMap(_ mapView: MGLMapView, withError error: Error) {}
+
+ func mapView(_ mapView: MGLMapView, shapeAnnotationIsEnabled annotation: MGLShape) -> Bool { return false }
func mapView(_ mapView: MGLMapView, didDeselect annotation: MGLAnnotation) {}