diff options
author | Ansis Brammanis <brammanis@gmail.com> | 2016-03-30 12:20:55 -0700 |
---|---|---|
committer | Ansis Brammanis <brammanis@gmail.com> | 2016-03-30 13:57:47 -0700 |
commit | b6a181097c3e7c3168be3575d5d7e95820fc74ba (patch) | |
tree | 4f11720a5c0438176ab267dac9691597a3c4c531 | |
parent | 8e9e779f2fc8b7a8fa44204870afad51b87eb703 (diff) | |
download | qtlocation-mapboxgl-b6a181097c3e7c3168be3575d5d7e95820fc74ba.tar.gz |
[core] fix reparsing overscaled geojson tiles
fix #3838
m--------- | .mason | 0 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | platform/android/scripts/configure.sh | 2 | ||||
-rw-r--r-- | platform/ios/scripts/configure.sh | 2 | ||||
-rw-r--r-- | platform/linux/scripts/configure.sh | 2 | ||||
-rw-r--r-- | platform/osx/scripts/configure.sh | 2 | ||||
-rw-r--r-- | src/mbgl/annotation/shape_annotation_impl.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/source/source.cpp | 9 | ||||
-rw-r--r-- | src/mbgl/style/style_parser.cpp | 7 | ||||
-rw-r--r-- | src/mbgl/tile/geojson_tile.cpp | 2 |
10 files changed, 15 insertions, 15 deletions
diff --git a/.mason b/.mason -Subproject e93ea69408d97cb8bd257f8bd2427189e8dbae3 +Subproject 1894e99a1241790f3eda9f10c3880cda1b40c75 diff --git a/package.json b/package.json index 273147387d..0e13d328b5 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ ], "devDependencies": { "aws-sdk": "^2.2.21", - "mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#4e47d234da96c87356c508575cda5e6aa0065751", + "mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#fc3f2302bfc50ac5c779d4685d3353ee4a388eb1", "node-gyp": "^3.2.1", "request": "^2.67.0", "tape": "^4.2.2" diff --git a/platform/android/scripts/configure.sh b/platform/android/scripts/configure.sh index 191953e8d9..9c33532366 100644 --- a/platform/android/scripts/configure.sh +++ b/platform/android/scripts/configure.sh @@ -8,7 +8,7 @@ LIBUV_VERSION=1.7.5 ZLIB_VERSION=system NUNICODE_VERSION=1.6 LIBZIP_VERSION=0.11.2 -GEOJSONVT_VERSION=4.0.0 +GEOJSONVT_VERSION=4.1.0 VARIANT_VERSION=1.1.0 RAPIDJSON_VERSION=1.0.2 JNI_HPP_VERSION=2.0.0 diff --git a/platform/ios/scripts/configure.sh b/platform/ios/scripts/configure.sh index 32e2900eba..a62de46bef 100644 --- a/platform/ios/scripts/configure.sh +++ b/platform/ios/scripts/configure.sh @@ -4,7 +4,7 @@ BOOST_VERSION=1.59.0 SQLITE_VERSION=system LIBUV_VERSION=1.7.5 ZLIB_VERSION=system -GEOJSONVT_VERSION=4.0.0 +GEOJSONVT_VERSION=4.1.0 VARIANT_VERSION=1.1.0 RAPIDJSON_VERSION=1.0.2 GTEST_VERSION=1.7.0 diff --git a/platform/linux/scripts/configure.sh b/platform/linux/scripts/configure.sh index 6df7f2805f..410faaf442 100644 --- a/platform/linux/scripts/configure.sh +++ b/platform/linux/scripts/configure.sh @@ -10,7 +10,7 @@ SQLITE_VERSION=3.9.1 LIBUV_VERSION=1.7.5 ZLIB_VERSION=system NUNICODE_VERSION=1.6 -GEOJSONVT_VERSION=4.0.0 +GEOJSONVT_VERSION=4.1.0 VARIANT_VERSION=1.1.0 RAPIDJSON_VERSION=1.0.2 GTEST_VERSION=1.7.0 diff --git a/platform/osx/scripts/configure.sh b/platform/osx/scripts/configure.sh index 7fb8f97637..ece6bba102 100644 --- a/platform/osx/scripts/configure.sh +++ b/platform/osx/scripts/configure.sh @@ -8,7 +8,7 @@ SQLITE_VERSION=3.9.1 LIBUV_VERSION=1.7.5 ZLIB_VERSION=system NUNICODE_VERSION=1.6 -GEOJSONVT_VERSION=4.0.0 +GEOJSONVT_VERSION=4.1.0 VARIANT_VERSION=1.1.0 RAPIDJSON_VERSION=1.0.2 GTEST_VERSION=1.7.0 diff --git a/src/mbgl/annotation/shape_annotation_impl.cpp b/src/mbgl/annotation/shape_annotation_impl.cpp index c333492810..cac5fa0725 100644 --- a/src/mbgl/annotation/shape_annotation_impl.cpp +++ b/src/mbgl/annotation/shape_annotation_impl.cpp @@ -114,7 +114,7 @@ void ShapeAnnotationImpl::updateTile(const TileID& tileID, AnnotationTile& tile) shapeTiler = std::make_unique<mapbox::geojsonvt::GeoJSONVT>(features, options); } - const auto& shapeTile = shapeTiler->getTile(tileID.z, tileID.x, tileID.y); + const auto& shapeTile = shapeTiler->getTile(tileID.sourceZ, tileID.x, tileID.y); if (!shapeTile) return; diff --git a/src/mbgl/source/source.cpp b/src/mbgl/source/source.cpp index 967a829ee9..262fc0871c 100644 --- a/src/mbgl/source/source.cpp +++ b/src/mbgl/source/source.cpp @@ -127,7 +127,7 @@ void Source::load(FileSource& fileSource) { info = std::move(newInfo); } else if (type == SourceType::GeoJSON) { - info = std::make_unique<SourceInfo>(); + std::unique_ptr<SourceInfo> newInfo = std::make_unique<SourceInfo>(); rapidjson::GenericDocument<rapidjson::UTF8<>, rapidjson::CrtAllocator> d; d.Parse<0>(res.data->c_str()); @@ -141,6 +141,9 @@ void Source::load(FileSource& fileSource) { geojsonvt = StyleParser::parseGeoJSON(d); reloadTiles = true; + + newInfo->maxZoom = geojsonvt->options.maxZoom; + info = std::move(newInfo); } if (reloadTiles) { @@ -352,9 +355,7 @@ bool Source::update(const StyleUpdateParameters& parameters) { int32_t maxCoveringZoom = util::clamp<int32_t>(zoom + 1, info->minZoom, info->maxZoom); if (zoom >= info->minZoom) { - const bool reparseOverscaled = - type == SourceType::Vector || - type == SourceType::Annotations; + const bool reparseOverscaled = type != SourceType::Raster; const auto actualZ = zoom; if (zoom > info->maxZoom) { diff --git a/src/mbgl/style/style_parser.cpp b/src/mbgl/style/style_parser.cpp index be26af56ad..cea0a95a22 100644 --- a/src/mbgl/style/style_parser.cpp +++ b/src/mbgl/style/style_parser.cpp @@ -203,6 +203,8 @@ void StyleParser::parseSources(const JSValue& value) { break; case SourceType::GeoJSON: + info = std::make_unique<SourceInfo>(); + // We should probably split this up to have URLs in the url property, and actual data // in the data property. Until then, we're going to detect the content based on the // object type. @@ -213,8 +215,8 @@ void StyleParser::parseSources(const JSValue& value) { url = { dataVal.GetString(), dataVal.GetStringLength() }; } else if (dataVal.IsObject()) { // We need to parse dataVal as a GeoJSON object - // TODO: parse GeoJSON data geojsonvt = parseGeoJSON(dataVal); + info->maxZoom = geojsonvt->options.maxZoom; } else { Log::Error(Event::ParseStyle, "GeoJSON data must be a URL or an object"); continue; @@ -224,9 +226,6 @@ void StyleParser::parseSources(const JSValue& value) { continue; } - // We always assume the default configuration for GeoJSON sources. - info = std::make_unique<SourceInfo>(); - break; default: diff --git a/src/mbgl/tile/geojson_tile.cpp b/src/mbgl/tile/geojson_tile.cpp index 31f2443ced..39cca01728 100644 --- a/src/mbgl/tile/geojson_tile.cpp +++ b/src/mbgl/tile/geojson_tile.cpp @@ -119,7 +119,7 @@ void GeoJSONTileMonitor::setGeoJSONVT(mapbox::geojsonvt::GeoJSONVT* vt) { void GeoJSONTileMonitor::update() { if (geojsonvt) { - auto tile = convertTile(geojsonvt->getTile(tileID.z, tileID.x, tileID.y)); + auto tile = convertTile(geojsonvt->getTile(tileID.sourceZ, tileID.x, tileID.y)); callback(nullptr, std::move(tile), {}, {}); } } |