From 5ccb43477fc1d2028aef283d0db64848ebc9a347 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. --- include/mbgl/util/default_styles.hpp | 4 ++-- platform/darwin/src/MGLStyle.h | 12 ++++++------ platform/darwin/src/MGLStyle.mm | 12 +++++++++++- platform/darwin/test/MGLStyleTests.mm | 2 +- platform/ios/CHANGELOG.md | 1 + platform/ios/app/MBXViewController.m | 4 ++-- platform/osx/app/Base.lproj/MainMenu.xib | 2 +- platform/osx/app/Base.lproj/MapDocument.xib | 6 +++--- platform/osx/app/MapDocument.m | 6 +++--- src/mbgl/util/default_styles.cpp | 12 ++++++------ 10 files changed, 36 insertions(+), 25 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/src/MGLStyle.h b/platform/darwin/src/MGLStyle.h index 798bc1cf1..124954fee 100644 --- a/platform/darwin/src/MGLStyle.h +++ b/platform/darwin/src/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/darwin/test/MGLStyleTests.mm b/platform/darwin/test/MGLStyleTests.mm index 9d5555c11..c8fc802e0 100644 --- a/platform/darwin/test/MGLStyleTests.mm +++ b/platform/darwin/test/MGLStyleTests.mm @@ -32,7 +32,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/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index db39bc5d7..e39c7a11b 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -9,6 +9,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CON - 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)) - 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 9b1d3d43b..791fe0d7b 100644 --- a/platform/ios/app/MBXViewController.m +++ b/platform/ios/app/MBXViewController.m @@ -479,7 +479,7 @@ static const CLLocationCoordinate2D WorldTourDestinations[] = { @"Light", @"Dark", @"Satellite", - @"Hybrid", + @"Satellite Streets", ]; styleURLs = @[ [MGLStyle streetsStyleURLWithVersion:MGLStyleCurrentVersion], @@ -487,7 +487,7 @@ static const CLLocationCoordinate2D WorldTourDestinations[] = { [MGLStyle lightStyleURLWithVersion:MGLStyleCurrentVersion], [MGLStyle darkStyleURLWithVersion:MGLStyleCurrentVersion], [MGLStyle satelliteStyleURLWithVersion:MGLStyleCurrentVersion], - [MGLStyle hybridStyleURLWithVersion:MGLStyleCurrentVersion], + [MGLStyle satelliteStreetsStyleURLWithVersion:MGLStyleCurrentVersion], ]; NSAssert(styleNames.count == styleURLs.count, @"Style names and URLs don’t match."); diff --git a/platform/osx/app/Base.lproj/MainMenu.xib b/platform/osx/app/Base.lproj/MainMenu.xib index 03302ac93..1e11abb9f 100644 --- a/platform/osx/app/Base.lproj/MainMenu.xib +++ b/platform/osx/app/Base.lproj/MainMenu.xib @@ -390,7 +390,7 @@ - + diff --git a/platform/osx/app/Base.lproj/MapDocument.xib b/platform/osx/app/Base.lproj/MapDocument.xib index 5b7e37936..e6891098d 100644 --- a/platform/osx/app/Base.lproj/MapDocument.xib +++ b/platform/osx/app/Base.lproj/MapDocument.xib @@ -59,9 +59,9 @@ - + - + @@ -77,7 +77,7 @@ - + diff --git a/platform/osx/app/MapDocument.m b/platform/osx/app/MapDocument.m index 9a32302f8..64f814dd2 100644 --- a/platform/osx/app/MapDocument.m +++ b/platform/osx/app/MapDocument.m @@ -135,7 +135,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); @@ -462,7 +462,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; @@ -562,7 +562,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/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