summaryrefslogtreecommitdiff
path: root/platform/macos
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-08-16 01:17:11 -0700
committerFredrik Karlsson <bjorn.fredrik.karlsson@gmail.com>2016-08-16 10:17:11 +0200
commit1daba5d04b5f6a704a1ee608b64b7bb42101903f (patch)
tree50f268ad3dfc459f9814ed2a516c8127786a09b3 /platform/macos
parent6c6ddd9e86d1be7257178ffd123dde5138d6c7b9 (diff)
downloadqtlocation-mapboxgl-1daba5d04b5f6a704a1ee608b64b7bb42101903f.tar.gz
[ios, macos] Accept absolute file paths as style URLs (#6026)
It turns out that mbgl::AssetFileSource supports absolute file URLs in addition to relative file URLs. So replace the file: scheme with asset: while percent-escaping as necessary. Also added amsterdam.geojson to macos.xcodeproj for consistency with ios.xcodeproj.
Diffstat (limited to 'platform/macos')
-rw-r--r--platform/macos/CHANGELOG.md1
-rw-r--r--platform/macos/macos.xcodeproj/project.pbxproj14
-rw-r--r--platform/macos/src/MGLMapView.mm7
3 files changed, 17 insertions, 5 deletions
diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md
index 067149fdb6..05227a4134 100644
--- a/platform/macos/CHANGELOG.md
+++ b/platform/macos/CHANGELOG.md
@@ -5,6 +5,7 @@
* Fixed an issue causing code signing failures and bloating the framework. ([#5850](https://github.com/mapbox/mapbox-gl-native/pull/5850))
* A new runtime styling API allows you to adjust the style and content of the base map dynamically. All the options available in [Mapbox Studio](https://www.mapbox.com/studio/) are now exposed via MGLStyle and subclasses of MGLStyleLayer and MGLSource. ([#5727](https://github.com/mapbox/mapbox-gl-native/pull/5727))
* 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))
+* MGLMapView’s `styleURL` property can now be set to an absolute file URL. ([#6026](https://github.com/mapbox/mapbox-gl-native/pull/6026))
* GeoJSON sources specified by the stylesheet at design time now support `cluster`, `clusterMaxZoom`, and `clusterRadius` attributes for clustering point features on the base map. ([#5724](https://github.com/mapbox/mapbox-gl-native/pull/5724))
* Fixed rendering artifacts and missing glyphs that occurred after viewing a large number of CJK characters on the map. ([#5908](https://github.com/mapbox/mapbox-gl-native/pull/5908))
* Improved the precision of annotations at zoom levels greater than 18. ([#5517](https://github.com/mapbox/mapbox-gl-native/pull/5517))
diff --git a/platform/macos/macos.xcodeproj/project.pbxproj b/platform/macos/macos.xcodeproj/project.pbxproj
index 18a7f93232..181ed3fd64 100644
--- a/platform/macos/macos.xcodeproj/project.pbxproj
+++ b/platform/macos/macos.xcodeproj/project.pbxproj
@@ -166,6 +166,10 @@
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 */; };
+ DAED385A1D627FF400D7640F /* amsterdam.geojson in Resources */ = {isa = PBXBuildFile; fileRef = DAED38591D627FF400D7640F /* amsterdam.geojson */; };
+ DAED385F1D62CED700D7640F /* NSURL+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = DAED385D1D62CED700D7640F /* NSURL+MGLAdditions.h */; };
+ DAED38601D62CED700D7640F /* NSURL+MGLAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = DAED385E1D62CED700D7640F /* NSURL+MGLAdditions.m */; };
+ DAED38671D62D2EB00D7640F /* amsterdam.geojson in Resources */ = {isa = PBXBuildFile; fileRef = DAED38591D627FF400D7640F /* amsterdam.geojson */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -384,6 +388,9 @@
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>"; };
+ DAED38591D627FF400D7640F /* amsterdam.geojson */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = amsterdam.geojson; sourceTree = "<group>"; };
+ DAED385D1D62CED700D7640F /* NSURL+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSURL+MGLAdditions.h"; sourceTree = "<group>"; };
+ DAED385E1D62CED700D7640F /* NSURL+MGLAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSURL+MGLAdditions.m"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -597,6 +604,7 @@
DA8F257D1D51C5F40010E6B5 /* Styling */ = {
isa = PBXGroup;
children = (
+ DAED38591D627FF400D7640F /* amsterdam.geojson */,
DA8F257C1D51C5F40010E6B5 /* Layers */,
);
name = Styling;
@@ -682,6 +690,8 @@
DAE6C3811CC31E2A00DB3429 /* NSProcessInfo+MGLAdditions.m */,
DAE6C3821CC31E2A00DB3429 /* NSString+MGLAdditions.h */,
DAE6C3831CC31E2A00DB3429 /* NSString+MGLAdditions.m */,
+ DAED385D1D62CED700D7640F /* NSURL+MGLAdditions.h */,
+ DAED385E1D62CED700D7640F /* NSURL+MGLAdditions.m */,
DA35A2CD1CCAAED300E826B2 /* NSValue+MGLAdditions.h */,
DA35A2CE1CCAAED300E826B2 /* NSValue+MGLAdditions.m */,
);
@@ -819,6 +829,7 @@
DAE6C35E1CC31E0400DB3429 /* MGLMultiPoint.h in Headers */,
35602BFF1D3EA9B40050646F /* MGLStyleLayer_Private.hpp in Headers */,
DAE6C3971CC31E2A00DB3429 /* NSBundle+MGLAdditions.h in Headers */,
+ DAED385F1D62CED700D7640F /* NSURL+MGLAdditions.h in Headers */,
DAD165741CF4CD7A001FF4B9 /* MGLShapeCollection.h in Headers */,
DA8F25AF1D51CB270010E6B5 /* NSString+MGLStyleAttributeAdditions.h in Headers */,
DAE6C3631CC31E0400DB3429 /* MGLPointAnnotation.h in Headers */,
@@ -1004,6 +1015,7 @@
files = (
DA839EA21CC2E3400062CAFB /* Assets.xcassets in Resources */,
DA839EA01CC2E3400062CAFB /* MapDocument.xib in Resources */,
+ DAED38671D62D2EB00D7640F /* amsterdam.geojson in Resources */,
DA839EA51CC2E3400062CAFB /* MainMenu.xib in Resources */,
DA5589771D320C41006B7F64 /* wms.json in Resources */,
DAE6C2E21CC304F900DB3429 /* Credits.rtf in Resources */,
@@ -1027,6 +1039,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ DAED385A1D627FF400D7640F /* amsterdam.geojson in Resources */,
DA2DBBCB1D51E30A00D38FF9 /* MGLStyleLayerTests.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -1085,6 +1098,7 @@
DAE6C3911CC31E2A00DB3429 /* MGLPolygon.mm in Sources */,
DAE6C39B1CC31E2A00DB3429 /* NSProcessInfo+MGLAdditions.m in Sources */,
DAE6C38F1CC31E2A00DB3429 /* MGLOfflineStorage.mm in Sources */,
+ DAED38601D62CED700D7640F /* NSURL+MGLAdditions.m in Sources */,
DAE6C3951CC31E2A00DB3429 /* MGLTilePyramidOfflineRegion.mm in Sources */,
3593E52B1D52A628006D9365 /* MGLStyleAttribute.mm in Sources */,
DAE6C3851CC31E2A00DB3429 /* MGLAccountManager.m in Sources */,
diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm
index de127a7481..c3cd4ef7dd 100644
--- a/platform/macos/src/MGLMapView.mm
+++ b/platform/macos/src/MGLMapView.mm
@@ -38,6 +38,7 @@
#import "NSException+MGLAdditions.h"
#import "NSString+MGLAdditions.h"
#import "NSColor+MGLAdditions.hpp"
+#import "NSURL+MGLAdditions.h"
#import <QuartzCore/QuartzCore.h>
@@ -543,11 +544,7 @@ public:
styleURL = [MGLStyle streetsStyleURLWithVersion:MGLStyleDefaultVersion];
}
- if (![styleURL scheme]) {
- // Assume a relative path into the application’s resource folder.
- styleURL = [NSURL URLWithString:[@"asset://" stringByAppendingString:styleURL.absoluteString]];
- }
-
+ styleURL = styleURL.mgl_URLByStandardizingScheme;
_mbglMap->setStyleURL(styleURL.absoluteString.UTF8String);
}