summaryrefslogtreecommitdiff
path: root/platform/darwin
diff options
context:
space:
mode:
Diffstat (limited to 'platform/darwin')
-rw-r--r--platform/darwin/src/MGLStyle.h62
-rw-r--r--platform/darwin/src/MGLStyle.mm4
-rw-r--r--platform/darwin/test/MGLStyleTests.mm12
3 files changed, 75 insertions, 3 deletions
diff --git a/platform/darwin/src/MGLStyle.h b/platform/darwin/src/MGLStyle.h
index 49898a1863..26434eb492 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
+ <a href="https://www.mapbox.com/blog/live-traffic-maps/">Mapbox Traffic Day</a>
+ style.
+
+ Traffic Day color-codes roads based on live traffic congestion data. Traffic
+ data is currently available in
+ <a href="https://www.mapbox.com/api-documentation/pages/traffic-countries.html">these select countries</a>.
+
+ @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
+ <a href="https://www.mapbox.com/blog/live-traffic-maps/">Mapbox Traffic Day</a>
+ style as of publication.
+
+ Traffic Day color-codes roads based on live traffic congestion data. Traffic
+ data is currently available in
+ <a href="https://www.mapbox.com/api-documentation/pages/traffic-countries.html">these select countries</a>.
+
+ @param version A specific version of the style.
+ */
++ (NSURL *)trafficDayStyleURLWithVersion:(NSInteger)version;
+
+/**
+ Returns the URL to the current version of the
+ <a href="https://www.mapbox.com/blog/live-traffic-maps/">Mapbox Traffic Night</a>
+ 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
+ <a href="https://www.mapbox.com/api-documentation/pages/traffic-countries.html">these select countries</a>.
+
+ @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
+ <a href="https://www.mapbox.com/blog/live-traffic-maps/">Mapbox Traffic Night</a>
+ 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
+ <a href="https://www.mapbox.com/api-documentation/pages/traffic-countries.html">these select countries</a>.
+
+ @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 ce9e55bb99..af02c31b6d 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 a2ad1cbb3f..f80d5776f0 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");
-
- static_assert(6 == mbgl::util::default_styles::numOrderedStyles,
+ 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(8 == mbgl::util::default_styles::numOrderedStyles,
"MGLStyleTests isn’t testing all the styles in mbgl::util::default_styles.");
}