diff options
author | Lucas Wojciechowski <lucas@mapbox.com> | 2015-08-24 13:37:59 -0700 |
---|---|---|
committer | Lucas Wojciechowski <lucas@mapbox.com> | 2015-08-24 14:22:02 -0700 |
commit | 648b5879599f6587eb7df36b4e951ec761c6437a (patch) | |
tree | cbc06076b8c2d44292fbf8b3f48095dcc7320f28 /src | |
parent | c6aee1aadd333b75bc669d3a62d7009fd875a281 (diff) | |
download | qtlocation-mapboxgl-648b5879599f6587eb7df36b4e951ec761c6437a.tar.gz |
Fixed missing labels and icons
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/util/mapbox.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/mbgl/util/mapbox.cpp b/src/mbgl/util/mapbox.cpp index dee0e0f8f4..70587ac5ad 100644 --- a/src/mbgl/util/mapbox.cpp +++ b/src/mbgl/util/mapbox.cpp @@ -2,6 +2,7 @@ #include <stdexcept> #include <vector> +#include <iostream> namespace mbgl { namespace util { @@ -19,7 +20,12 @@ std::vector<std::string> getMapboxURLPathname(const std::string& url) { std::size_t startIndex = protocol.length(); while (startIndex < url.length()) { std::size_t endIndex = url.find("/", startIndex); - if (endIndex == std::string::npos) endIndex = url.length(); + if (endIndex == std::string::npos) { + endIndex = url.find_first_of("?#"); + } + if (endIndex == std::string::npos) { + endIndex = url.length(); + } pathname.push_back(url.substr(startIndex, endIndex - startIndex)); startIndex = endIndex + 1; } @@ -80,7 +86,10 @@ std::string normalizeGlyphsURL(const std::string& url, const std::string& access std::vector<std::string> pathname = getMapboxURLPathname(url); std::string user = pathname[1]; - return baseURL + "fonts/v1/" + user + "/{fontstack}/{range}.pbf?access_token=" + accessToken; + std::string fontstack = pathname[2]; + std::string range = pathname[3]; + + return baseURL + "fonts/v1/" + user + "/" + fontstack + "/" + range + "?access_token=" + accessToken; } std::string normalizeTileURL(const std::string& url, const std::string& sourceURL, SourceType sourceType) { |