fixes #892: support mapbox:// style URLs

This commit is contained in:
Justin R. Miller
2015-03-30 15:33:02 -07:00
parent 3ed1e7a695
commit a8833c34d4
4 changed files with 31 additions and 9 deletions

View File

@@ -400,13 +400,15 @@ void Map::setup() {
void Map::setStyleURL(const std::string &url) {
assert(Environment::currentlyOn(ThreadType::Main));
const size_t pos = url.rfind('/');
const std::string styleURL = mbgl::util::mapbox::normalizeStyleURL(url, getAccessToken());
const size_t pos = styleURL.rfind('/');
std::string base = "";
if (pos != std::string::npos) {
base = url.substr(0, pos + 1);
base = styleURL.substr(0, pos + 1);
}
data->setStyleInfo({ url, base, "" });
data->setStyleInfo({ styleURL, base, "" });
triggerUpdate(Update::StyleInfo);
}