-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Replace bundled styles with mapbox: style URLs #2746
Conversation
c6215bb
to
785fe7d
Compare
We also need to deprecate or remove the bundledStyleURLs property from MGLMapView, since that property always returns an empty array. We can deprecate it with a compile-time message instructing developers to look at some webpage for a list of always-available styles, but we need to have that webpage ready. |
@1ec5 can we make it return a list of |
That’s not a bad idea. We’d just base it off default_styles.cpp, which would enable us to nix the parallel list we’ve compiled in MBXViewController. We’d still need to rename the method, though: the styles aren’t “bundled”, just universally available, regardless of access token. |
@1ec5 I was thinking more from source compatibility perspective but next release is breaking anyway right? |
You’re right, we should mark |
|
021b4c5
to
1dc287c
Compare
I’ve completed the iOS side of this change. There’s a new class MGLStyle that – for now – does nothing but vend style URLs in a manner similar to UIColor. It would make for a great entry point an iOS runtime styling API as part of #837. Unlike Style.java on the Android side, MGLStyle gets its values directly from a refactored default_styles.hpp and uses static assertions to stay in sync. So that takes care of #1462. Objective-C++, o happy day! The upshot for other platforms is that there are now individual constants for each “default style” (that is, a style that’s available regardless of access token). There’s still a constant C array of them in case you need to iterate over them. @jfirebaugh, does my C++ look reasonable? @incanus, can you forgive my macro shenanigans? |
namespace default_styles { | ||
|
||
struct DefaultStyle { | ||
const char *url; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our style for C++ is to space *
and &
with the rest of the type, so const char* url
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Old habits die hard: e13535eda83116ced526c6785e9596e25bdfaac2.
LGTM other than the one nit. |
Excellent, when your happy @1ec5 I think we can squash, get Travis green, final set of eyes, then merge. |
df0ccaa
to
fc42fbf
Compare
Running into #2022. |
@1ec5 is that the right ticket number? |
Yes, that was precisely what I and Travis were both hitting, but now it’s green again. Go figure. |
I’ve come back around to the idea of deprecating and eventually removing |
Also renamed styles to more common names.
Moved mbgl::util::default_styles to a more appropriate location, where iOS platform code can also find it. Moved -[MGLMapView bundledStyleURLs] (which is now deprecated) and the style switcher in iosapp to default_styles. Added a collection of convenience methods for getting style URLs. It makes little sense to layer an enum atop this, as MapKit does, because MGLMapView styles aren’t limited to this set. A good analogy is UIColor. This also makes for a good entry point for future runtime styling APIs. Introduced independent constants for each default style, because it’s more common to need access to a particular style than to iterate over them. This fact is apparent in the MGLStyle class, which now uses macros and assertions to ensure that it’s kept up-to-date with changes in default_styles. /ref #1462
bf7849f
to
557b8af
Compare
As of #2746, we no longer bundle any styles with the SDK, so the asset: URL scheme is unused. Instead, point asset: to the application root for developer convenience and consistency with the Android and default asset roots. Also fixed an issue that prevented relative URLs from being treated as asset: URLs. Fixes #1208, fixes #3050.
As of #2746, we no longer bundle any styles with the SDK, so the asset: URL scheme is unused. Instead, point asset: to the application root for developer convenience and consistency with the Android and default asset roots. Also fixed an issue that prevented relative URLs from being treated as asset: URLs. Fixes #1208, fixes #3050.
Fixes #2239