From bac6fb4f84e02f54b7e5b54ff250ba3bad36806c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Mon, 2 May 2016 14:26:13 -0700 Subject: [PATCH] [ios, osx] Renamed Hybrid to Satellite Streets The style ID has also changed, but the unversioned method will continue to point to the old v8 style ID. Cherry-picked from 5ccb43477fc1d2028aef283d0db64848ebc9a347. --- include/mbgl/util/default_styles.hpp | 4 ++-- platform/darwin/include/MGLStyle.h | 12 ++++++------ platform/darwin/src/MGLStyle.mm | 12 +++++++++++- platform/ios/CHANGELOG.md | 1 + platform/osx/app/MainMenu.xib | 2 +- platform/osx/app/MapDocument.m | 6 +++--- platform/osx/app/MapDocument.xib | 6 +++--- platform/osx/test/MGLStyleTests.mm | 2 +- src/mbgl/util/default_styles.cpp | 12 ++++++------ 9 files changed, 34 insertions(+), 23 deletions(-) diff --git a/include/mbgl/util/default_styles.hpp b/include/mbgl/util/default_styles.hpp index 2043dd3f5..05015ab4c 100644 --- a/include/mbgl/util/default_styles.hpp +++ b/include/mbgl/util/default_styles.hpp @@ -18,10 +18,10 @@ extern const DefaultStyle outdoors; extern const DefaultStyle light; extern const DefaultStyle dark; extern const DefaultStyle satellite; -extern const DefaultStyle hybrid; +extern const DefaultStyle satelliteStreets; const DefaultStyle orderedStyles[] = { - streets, outdoors, light, dark, satellite, hybrid, + streets, outdoors, light, dark, satellite, satelliteStreets, }; const size_t numOrderedStyles = sizeof(orderedStyles) / sizeof(DefaultStyle); diff --git a/platform/darwin/include/MGLStyle.h b/platform/darwin/include/MGLStyle.h index 798bc1cf1..124954fee 100644 --- a/platform/darwin/include/MGLStyle.h +++ b/platform/darwin/include/MGLStyle.h @@ -99,20 +99,20 @@ static const NSInteger MGLStyleCurrentVersion = 9; + (NSURL *)satelliteStyleURLWithVersion:(NSInteger)version; /** - Returns the URL to version 8 of the Hybrid style. + Returns the URL to version 8 of the Satellite Streets style. - Mapbox Hybrid combines the global satellite and aerial imagery of Mapbox Satellite with unobtrusive labels. + Mapbox Satellite Streets combines the global satellite and aerial imagery of Mapbox Satellite with unobtrusive labels and translucent roads from Mapbox Streets. */ -+ (NSURL *)hybridStyleURL __attribute__((deprecated("Use -hybridStyleURLWithVersion:."))); ++ (NSURL *)hybridStyleURL __attribute__((deprecated("Use -satelliteStreetsStyleURLWithVersion:."))); /** - Returns the URL to the given version of the Hybrid style. + Returns the URL to the given version of the Satellite Streets style. - Mapbox Hybrid combines the global satellite and aerial imagery of Mapbox Satellite with unobtrusive labels. + Mapbox Satellite Streets combines the global satellite and aerial imagery of Mapbox Satellite with unobtrusive labels and translucent roads from Mapbox Streets. @param version The style’s latest released version. The current version is given by `MGLStyleCurrentVersion`. */ -+ (NSURL *)hybridStyleURLWithVersion:(NSInteger)version; ++ (NSURL *)satelliteStreetsStyleURLWithVersion:(NSInteger)version; - (instancetype)init NS_UNAVAILABLE; diff --git a/platform/darwin/src/MGLStyle.mm b/platform/darwin/src/MGLStyle.mm index c0d871487..13404c8d0 100644 --- a/platform/darwin/src/MGLStyle.mm +++ b/platform/darwin/src/MGLStyle.mm @@ -27,13 +27,23 @@ 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) +MGL_DEFINE_STYLE(satelliteStreets, satellite-streets) // 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."); +// Hybrid has been renamed Satellite Streets, so the last Hybrid version is hard-coded here. +static NSURL *MGLStyleURL_hybrid; ++ (NSURL *)hybridStyleURL { + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + MGLStyleURL_hybrid = [NSURL URLWithString:@"mapbox://styles/mapbox/satellite-hybrid-v8"]; + }); + return MGLStyleURL_hybrid; +} + // 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 { diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index e9e2c7b12..a12fa0244 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -7,6 +7,7 @@ Mapbox welcomes participation and contributions from everyone. If you’d like - Existing MGLStyle class methods that return default style URLs have been deprecated in favor of new methods that require an explicit style version parameter. The deprecated, unversioned methods continue to return version 8 of the respective styles and will not be updated as new versions of the styles are released. ([#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 Hybrid style is now called Satellite Streets. ([#4759](https://github.com/mapbox/mapbox-gl-native/pull/4759)) ## 3.2.1 diff --git a/platform/osx/app/MainMenu.xib b/platform/osx/app/MainMenu.xib index 3776d0d16..b9934be5e 100644 --- a/platform/osx/app/MainMenu.xib +++ b/platform/osx/app/MainMenu.xib @@ -390,7 +390,7 @@ - + diff --git a/platform/osx/app/MapDocument.m b/platform/osx/app/MapDocument.m index 84c1fe4d6..514e49b8d 100644 --- a/platform/osx/app/MapDocument.m +++ b/platform/osx/app/MapDocument.m @@ -136,7 +136,7 @@ static const CLLocationCoordinate2D WorldTourDestinations[] = { styleURL = [MGLStyle satelliteStyleURLWithVersion:MGLStyleCurrentVersion]; break; case 6: - styleURL = [MGLStyle hybridStyleURLWithVersion:MGLStyleCurrentVersion]; + styleURL = [MGLStyle satelliteStreetsStyleURLWithVersion:MGLStyleCurrentVersion]; break; default: NSAssert(NO, @"Cannot set style from control with tag %li", (long)tag); @@ -455,7 +455,7 @@ static const CLLocationCoordinate2D WorldTourDestinations[] = { state = [styleURL isEqual:[MGLStyle satelliteStyleURLWithVersion:MGLStyleCurrentVersion]]; break; case 6: - state = [styleURL isEqual:[MGLStyle hybridStyleURLWithVersion:MGLStyleCurrentVersion]]; + state = [styleURL isEqual:[MGLStyle satelliteStreetsStyleURLWithVersion:MGLStyleCurrentVersion]]; break; default: return NO; @@ -555,7 +555,7 @@ static const CLLocationCoordinate2D WorldTourDestinations[] = { [MGLStyle lightStyleURLWithVersion:MGLStyleCurrentVersion], [MGLStyle darkStyleURLWithVersion:MGLStyleCurrentVersion], [MGLStyle satelliteStyleURLWithVersion:MGLStyleCurrentVersion], - [MGLStyle hybridStyleURLWithVersion:MGLStyleCurrentVersion], + [MGLStyle satelliteStreetsStyleURLWithVersion:MGLStyleCurrentVersion], ]; return [styleURLs indexOfObject:self.mapView.styleURL]; } diff --git a/platform/osx/app/MapDocument.xib b/platform/osx/app/MapDocument.xib index 5b7e37936..e6891098d 100644 --- a/platform/osx/app/MapDocument.xib +++ b/platform/osx/app/MapDocument.xib @@ -59,9 +59,9 @@ - + - + @@ -77,7 +77,7 @@ - + diff --git a/platform/osx/test/MGLStyleTests.mm b/platform/osx/test/MGLStyleTests.mm index 21efa12c1..4b1ca1543 100644 --- a/platform/osx/test/MGLStyleTests.mm +++ b/platform/osx/test/MGLStyleTests.mm @@ -35,7 +35,7 @@ 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)); + XCTAssertEqualObjects([MGLStyle satelliteStreetsStyleURLWithVersion:MGLStyleCurrentVersion].absoluteString, @(mbgl::util::default_styles::satelliteStreets.url)); static_assert(6 == mbgl::util::default_styles::numOrderedStyles, "MGLStyleTests isn’t testing all the styles in mbgl::util::default_styles."); diff --git a/src/mbgl/util/default_styles.cpp b/src/mbgl/util/default_styles.cpp index 247b7320e..17cc2f574 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-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" }; +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 satelliteStreets = { "mapbox://styles/mapbox/satellite-streets-v9", "Satellite Streets" }; } // namespace default_styles } // end namespace util