diff --git a/platform/android/CHANGELOG.md b/platform/android/CHANGELOG.md index 4f12907f3..fdc6343b7 100644 --- a/platform/android/CHANGELOG.md +++ b/platform/android/CHANGELOG.md @@ -37,6 +37,7 @@ Mapbox welcomes participation and contributions from everyone. If you'd like to * Derived source attribution [#8630](https://github.com/mapbox/mapbox-gl-native/pull/8630) * Consistent use of duration unit [#8578](https://github.com/mapbox/mapbox-gl-native/pull/8578) * Swedish localization [#8883](https://github.com/mapbox/mapbox-gl-native/pull/8883) +* Streets v10, Outdoors v10, Satellite Streets v10, Traffic Day v2, Traffic Night v2 [#6301](https://github.com/mapbox/mapbox-gl-native/pull/6301) ## 5.0.2 - April 3, 2017 diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/Style.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/Style.java index fae3bdde2..77d0929df 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/Style.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/Style.java @@ -23,7 +23,7 @@ public class Style { * constants means your map style will always use the latest version and may change as we * improve the style */ - @StringDef( {MAPBOX_STREETS, OUTDOORS, LIGHT, DARK, SATELLITE, SATELLITE_STREETS}) + @StringDef( {MAPBOX_STREETS, OUTDOORS, LIGHT, DARK, SATELLITE, SATELLITE_STREETS, TRAFFIC_DAY, TRAFFIC_NIGHT}) @Retention(RetentionPolicy.SOURCE) public @interface StyleUrl { } @@ -67,4 +67,22 @@ public class Style { * improve the style. */ public static final String SATELLITE_STREETS = "mapbox://styles/mapbox/satellite-streets-v10"; + + /** + * Traffic Day: Color-coded roads based on live traffic congestion data. Traffic data is currently + * available in + * these select + * countries. Using this constant means your map style will always use the latest version and + * may change as we improve the style. + */ + public static final String TRAFFIC_DAY = "mapbox://styles/mapbox/traffic-day-v2"; + + /** + * Traffic Night: Color-coded roads based on live traffic congestion data, designed to maximize + * legibility in low-light situations. Traffic data is currently available in + * these select + * countries. Using this constant means your map style will always use the latest version and + * may change as we improve the style. + */ + public static final String TRAFFIC_NIGHT = "mapbox://styles/mapbox/traffic-night-v2"; } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values/strings.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values/strings.xml index 7adc29e2d..65fb3e14a 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values/strings.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values/strings.xml @@ -24,4 +24,6 @@ mapbox://styles/mapbox/dark-v9 mapbox://styles/mapbox/satellite-v9 mapbox://styles/mapbox/satellite-streets-v10 + mapbox://styles/mapbox/traffic-day-v2 + mapbox://styles/mapbox/traffic-night-v2 diff --git a/platform/darwin/src/MGLStyle.h b/platform/darwin/src/MGLStyle.h index 49898a186..26434eb49 100644 --- a/platform/darwin/src/MGLStyle.h +++ b/platform/darwin/src/MGLStyle.h @@ -231,6 +231,68 @@ MGL_EXPORT */ + (NSURL *)satelliteStreetsStyleURLWithVersion:(NSInteger)version; +/** + Returns the URL to the current version of the + Mapbox Traffic Day + style. + + Traffic Day color-codes roads based on live traffic congestion data. Traffic + data is currently available in + these select countries. + + @warning The return value may change in a future release of the SDK. If you use + any feature that depends on a specific aspect of a default style – for + instance, the minimum zoom level that includes roads – use the + `-trafficDayStyleURLWithVersion:` method instead. Such details may change + significantly from version to version. + */ ++ (NSURL *)trafficDayStyleURL; + +/** + Returns the URL to the given version of the + Mapbox Traffic Day + style as of publication. + + Traffic Day color-codes roads based on live traffic congestion data. Traffic + data is currently available in + these select countries. + + @param version A specific version of the style. + */ ++ (NSURL *)trafficDayStyleURLWithVersion:(NSInteger)version; + +/** + Returns the URL to the current version of the + Mapbox Traffic Night + style. + + Traffic Night color-codes roads based on live traffic congestion data and is + designed to maximize legibility in low-light situations. Traffic data is + currently available in + these select countries. + + @warning The return value may change in a future release of the SDK. If you use + any feature that depends on a specific aspect of a default style – for + instance, the minimum zoom level that includes roads – use the + `-trafficNightStyleURLWithVersion:` method instead. Such details may change + significantly from version to version. + */ ++ (NSURL *)trafficNightStyleURL; + +/** + Returns the URL to the given version of the + Mapbox Traffic Night + style as of publication. + + Traffic Night color-codes roads based on live traffic congestion data and is + designed to maximize legibility in low-light situations. Traffic data is + currently available in + these select countries. + + @param version A specific version of the style. + */ ++ (NSURL *)trafficNightStyleURLWithVersion:(NSInteger)version; + #pragma mark Accessing Metadata About the Style /** diff --git a/platform/darwin/src/MGLStyle.mm b/platform/darwin/src/MGLStyle.mm index ce9e55bb9..af02c31b6 100644 --- a/platform/darwin/src/MGLStyle.mm +++ b/platform/darwin/src/MGLStyle.mm @@ -80,10 +80,12 @@ MGL_DEFINE_STYLE(light, light) MGL_DEFINE_STYLE(dark, dark) MGL_DEFINE_STYLE(satellite, satellite) MGL_DEFINE_STYLE(satelliteStreets, satellite-streets) +MGL_DEFINE_STYLE(trafficDay, traffic-day) +MGL_DEFINE_STYLE(trafficNight, traffic-night) // 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, +static_assert(8 == 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. diff --git a/platform/darwin/test/MGLStyleTests.mm b/platform/darwin/test/MGLStyleTests.mm index a2ad1cbb3..f80d5776f 100644 --- a/platform/darwin/test/MGLStyleTests.mm +++ b/platform/darwin/test/MGLStyleTests.mm @@ -99,8 +99,16 @@ @(mbgl::util::default_styles::satelliteStreets.url)); XCTAssertEqualObjects([MGLStyle satelliteStreetsStyleURLWithVersion:99].absoluteString, @"mapbox://styles/mapbox/satellite-streets-v99"); + XCTAssertEqualObjects([MGLStyle trafficDayStyleURLWithVersion:mbgl::util::default_styles::trafficDay.currentVersion].absoluteString, + @(mbgl::util::default_styles::trafficDay.url)); + XCTAssertEqualObjects([MGLStyle trafficDayStyleURLWithVersion:99].absoluteString, + @"mapbox://styles/mapbox/traffic-day-v99"); + XCTAssertEqualObjects([MGLStyle trafficNightStyleURLWithVersion:mbgl::util::default_styles::trafficNight.currentVersion].absoluteString, + @(mbgl::util::default_styles::trafficNight.url)); + XCTAssertEqualObjects([MGLStyle trafficNightStyleURLWithVersion:99].absoluteString, + @"mapbox://styles/mapbox/traffic-night-v99"); - static_assert(6 == mbgl::util::default_styles::numOrderedStyles, + static_assert(8 == mbgl::util::default_styles::numOrderedStyles, "MGLStyleTests isn’t testing all the styles in mbgl::util::default_styles."); } diff --git a/platform/default/mbgl/util/default_styles.cpp b/platform/default/mbgl/util/default_styles.cpp index e051817ad..5f4ca862f 100644 --- a/platform/default/mbgl/util/default_styles.cpp +++ b/platform/default/mbgl/util/default_styles.cpp @@ -10,6 +10,8 @@ const DefaultStyle light = { "mapbox://styles/mapbox/light-v9", const DefaultStyle dark = { "mapbox://styles/mapbox/dark-v9", "Dark", 9 }; const DefaultStyle satellite = { "mapbox://styles/mapbox/satellite-v9", "Satellite", 9 }; const DefaultStyle satelliteStreets = { "mapbox://styles/mapbox/satellite-streets-v10", "Satellite Streets", 10 }; +const DefaultStyle trafficDay = { "mapbox://styles/mapbox/traffic-day-v2", "Traffic Day", 2 }; +const DefaultStyle trafficNight = { "mapbox://styles/mapbox/traffic-night-v2", "Traffic Night", 2 }; } // namespace default_styles } // end namespace util diff --git a/platform/default/mbgl/util/default_styles.hpp b/platform/default/mbgl/util/default_styles.hpp index 5e0d083d8..466102d62 100644 --- a/platform/default/mbgl/util/default_styles.hpp +++ b/platform/default/mbgl/util/default_styles.hpp @@ -19,9 +19,12 @@ extern const DefaultStyle light; extern const DefaultStyle dark; extern const DefaultStyle satellite; extern const DefaultStyle satelliteStreets; +extern const DefaultStyle trafficDay; +extern const DefaultStyle trafficNight; const DefaultStyle orderedStyles[] = { streets, outdoors, light, dark, satellite, satelliteStreets, + trafficDay, trafficNight, }; const size_t numOrderedStyles = sizeof(orderedStyles) / sizeof(DefaultStyle); diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index b975030b1..922b7b648 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -8,6 +8,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT * Added support for 3D extrusion of buildings and other polygonal features via the `MGLFillExtrusionStyleLayer` class and the `fill-extrusion` layer type in style JSON. ([#8431](https://github.com/mapbox/mapbox-gl-native/pull/8431)) * MGLMapView and MGLTilePyramidOfflineRegion now default to version 10 of the Mapbox Streets style. Similarly, several style URL class methods of MGLStyle return URLs to version 10 styles. Unversioned variations of these methods are no longer deprecated. `MGLStyleDefaultVersion` should no longer be used with any style other than Streets. ([#6301](https://github.com/mapbox/mapbox-gl-native/pull/6301)) +* Added class methods to MGLStyle that correspond to the new [Traffic Day and Traffic Night](https://www.mapbox.com/blog/live-traffic-maps/) styles. ([#6301](https://github.com/mapbox/mapbox-gl-native/pull/6301)) * MGLSymbolStyleLayer’s `iconImageName`, `iconScale`, `textFontSize`, `textOffset`, and `textRotation` properties can now be set to a source or composite function. ([#8544](https://github.com/mapbox/mapbox-gl-native/pull/8544), [#8590](https://github.com/mapbox/mapbox-gl-native/pull/8590), [#8592](https://github.com/mapbox/mapbox-gl-native/pull/8592), [#8593](https://github.com/mapbox/mapbox-gl-native/pull/8593)) * Fixed an issue where setting the `MGLVectorStyleLayer.predicate` property failed to take effect if the relevant source was not in use by a visible layer at the time. ([#8653](https://github.com/mapbox/mapbox-gl-native/pull/8653)) * Fixed an issue causing a composite function’s highest zoom level stop to be misinterpreted. ([#8613](https://github.com/mapbox/mapbox-gl-native/pull/8613), [#8790](https://github.com/mapbox/mapbox-gl-native/pull/8790)) diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m index 3e61ec8dd..7cbe9d594 100644 --- a/platform/ios/app/MBXViewController.m +++ b/platform/ios/app/MBXViewController.m @@ -1542,14 +1542,18 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { @"Dark", @"Satellite", @"Satellite Streets", + @"Traffic Day", + @"Traffic Night", ]; styleURLs = @[ - [MGLStyle streetsStyleURLWithVersion:MGLStyleDefaultVersion], - [MGLStyle outdoorsStyleURLWithVersion:MGLStyleDefaultVersion], - [MGLStyle lightStyleURLWithVersion:MGLStyleDefaultVersion], - [MGLStyle darkStyleURLWithVersion:MGLStyleDefaultVersion], - [MGLStyle satelliteStyleURLWithVersion:MGLStyleDefaultVersion], - [MGLStyle satelliteStreetsStyleURLWithVersion:MGLStyleDefaultVersion], + [MGLStyle streetsStyleURL], + [MGLStyle outdoorsStyleURL], + [MGLStyle lightStyleURL], + [MGLStyle darkStyleURL], + [MGLStyle satelliteStyleURL], + [MGLStyle satelliteStreetsStyleURL], + [MGLStyle trafficDayStyleURL], + [MGLStyle trafficNightStyleURL], ]; NSAssert(styleNames.count == styleURLs.count, @"Style names and URLs don’t match."); diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md index 298cc8ecf..632bcfa44 100644 --- a/platform/macos/CHANGELOG.md +++ b/platform/macos/CHANGELOG.md @@ -6,6 +6,7 @@ * Added support for 3D extrusion of buildings and other polygonal features via the `MGLFillExtrusionStyleLayer` class and the `fill-extrusion` layer type in style JSON. ([#8431](https://github.com/mapbox/mapbox-gl-native/pull/8431)) * MGLMapView and MGLTilePyramidOfflineRegion now default to version 10 of the Mapbox Streets style. Similarly, several style URL class methods of MGLStyle return URLs to version 10 styles. Unversioned variations of these methods are no longer deprecated. `MGLStyleDefaultVersion` should no longer be used with any style other than Streets. ([#6301](https://github.com/mapbox/mapbox-gl-native/pull/6301)) +* Added class methods to MGLStyle that correspond to the new [Traffic Day and Traffic Night](https://www.mapbox.com/blog/live-traffic-maps/) styles. ([#6301](https://github.com/mapbox/mapbox-gl-native/pull/6301)) * MGLSymbolStyleLayer’s `iconImageName`, `iconScale`, `textFontSize`, `textOffset`, and `textRotation` properties can now be set to a source or composite function. ([#8544](https://github.com/mapbox/mapbox-gl-native/pull/8544), [#8590](https://github.com/mapbox/mapbox-gl-native/pull/8590), [#8592](https://github.com/mapbox/mapbox-gl-native/pull/8592), [#8593](https://github.com/mapbox/mapbox-gl-native/pull/8593)) * Fixed an issue where setting the `MGLVectorStyleLayer.predicate` property failed to take effect if the relevant source was not in use by a visible layer at the time. ([#8653](https://github.com/mapbox/mapbox-gl-native/pull/8653)) * Fixed an issue causing a composite function’s highest zoom level stop to be misinterpreted. ([#8613](https://github.com/mapbox/mapbox-gl-native/pull/8613), [#8790](https://github.com/mapbox/mapbox-gl-native/pull/8790)) diff --git a/platform/macos/app/Base.lproj/MainMenu.xib b/platform/macos/app/Base.lproj/MainMenu.xib index 941bed213..20a4f65b3 100644 --- a/platform/macos/app/Base.lproj/MainMenu.xib +++ b/platform/macos/app/Base.lproj/MainMenu.xib @@ -1,7 +1,7 @@ - - + + - + @@ -395,6 +395,16 @@ + + + + + + + + + + @@ -643,7 +653,7 @@ CA - + @@ -654,7 +664,7 @@ CA - + @@ -723,7 +733,7 @@ CA - + diff --git a/platform/macos/app/Base.lproj/MapDocument.xib b/platform/macos/app/Base.lproj/MapDocument.xib index 065acc41f..d95f21b2e 100644 --- a/platform/macos/app/Base.lproj/MapDocument.xib +++ b/platform/macos/app/Base.lproj/MapDocument.xib @@ -1,7 +1,7 @@ - + - + @@ -48,7 +48,7 @@ - + @@ -183,9 +183,9 @@ - + - + @@ -204,6 +204,12 @@ + + + + + + diff --git a/platform/macos/app/MapDocument.m b/platform/macos/app/MapDocument.m index 5be17c1cb..59c1817f6 100644 --- a/platform/macos/app/MapDocument.m +++ b/platform/macos/app/MapDocument.m @@ -165,22 +165,28 @@ NS_ARRAY_OF(id ) *MBXFlattenedShapes(NS_ARRAY_OF(id ) *MBXFlattenedShapes(NS_ARRAY_OF(id ) *MBXFlattenedShapes(NS_ARRAY_OF(id