summaryrefslogtreecommitdiff
path: root/src/mbgl/util/mapbox.cpp
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-05-05 16:31:03 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-05-08 13:48:57 -0700
commitbaaae99a03202641ae5b8024e57b691fe61a6688 (patch)
tree459045e56197696aa1312594f1e452b03931775d /src/mbgl/util/mapbox.cpp
parente34d8b5c802186008e49364668e4a7bd5668d0fd (diff)
downloadqtlocation-mapboxgl-baaae99a03202641ae5b8024e57b691fe61a6688.tar.gz
[core, android] Factor JSON string conversions
This adds a `convertJSON` template, to be used like: Error error optional<Foo> foo = convertJSON<Foo>(string, error); Internally, it parses the string with RapidJSON and then calls `convert<Foo>(parsed, error)`. While here, rationalize GeoJSON converters and fix error handling for Tileset conversion in OfflineDownload.
Diffstat (limited to 'src/mbgl/util/mapbox.cpp')
-rw-r--r--src/mbgl/util/mapbox.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mbgl/util/mapbox.cpp b/src/mbgl/util/mapbox.cpp
index c03cc2a8e7..8cbc85d492 100644
--- a/src/mbgl/util/mapbox.cpp
+++ b/src/mbgl/util/mapbox.cpp
@@ -2,6 +2,7 @@
#include <mbgl/util/constants.hpp>
#include <mbgl/util/logging.hpp>
#include <mbgl/util/url.hpp>
+#include <mbgl/util/tileset.hpp>
#include <stdexcept>
#include <vector>
@@ -170,6 +171,15 @@ canonicalizeTileURL(const std::string& str, const SourceType type, const uint16_
return result;
}
+void canonicalizeTileset(Tileset& tileset, const std::string& sourceURL, SourceType type, uint16_t tileSize) {
+ // TODO: Remove this hack by delivering proper URLs in the TileJSON to begin with.
+ if (isMapboxURL(sourceURL)) {
+ for (auto& url : tileset.tiles) {
+ url = canonicalizeTileURL(url, type, tileSize);
+ }
+ }
+}
+
const uint64_t DEFAULT_OFFLINE_TILE_COUNT_LIMIT = 6000;
} // end namespace mapbox