Allow using tileSize: 512 as a switch to trade retina support for 512px raster tiles

This commit is contained in:
Young Hahn
2016-02-02 04:29:27 -05:00
committed by John Firebaugh
parent 7ca602b739
commit 43c44eccdc
8 changed files with 56 additions and 31 deletions

View File

@@ -256,7 +256,7 @@ std::unique_ptr<mapbox::geojsonvt::GeoJSONVT> StyleParser::parseGeoJSON(const JS
}
}
std::unique_ptr<SourceInfo> StyleParser::parseTileJSON(const std::string& json, const std::string& sourceURL, SourceType type) {
std::unique_ptr<SourceInfo> StyleParser::parseTileJSON(const std::string& json, const std::string& sourceURL, SourceType type, uint16_t tileSize) {
rapidjson::GenericDocument<rapidjson::UTF8<>, rapidjson::CrtAllocator> document;
document.Parse<0>(json.c_str());
@@ -270,10 +270,9 @@ std::unique_ptr<SourceInfo> StyleParser::parseTileJSON(const std::string& json,
// TODO: Remove this hack by delivering proper URLs in the TileJSON to begin with.
if (util::mapbox::isMapboxURL(sourceURL)) {
std::transform(result->tiles.begin(),
result->tiles.end(),
result->tiles.begin(),
std::bind(util::mapbox::canonicalizeTileURL, std::placeholders::_1, type));
for (auto& url : result->tiles) {
url = util::mapbox::canonicalizeTileURL(url, type, tileSize);
}
}
return result;