summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/mbgl/util/default_styles.hpp6
-rw-r--r--platform/darwin/src/MGLStyle.h101
-rw-r--r--platform/darwin/src/MGLStyle.mm35
-rw-r--r--platform/darwin/src/MGLTilePyramidOfflineRegion.mm2
-rw-r--r--platform/darwin/test/MGLOfflineRegionTests.m4
-rw-r--r--platform/darwin/test/MGLOfflineStorageTests.m2
-rw-r--r--platform/darwin/test/MGLStyleTests.mm63
-rw-r--r--platform/ios/CHANGELOG.md3
-rw-r--r--platform/ios/app/MBXViewController.m18
-rw-r--r--platform/ios/jazzy.yml1
-rw-r--r--platform/ios/src/MGLMapView.mm2
-rw-r--r--platform/osx/app/Base.lproj/MainMenu.xib2
-rw-r--r--platform/osx/app/Base.lproj/MapDocument.xib6
-rw-r--r--platform/osx/app/MapDocument.m36
-rw-r--r--platform/osx/osx.xcodeproj/project.pbxproj19
-rw-r--r--platform/osx/src/MGLMapView.mm4
-rw-r--r--src/mbgl/util/default_styles.cpp12
17 files changed, 224 insertions, 92 deletions
diff --git a/include/mbgl/util/default_styles.hpp b/include/mbgl/util/default_styles.hpp
index 3f5b6bd312..2043dd3f5b 100644
--- a/include/mbgl/util/default_styles.hpp
+++ b/include/mbgl/util/default_styles.hpp
@@ -14,17 +14,19 @@ struct DefaultStyle {
};
extern const DefaultStyle streets;
-extern const DefaultStyle emerald;
+extern const DefaultStyle outdoors;
extern const DefaultStyle light;
extern const DefaultStyle dark;
extern const DefaultStyle satellite;
extern const DefaultStyle hybrid;
const DefaultStyle orderedStyles[] = {
- streets, emerald, light, dark, satellite, hybrid,
+ streets, outdoors, light, dark, satellite, hybrid,
};
const size_t numOrderedStyles = sizeof(orderedStyles) / sizeof(DefaultStyle);
+static const unsigned currentVersion = 9;
+
} // end namespace default_styles
} // end namespace util
} // end namespace mbgl
diff --git a/platform/darwin/src/MGLStyle.h b/platform/darwin/src/MGLStyle.h
index e5b2de877c..2a2d61657f 100644
--- a/platform/darwin/src/MGLStyle.h
+++ b/platform/darwin/src/MGLStyle.h
@@ -4,50 +4,115 @@
NS_ASSUME_NONNULL_BEGIN
-/** A collection of convenience methods for creating style URLs of default styles provided by Mapbox. These instances of NSURL are cached. */
+/**
+ A version number identifying the latest released version of the suite of default styles provided by Mapbox. This version number may be passed into one of the “StyleURLWithVersion” class methods of MGLStyle.
+
+ The value of this constant is current as of the date on which this SDK was published. Consult the <a href="https://www.mapbox.com/api-documentation/#styles">Mapbox Styles API documentation</a> for the most up-to-date style versioning information.
+
+ @warning The value of this constant may change in a future release of the SDK. If you use any feature that depends on a specific implementation detail in a default style, you may use the current value of this constant or the underlying style URL, but do not use the constant itself. Such implementation details may change significantly from version to version.
+ */
+static const NSInteger MGLStyleCurrentVersion = 9;
+
+/**
+ A collection of convenience methods for creating style URLs of default styles provided by Mapbox.
+ */
@interface MGLStyle : NSObject
/**
- Returns the Streets style URL.
+ Returns the URL to the current version of the Streets style.
+
+ Mapbox Streets is a complete base map that balances nature, commerce, and infrastructure.
+ */
++ (NSURL *)streetsStyleURL __attribute__((deprecated("Use -streetsStyleURLWithVersion:.")));
+
+/**
+ Returns the URL to the given version of the Streets style.
+
+ Mapbox Streets is a complete base map that balances nature, commerce, and infrastructure.
+
+ @param version The style’s latest released version. The current version is given by `MGLStyleCurrentVersion`.
+ */
++ (NSURL *)streetsStyleURLWithVersion:(NSInteger)version;
+
+/**
+ Returns the URL to the current version of the Emerald style.
+
+ Mapbox Emerald is a versatile style with emphasis on road networks and public transportation.
+ */
++ (NSURL *)emeraldStyleURL __attribute__((deprecated("Use <mapbox://styles/mapbox/emerald-v8>.")));
+
+/**
+ Returns the URL to the given version of the Outdoors style.
+
+ Mapbox Outdoors is a rugged style that emphasizes physical terrain and outdoor activities.
+
+ @param version The style’s latest released version. The current version is given by `MGLStyleCurrentVersion`.
+ */
++ (NSURL *)outdoorsStyleURLWithVersion:(NSInteger)version;
+
+/**
+ Returns the URL to the current version of the Light style.
- Mapbox Streets is a complete base map, perfect for incorporating your own data.
+ Mapbox Light is a subtle, light-colored backdrop for data visualizations.
*/
-+ (NSURL *)streetsStyleURL;
++ (NSURL *)lightStyleURL __attribute__((deprecated("Use -lightStyleURLWithVersion:.")));
/**
- Returns the Emerald style URL.
+ Returns the URL to the given version of the Light style.
+
+ Mapbox Light is a subtle, light-colored backdrop for data visualizations.
- Emerald is a versatile style with emphasis on road networks and public transportation.
+ @param version The style’s latest released version. The current version is given by `MGLStyleCurrentVersion`.
*/
-+ (NSURL *)emeraldStyleURL;
++ (NSURL *)lightStyleURLWithVersion:(NSInteger)version;
/**
- Returns the Light style URL.
+ Returns the URL to the current version of the Dark style.
- Light is a subtle, light-colored backdrop for data visualizations.
+ Mapbox Dark is a subtle, dark-colored backdrop for data visualizations.
*/
-+ (NSURL *)lightStyleURL;
++ (NSURL *)darkStyleURL __attribute__((deprecated("Use -darkStyleURLWithVersion:.")));
/**
- Returns the Dark style URL.
+ Returns the URL to the given version of the Dark style.
+
+ Mapbox Dark is a subtle, dark-colored backdrop for data visualizations.
- Dark is a subtle, dark-colored backdrop for data visualizations.
+ @param version The style’s latest released version. The current version is given by `MGLStyleCurrentVersion`.
*/
-+ (NSURL *)darkStyleURL;
++ (NSURL *)darkStyleURLWithVersion:(NSInteger)version;
/**
- Returns the Satellite style URL.
+ Returns the URL to the current version of the Satellite style.
Mapbox Satellite is a beautiful global satellite and aerial imagery layer.
*/
-+ (NSURL *)satelliteStyleURL;
++ (NSURL *)satelliteStyleURL __attribute__((deprecated("Use -satelliteStyleURLWithVersion:.")));
/**
- Returns the Hybrid style URL.
+ Returns the URL to the given version of the Satellite style.
+
+ Mapbox Satellite is a beautiful global satellite and aerial imagery layer.
+
+ @param version The style’s latest released version. The current version is given by `MGLStyleCurrentVersion`.
+ */
++ (NSURL *)satelliteStyleURLWithVersion:(NSInteger)version;
+
+/**
+ Returns the URL to the current version of the Hybrid style.
+
+ Mapbox Hybrid combines the global satellite and aerial imagery of Mapbox Satellite with unobtrusive labels.
+ */
++ (NSURL *)hybridStyleURL __attribute__((deprecated("Use -hybridStyleURLWithVersion:.")));
+
+/**
+ Returns the URL to the given version of the Hybrid style.
+
+ Mapbox Hybrid combines the global satellite and aerial imagery of Mapbox Satellite with unobtrusive labels.
- Hybrid combines the global satellite and aerial imagery of Mapbox Satellite with unobtrusive labels.
+ @param version The style’s latest released version. The current version is given by `MGLStyleCurrentVersion`.
*/
-+ (NSURL *)hybridStyleURL;
++ (NSURL *)hybridStyleURLWithVersion:(NSInteger)version;
- (instancetype)init NS_UNAVAILABLE;
diff --git a/platform/darwin/src/MGLStyle.mm b/platform/darwin/src/MGLStyle.mm
index 15a25db9e3..c906337a56 100644
--- a/platform/darwin/src/MGLStyle.mm
+++ b/platform/darwin/src/MGLStyle.mm
@@ -4,27 +4,44 @@
@implementation MGLStyle
-// name is lowercase
-#define MGL_DEFINE_STYLE(name) \
+static_assert(mbgl::util::default_styles::currentVersion == MGLStyleCurrentVersion, "mbgl::util::default_styles::currentVersion and MGLStyleCurrentVersion disagree.");
+
+/// @param name The style’s marketing name, written in lower camelCase.
+/// @param fileName The last path component in the style’s URL, excluding the version suffix.
+#define MGL_DEFINE_STYLE(name, fileName) \
static NSURL *MGLStyleURL_##name; \
+ (NSURL *)name##StyleURL { \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
- MGLStyleURL_##name = [NSURL URLWithString:@(mbgl::util::default_styles::name.url)]; \
+ MGLStyleURL_##name = [self name##StyleURLWithVersion:MGLStyleCurrentVersion]; \
}); \
return MGLStyleURL_##name; \
+ } \
+ \
+ + (NSURL *)name##StyleURL##WithVersion:(NSInteger)version { \
+ return [NSURL URLWithString:[@"mapbox://styles/mapbox/" #fileName "-v" stringByAppendingFormat:@"%li", (long)version]]; \
}
-MGL_DEFINE_STYLE(streets)
-MGL_DEFINE_STYLE(emerald)
-MGL_DEFINE_STYLE(light)
-MGL_DEFINE_STYLE(dark)
-MGL_DEFINE_STYLE(satellite)
-MGL_DEFINE_STYLE(hybrid)
+MGL_DEFINE_STYLE(streets, streets)
+MGL_DEFINE_STYLE(outdoors, outdoors)
+MGL_DEFINE_STYLE(light, light)
+MGL_DEFINE_STYLE(dark, dark)
+MGL_DEFINE_STYLE(satellite, satellite)
+MGL_DEFINE_STYLE(hybrid, satellite-hybrid)
// Make sure all the styles listed in mbgl::util::default_styles::orderedStyles
// are defined above and also declared in MGLStyle.h.
static_assert(6 == mbgl::util::default_styles::numOrderedStyles,
"mbgl::util::default_styles::orderedStyles and MGLStyle have different numbers of styles.");
+// Emerald is no longer getting new versions as a default style, so the current version is hard-coded here.
+static NSURL *MGLStyleURL_emerald;
++ (NSURL *)emeraldStyleURL {
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ MGLStyleURL_emerald = [NSURL URLWithString:@"mapbox://styles/mapbox/emerald-v8"];
+ });
+ return MGLStyleURL_emerald;
+}
+
@end
diff --git a/platform/darwin/src/MGLTilePyramidOfflineRegion.mm b/platform/darwin/src/MGLTilePyramidOfflineRegion.mm
index d1151de094..9b33d267df 100644
--- a/platform/darwin/src/MGLTilePyramidOfflineRegion.mm
+++ b/platform/darwin/src/MGLTilePyramidOfflineRegion.mm
@@ -33,7 +33,7 @@
- (instancetype)initWithStyleURL:(NSURL *)styleURL bounds:(MGLCoordinateBounds)bounds fromZoomLevel:(double)minimumZoomLevel toZoomLevel:(double)maximumZoomLevel {
if (self = [super init]) {
if (!styleURL) {
- styleURL = [MGLStyle streetsStyleURL];
+ styleURL = [MGLStyle streetsStyleURLWithVersion:MGLStyleCurrentVersion];
}
if (!styleURL.scheme) {
diff --git a/platform/darwin/test/MGLOfflineRegionTests.m b/platform/darwin/test/MGLOfflineRegionTests.m
index 7164acb39c..a578bf0824 100644
--- a/platform/darwin/test/MGLOfflineRegionTests.m
+++ b/platform/darwin/test/MGLOfflineRegionTests.m
@@ -11,7 +11,7 @@
- (void)testStyleURLs {
MGLCoordinateBounds bounds = MGLCoordinateBoundsMake(kCLLocationCoordinate2DInvalid, kCLLocationCoordinate2DInvalid);
MGLTilePyramidOfflineRegion *region = [[MGLTilePyramidOfflineRegion alloc] initWithStyleURL:nil bounds:bounds fromZoomLevel:0 toZoomLevel:DBL_MAX];
- XCTAssertEqualObjects(region.styleURL, [MGLStyle streetsStyleURL], @"Streets isn’t the default style.");
+ XCTAssertEqualObjects(region.styleURL, [MGLStyle streetsStyleURLWithVersion:MGLStyleCurrentVersion], @"Streets isn’t the default style.");
NSURL *localURL = [NSURL URLWithString:@"beautiful.style"];
XCTAssertThrowsSpecificNamed([[MGLTilePyramidOfflineRegion alloc] initWithStyleURL:localURL bounds:bounds fromZoomLevel:0 toZoomLevel:DBL_MAX], NSException, @"Invalid style URL", @"No exception raised when initializing region with a local file URL as the style URL.");
@@ -19,7 +19,7 @@
- (void)testEquality {
MGLCoordinateBounds bounds = MGLCoordinateBoundsMake(kCLLocationCoordinate2DInvalid, kCLLocationCoordinate2DInvalid);
- MGLTilePyramidOfflineRegion *original = [[MGLTilePyramidOfflineRegion alloc] initWithStyleURL:[MGLStyle lightStyleURL] bounds:bounds fromZoomLevel:5 toZoomLevel:10];
+ MGLTilePyramidOfflineRegion *original = [[MGLTilePyramidOfflineRegion alloc] initWithStyleURL:[MGLStyle lightStyleURLWithVersion:MGLStyleCurrentVersion] bounds:bounds fromZoomLevel:5 toZoomLevel:10];
MGLTilePyramidOfflineRegion *copy = [original copy];
XCTAssertEqualObjects(original, copy, @"Tile pyramid region should be equal to its copy.");
diff --git a/platform/darwin/test/MGLOfflineStorageTests.m b/platform/darwin/test/MGLOfflineStorageTests.m
index dc09b592bf..41a681b1ca 100644
--- a/platform/darwin/test/MGLOfflineStorageTests.m
+++ b/platform/darwin/test/MGLOfflineStorageTests.m
@@ -27,7 +27,7 @@
- (void)testAddPack {
NSUInteger countOfPacks = [MGLOfflineStorage sharedOfflineStorage].packs.count;
- NSURL *styleURL = [MGLStyle lightStyleURL];
+ NSURL *styleURL = [MGLStyle lightStyleURLWithVersion:8];
/// Somewhere near Grape Grove, Ohio, United States.
MGLCoordinateBounds bounds = {
{ .latitude = 39.70358155855172, .longitude = -83.69506472545841 },
diff --git a/platform/darwin/test/MGLStyleTests.mm b/platform/darwin/test/MGLStyleTests.mm
index 0d6b7b5c18..63b49b96f2 100644
--- a/platform/darwin/test/MGLStyleTests.mm
+++ b/platform/darwin/test/MGLStyleTests.mm
@@ -1,26 +1,81 @@
#import "MGLStyle.h"
+#import "NSBundle+MGLAdditions.h"
+
#import <mbgl/util/default_styles.hpp>
#import <XCTest/XCTest.h>
+#import <objc/runtime.h>
@interface MGLStyleTests : XCTestCase
@end
@implementation MGLStyleTests
-- (void)testStyleURLs {
- // Test that all the default styles have publicly-declared MGLStyle class
- // methods and that the URLs are all well-formed.
+- (void)testUnversionedStyleURLs {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
XCTAssertEqualObjects([MGLStyle streetsStyleURL].absoluteString, @(mbgl::util::default_styles::streets.url));
- XCTAssertEqualObjects([MGLStyle emeraldStyleURL].absoluteString, @(mbgl::util::default_styles::emerald.url));
+ XCTAssertEqualObjects([MGLStyle emeraldStyleURL].absoluteString, @"mapbox://styles/mapbox/emerald-v8");
XCTAssertEqualObjects([MGLStyle lightStyleURL].absoluteString, @(mbgl::util::default_styles::light.url));
XCTAssertEqualObjects([MGLStyle darkStyleURL].absoluteString, @(mbgl::util::default_styles::dark.url));
XCTAssertEqualObjects([MGLStyle satelliteStyleURL].absoluteString, @(mbgl::util::default_styles::satellite.url));
XCTAssertEqualObjects([MGLStyle hybridStyleURL].absoluteString, @(mbgl::util::default_styles::hybrid.url));
+#pragma clang diagnostic pop
+}
+
+- (void)testVersionedStyleURLs {
+ // Test that all the default styles have publicly-declared MGLStyle class
+ // methods and that the URLs all have the right values.
+ XCTAssertEqualObjects([MGLStyle streetsStyleURLWithVersion:MGLStyleCurrentVersion].absoluteString, @(mbgl::util::default_styles::streets.url));
+ XCTAssertEqualObjects([MGLStyle outdoorsStyleURLWithVersion:MGLStyleCurrentVersion].absoluteString, @(mbgl::util::default_styles::outdoors.url));
+ XCTAssertEqualObjects([MGLStyle lightStyleURLWithVersion:MGLStyleCurrentVersion].absoluteString, @(mbgl::util::default_styles::light.url));
+ XCTAssertEqualObjects([MGLStyle darkStyleURLWithVersion:MGLStyleCurrentVersion].absoluteString, @(mbgl::util::default_styles::dark.url));
+ XCTAssertEqualObjects([MGLStyle satelliteStyleURLWithVersion:MGLStyleCurrentVersion].absoluteString, @(mbgl::util::default_styles::satellite.url));
+ XCTAssertEqualObjects([MGLStyle hybridStyleURLWithVersion:MGLStyleCurrentVersion].absoluteString, @(mbgl::util::default_styles::hybrid.url));
static_assert(6 == mbgl::util::default_styles::numOrderedStyles,
"MGLStyleTests isn’t testing all the styles in mbgl::util::default_styles.");
}
+- (void)testStyleURLComprehensiveness {
+ // Make sure this test is comprehensive.
+ const unsigned numImplicitArgs = 2 /* _cmd, self */;
+ unsigned numMethods = 0;
+ Method *methods = class_copyMethodList(object_getClass([MGLStyle class]), &numMethods);
+ unsigned numVersionedMethods = 0;
+ for (NSUInteger i = 0; i < numMethods; i++) {
+ Method method = methods[i];
+ SEL selector = method_getName(method);
+ NSString *name = @(sel_getName(selector));
+ unsigned numArgs = method_getNumberOfArguments(method);
+ if ([name hasSuffix:@"StyleURL"]) {
+ XCTAssertEqual(numArgs, numImplicitArgs, @"Unversioned style URL method should have no parameters, but it has %u.", numArgs - numImplicitArgs);
+ } else if ([name hasSuffix:@"StyleURLWithVersion:"]) {
+ XCTAssertEqual(numArgs, numImplicitArgs + 1, @"Versioned style URL method should have one parameter, but it has %u.", numArgs - numImplicitArgs);
+ numVersionedMethods++;
+ } else {
+ XCTAssertEqual([name rangeOfString:@"URL"].location, NSNotFound, @"MGLStyle style URL method %@ is malformed.", name);
+ }
+ }
+ XCTAssertEqual(mbgl::util::default_styles::numOrderedStyles, numVersionedMethods,
+ @"There are %lu default styles but MGLStyleTests only provides versioned style URL methods for %u of them.",
+ mbgl::util::default_styles::numOrderedStyles, numVersionedMethods);
+
+ // Test that all the versioned style methods are in the public header.
+ NSURL *styleHeaderURL = [[[NSBundle mgl_frameworkBundle].bundleURL
+ URLByAppendingPathComponent:@"Headers" isDirectory:YES]
+ URLByAppendingPathComponent:@"MGLStyle.h"];
+ NSError *styleHeaderError;
+ NSString *styleHeader = [NSString stringWithContentsOfURL:styleHeaderURL usedEncoding:nil error:&styleHeaderError];
+ XCTAssertNil(styleHeaderError, @"Error getting contents of MGLStyle.h.");
+
+ NSError *versionedMethodError;
+ NSString *versionedMethodExpressionString = @(R"RE(^\+\s*\(NSURL\s*\*\s*\)\s*\w+StyleURLWithVersion\s*:\s*\(\s*NSInteger\s*\)\s*version\s*;)RE");
+ NSRegularExpression *versionedMethodExpression = [NSRegularExpression regularExpressionWithPattern:versionedMethodExpressionString options:NSRegularExpressionAnchorsMatchLines error:&versionedMethodError];
+ XCTAssertNil(versionedMethodError, @"Error compiling regular expression to search for versioned methods.");
+ NSUInteger numVersionedMethodDeclarations = [versionedMethodExpression numberOfMatchesInString:styleHeader options:0 range:NSMakeRange(0, styleHeader.length)];
+ XCTAssertEqual(numVersionedMethodDeclarations, numVersionedMethods);
+}
+
@end
diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md
index 290df69aed..ffd60edb53 100644
--- a/platform/ios/CHANGELOG.md
+++ b/platform/ios/CHANGELOG.md
@@ -6,6 +6,9 @@ Mapbox welcomes participation and contributions from everyone. Please read [CON
- Applications linking against the SDK static framework no longer need to add `-ObjC` to the Other Linker Flags (`OTHER_LDFLAGS`) build setting. If you previously added this flag solely for this SDK, removing the flag may potentially reduce the overall size of your application. ([#4641](https://github.com/mapbox/mapbox-gl-native/pull/4641))
- Removed the `armv7s` slice from the SDK to reduce its size. iPhone 5 and iPhone 5c automatically use the `armv7` slice instead. ([#4641](https://github.com/mapbox/mapbox-gl-native/pull/4641))
+- Existing MGLStyle class methods that return default style URLs have been deprecated in favor of new methods that require an explicit style version parameter. ([#4759](https://github.com/mapbox/mapbox-gl-native/pull/4759))
+- Deprecated `+[MGLStyle emeraldStyleURL]` with no replacement method. To use the Emerald style going forward, we recommend that you use the underlying URL. ([#4759](https://github.com/mapbox/mapbox-gl-native/pull/4759))
+- Added `+[MGLStyle outdoorsStyleURLWithVersion:]` for the new Outdoors style. ([#4759](https://github.com/mapbox/mapbox-gl-native/pull/4759))
- The user dot now moves smoothly between user location updates while user location tracking is disabled. ([#1582](https://github.com/mapbox/mapbox-gl-native/pull/1582))
- An MGLAnnotation can be relocated by changing its `coordinate` property in a KVO-compliant way. An MGLMultiPoint cannot be relocated. ([#3835](https://github.com/mapbox/mapbox-gl-native/pull/3835))
- Setting the `image` property of an MGLAnnotationImage to `nil` resets it to the default red pin image and reclaims resources that can be used to customize additional annotations. ([#3835](https://github.com/mapbox/mapbox-gl-native/pull/3835))
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m
index 995f99072b..9b1d3d43bb 100644
--- a/platform/ios/app/MBXViewController.m
+++ b/platform/ios/app/MBXViewController.m
@@ -475,19 +475,19 @@ static const CLLocationCoordinate2D WorldTourDestinations[] = {
dispatch_once(&onceToken, ^{
styleNames = @[
@"Streets",
- @"Emerald",
+ @"Outdoors",
@"Light",
@"Dark",
@"Satellite",
@"Hybrid",
];
styleURLs = @[
- [MGLStyle streetsStyleURL],
- [MGLStyle emeraldStyleURL],
- [MGLStyle lightStyleURL],
- [MGLStyle darkStyleURL],
- [MGLStyle satelliteStyleURL],
- [MGLStyle hybridStyleURL],
+ [MGLStyle streetsStyleURLWithVersion:MGLStyleCurrentVersion],
+ [MGLStyle outdoorsStyleURLWithVersion:MGLStyleCurrentVersion],
+ [MGLStyle lightStyleURLWithVersion:MGLStyleCurrentVersion],
+ [MGLStyle darkStyleURLWithVersion:MGLStyleCurrentVersion],
+ [MGLStyle satelliteStyleURLWithVersion:MGLStyleCurrentVersion],
+ [MGLStyle hybridStyleURLWithVersion:MGLStyleCurrentVersion],
];
NSAssert(styleNames.count == styleURLs.count, @"Style names and URLs don’t match.");
@@ -497,10 +497,10 @@ static const CLLocationCoordinate2D WorldTourDestinations[] = {
unsigned numStyleURLMethods = 0;
for (NSUInteger i = 0; i < numMethods; i++) {
Method method = methods[i];
- if (method_getNumberOfArguments(method) == 2 /* _cmd, self */) {
+ if (method_getNumberOfArguments(method) == 3 /* _cmd, self, version */) {
SEL selector = method_getName(method);
NSString *name = @(sel_getName(selector));
- if ([name rangeOfString:@"StyleURL"].location != NSNotFound) {
+ if ([name hasSuffix:@"StyleURLWithVersion:"]) {
numStyleURLMethods += 1;
}
}
diff --git a/platform/ios/jazzy.yml b/platform/ios/jazzy.yml
index 586d944f0c..205f0c7f4f 100644
--- a/platform/ios/jazzy.yml
+++ b/platform/ios/jazzy.yml
@@ -23,6 +23,7 @@ custom_categories:
- MGLMapView
- MGLMapViewDelegate
- MGLStyle
+ - MGLStyleCurrentVersion
- MGLUserTrackingMode
- name: Annotations
children:
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 8a3faa6a2e..2c3cbf8f5f 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -329,7 +329,7 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
if ( ! styleURL)
{
- styleURL = [MGLStyle streetsStyleURL];
+ styleURL = [MGLStyle streetsStyleURLWithVersion:MGLStyleCurrentVersion];
}
if ( ! [styleURL scheme])
diff --git a/platform/osx/app/Base.lproj/MainMenu.xib b/platform/osx/app/Base.lproj/MainMenu.xib
index 4f3633343b..03302ac932 100644
--- a/platform/osx/app/Base.lproj/MainMenu.xib
+++ b/platform/osx/app/Base.lproj/MainMenu.xib
@@ -370,7 +370,7 @@
<action selector="setStyle:" target="-1" id="I4L-Wx-UXA"/>
</connections>
</menuItem>
- <menuItem title="Emerald" tag="2" keyEquivalent="2" id="BBa-Qa-SQr">
+ <menuItem title="Outdoors" tag="2" keyEquivalent="2" id="BBa-Qa-SQr">
<connections>
<action selector="setStyle:" target="-1" id="rM1-yG-t5u"/>
</connections>
diff --git a/platform/osx/app/Base.lproj/MapDocument.xib b/platform/osx/app/Base.lproj/MapDocument.xib
index 74743ca9e7..5b7e37936f 100644
--- a/platform/osx/app/Base.lproj/MapDocument.xib
+++ b/platform/osx/app/Base.lproj/MapDocument.xib
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9531"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10116"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="MapDocument">
@@ -69,7 +69,7 @@
<menu key="menu" id="xf3-qk-IhF">
<items>
<menuItem title="Streets" state="on" tag="1" id="wvt-tP-O3a"/>
- <menuItem title="Emerald" tag="2" id="RkE-lp-fL9"/>
+ <menuItem title="Outdoors" tag="2" id="RkE-lp-fL9"/>
<menuItem title="Light" tag="3" id="R4X-kt-HHb"/>
<menuItem title="Dark" tag="4" id="jUC-5X-0Zx">
<modifierMask key="keyEquivalentModifierMask"/>
diff --git a/platform/osx/app/MapDocument.m b/platform/osx/app/MapDocument.m
index 2a537772b5..9a32302f87 100644
--- a/platform/osx/app/MapDocument.m
+++ b/platform/osx/app/MapDocument.m
@@ -120,22 +120,22 @@ static const CLLocationCoordinate2D WorldTourDestinations[] = {
NSURL *styleURL;
switch (tag) {
case 1:
- styleURL = [MGLStyle streetsStyleURL];
+ styleURL = [MGLStyle streetsStyleURLWithVersion:MGLStyleCurrentVersion];
break;
case 2:
- styleURL = [MGLStyle emeraldStyleURL];
+ styleURL = [MGLStyle outdoorsStyleURLWithVersion:MGLStyleCurrentVersion];
break;
case 3:
- styleURL = [MGLStyle lightStyleURL];
+ styleURL = [MGLStyle lightStyleURLWithVersion:MGLStyleCurrentVersion];
break;
case 4:
- styleURL = [MGLStyle darkStyleURL];
+ styleURL = [MGLStyle darkStyleURLWithVersion:MGLStyleCurrentVersion];
break;
case 5:
- styleURL = [MGLStyle satelliteStyleURL];
+ styleURL = [MGLStyle satelliteStyleURLWithVersion:MGLStyleCurrentVersion];
break;
case 6:
- styleURL = [MGLStyle hybridStyleURL];
+ styleURL = [MGLStyle hybridStyleURLWithVersion:MGLStyleCurrentVersion];
break;
default:
NSAssert(NO, @"Cannot set style from control with tag %li", (long)tag);
@@ -447,22 +447,22 @@ static const CLLocationCoordinate2D WorldTourDestinations[] = {
NSCellStateValue state;
switch (menuItem.tag) {
case 1:
- state = [styleURL isEqual:[MGLStyle streetsStyleURL]];
+ state = [styleURL isEqual:[MGLStyle streetsStyleURLWithVersion:MGLStyleCurrentVersion]];
break;
case 2:
- state = [styleURL isEqual:[MGLStyle emeraldStyleURL]];
+ state = [styleURL isEqual:[MGLStyle outdoorsStyleURLWithVersion:MGLStyleCurrentVersion]];
break;
case 3:
- state = [styleURL isEqual:[MGLStyle lightStyleURL]];
+ state = [styleURL isEqual:[MGLStyle lightStyleURLWithVersion:MGLStyleCurrentVersion]];
break;
case 4:
- state = [styleURL isEqual:[MGLStyle darkStyleURL]];
+ state = [styleURL isEqual:[MGLStyle darkStyleURLWithVersion:MGLStyleCurrentVersion]];
break;
case 5:
- state = [styleURL isEqual:[MGLStyle satelliteStyleURL]];
+ state = [styleURL isEqual:[MGLStyle satelliteStyleURLWithVersion:MGLStyleCurrentVersion]];
break;
case 6:
- state = [styleURL isEqual:[MGLStyle hybridStyleURL]];
+ state = [styleURL isEqual:[MGLStyle hybridStyleURLWithVersion:MGLStyleCurrentVersion]];
break;
default:
return NO;
@@ -557,12 +557,12 @@ static const CLLocationCoordinate2D WorldTourDestinations[] = {
}
NSArray *styleURLs = @[
- [MGLStyle streetsStyleURL],
- [MGLStyle emeraldStyleURL],
- [MGLStyle lightStyleURL],
- [MGLStyle darkStyleURL],
- [MGLStyle satelliteStyleURL],
- [MGLStyle hybridStyleURL],
+ [MGLStyle streetsStyleURLWithVersion:MGLStyleCurrentVersion],
+ [MGLStyle outdoorsStyleURLWithVersion:MGLStyleCurrentVersion],
+ [MGLStyle lightStyleURLWithVersion:MGLStyleCurrentVersion],
+ [MGLStyle darkStyleURLWithVersion:MGLStyleCurrentVersion],
+ [MGLStyle satelliteStyleURLWithVersion:MGLStyleCurrentVersion],
+ [MGLStyle hybridStyleURLWithVersion:MGLStyleCurrentVersion],
];
return [styleURLs indexOfObject:self.mapView.styleURL];
}
diff --git a/platform/osx/osx.xcodeproj/project.pbxproj b/platform/osx/osx.xcodeproj/project.pbxproj
index 0f462d498d..0c355cdb09 100644
--- a/platform/osx/osx.xcodeproj/project.pbxproj
+++ b/platform/osx/osx.xcodeproj/project.pbxproj
@@ -29,6 +29,7 @@
DA8933AE1CCD290700E68420 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = DA8933AB1CCD290700E68420 /* Localizable.strings */; };
DA8933B51CCD2C2500E68420 /* Foundation.strings in Resources */ = {isa = PBXBuildFile; fileRef = DA8933B31CCD2C2500E68420 /* Foundation.strings */; };
DA8933B81CCD2C2D00E68420 /* Foundation.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = DA8933B61CCD2C2D00E68420 /* Foundation.stringsdict */; };
+ DAB6924A1CC75A31005AAB54 /* libmbgl-core.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DAE6C3451CC31D1200DB3429 /* libmbgl-core.a */; };
DAC2ABC51CC6D343006D18C4 /* MGLAnnotationImage_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = DAC2ABC41CC6D343006D18C4 /* MGLAnnotationImage_Private.h */; };
DAE6C2E21CC304F900DB3429 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = DAE6C2E11CC304F900DB3429 /* Credits.rtf */; };
DAE6C2ED1CC3050F00DB3429 /* DroppedPinAnnotation.m in Sources */ = {isa = PBXBuildFile; fileRef = DAE6C2E41CC3050F00DB3429 /* DroppedPinAnnotation.m */; };
@@ -115,13 +116,6 @@
remoteGlobalIDString = DAE6C3271CC30DB200DB3429;
remoteInfo = dynamic;
};
- DAE6C3351CC30DB200DB3429 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = DA839E8A1CC2E3400062CAFB /* Project object */;
- proxyType = 1;
- remoteGlobalIDString = DA839E911CC2E3400062CAFB;
- remoteInfo = osxapp;
- };
DAE6C33B1CC30DB200DB3429 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = DA839E8A1CC2E3400062CAFB /* Project object */;
@@ -186,8 +180,8 @@
DAE6C32C1CC30DB200DB3429 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
DAE6C3311CC30DB200DB3429 /* test.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = test.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
DAE6C33A1CC30DB200DB3429 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
- DAE6C3451CC31D1200DB3429 /* libmbgl-core.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libmbgl-core.a"; path = "../../build/DerivedData/osx/Build/Products/Debug/libmbgl-core.a"; sourceTree = "<group>"; };
- DAE6C3461CC31D1200DB3429 /* libmbgl-platform-osx.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libmbgl-platform-osx.a"; path = "../../build/DerivedData/osx/Build/Products/Debug/libmbgl-platform-osx.a"; sourceTree = "<group>"; };
+ DAE6C3451CC31D1200DB3429 /* libmbgl-core.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libmbgl-core.a"; sourceTree = BUILT_PRODUCTS_DIR; };
+ DAE6C3461CC31D1200DB3429 /* libmbgl-platform-osx.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libmbgl-platform-osx.a"; sourceTree = BUILT_PRODUCTS_DIR; };
DAE6C34A1CC31E0400DB3429 /* MGLAccountManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLAccountManager.h; sourceTree = "<group>"; };
DAE6C34B1CC31E0400DB3429 /* MGLAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLAnnotation.h; sourceTree = "<group>"; };
DAE6C34C1CC31E0400DB3429 /* MGLGeometry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLGeometry.h; sourceTree = "<group>"; };
@@ -280,6 +274,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ DAB6924A1CC75A31005AAB54 /* libmbgl-core.a in Frameworks */,
DAE6C3321CC30DB200DB3429 /* Mapbox.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -597,7 +592,6 @@
);
dependencies = (
DAE6C3341CC30DB200DB3429 /* PBXTargetDependency */,
- DAE6C3361CC30DB200DB3429 /* PBXTargetDependency */,
);
name = test;
productName = dynamicTests;
@@ -750,11 +744,6 @@
target = DAE6C3271CC30DB200DB3429 /* dynamic */;
targetProxy = DAE6C3331CC30DB200DB3429 /* PBXContainerItemProxy */;
};
- DAE6C3361CC30DB200DB3429 /* PBXTargetDependency */ = {
- isa = PBXTargetDependency;
- target = DA839E911CC2E3400062CAFB /* osxapp */;
- targetProxy = DAE6C3351CC30DB200DB3429 /* PBXContainerItemProxy */;
- };
DAE6C33C1CC30DB200DB3429 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = DAE6C3271CC30DB200DB3429 /* dynamic */;
diff --git a/platform/osx/src/MGLMapView.mm b/platform/osx/src/MGLMapView.mm
index b4963535dd..0202c0dacb 100644
--- a/platform/osx/src/MGLMapView.mm
+++ b/platform/osx/src/MGLMapView.mm
@@ -532,7 +532,7 @@ public:
- (nonnull NSURL *)styleURL {
NSString *styleURLString = @(_mbglMap->getStyleURL().c_str()).mgl_stringOrNilIfEmpty;
- return styleURLString ? [NSURL URLWithString:styleURLString] : [MGLStyle streetsStyleURL];
+ return styleURLString ? [NSURL URLWithString:styleURLString] : [MGLStyle streetsStyleURLWithVersion:MGLStyleCurrentVersion];
}
- (void)setStyleURL:(nullable NSURL *)styleURL {
@@ -547,7 +547,7 @@ public:
if (![MGLAccountManager accessToken]) {
return;
}
- styleURL = [MGLStyle streetsStyleURL];
+ styleURL = [MGLStyle streetsStyleURLWithVersion:MGLStyleCurrentVersion];
}
if (![styleURL scheme]) {
diff --git a/src/mbgl/util/default_styles.cpp b/src/mbgl/util/default_styles.cpp
index d051fc60c3..247b7320eb 100644
--- a/src/mbgl/util/default_styles.cpp
+++ b/src/mbgl/util/default_styles.cpp
@@ -4,12 +4,12 @@ namespace mbgl {
namespace util {
namespace default_styles {
-const DefaultStyle streets = { "mapbox://styles/mapbox/streets-v8", "Streets" };
-const DefaultStyle emerald = { "mapbox://styles/mapbox/emerald-v8", "Emerald" };
-const DefaultStyle light = { "mapbox://styles/mapbox/light-v8", "Light" };
-const DefaultStyle dark = { "mapbox://styles/mapbox/dark-v8", "Dark" };
-const DefaultStyle satellite = { "mapbox://styles/mapbox/satellite-v8", "Satellite" };
-const DefaultStyle hybrid = { "mapbox://styles/mapbox/satellite-hybrid-v8", "Hybrid" };
+const DefaultStyle streets = { "mapbox://styles/mapbox/streets-v9", "Streets" };
+const DefaultStyle outdoors = { "mapbox://styles/mapbox/outdoors-v9", "Outdoors" };
+const DefaultStyle light = { "mapbox://styles/mapbox/light-v9", "Light" };
+const DefaultStyle dark = { "mapbox://styles/mapbox/dark-v9", "Dark" };
+const DefaultStyle satellite = { "mapbox://styles/mapbox/satellite-v9", "Satellite" };
+const DefaultStyle hybrid = { "mapbox://styles/mapbox/satellite-hybrid-v9", "Hybrid" };
} // namespace default_styles
} // end namespace util