summaryrefslogtreecommitdiff
path: root/src/mbgl/style/sources/vector_source.cpp
diff options
context:
space:
mode:
authorzmiao <miao.zhao@mapbox.com>2019-09-17 18:00:37 +0300
committerGitHub <noreply@github.com>2019-09-17 18:00:37 +0300
commit0a219d182c422e181b29c9dcc60c18ceafe1db48 (patch)
tree1bd715f0fcccff1ab3b97c0951712ea5358f7fe1 /src/mbgl/style/sources/vector_source.cpp
parent4f910734149b59e3babb5a4c22cc398f13ca4364 (diff)
downloadqtlocation-mapboxgl-0a219d182c422e181b29c9dcc60c18ceafe1db48.tar.gz
[Core] Fix wrong `maxzoom` setting of tileSet when using URL source (#15581)
* [core] Take max/min zoom option from style if they are set * [core] std::move input value * [Core] Add changelogs * [Core] Fix clang-format reported error * [Core] fix clang-tidy reported error
Diffstat (limited to 'src/mbgl/style/sources/vector_source.cpp')
-rw-r--r--src/mbgl/style/sources/vector_source.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/mbgl/style/sources/vector_source.cpp b/src/mbgl/style/sources/vector_source.cpp
index f103a7768f..a69ff632d8 100644
--- a/src/mbgl/style/sources/vector_source.cpp
+++ b/src/mbgl/style/sources/vector_source.cpp
@@ -11,10 +11,12 @@
namespace mbgl {
namespace style {
-VectorSource::VectorSource(std::string id, variant<std::string, Tileset> urlOrTileset_)
+VectorSource::VectorSource(std::string id, variant<std::string, Tileset> urlOrTileset_, optional<float> maxZoom_,
+ optional<float> minZoom_)
: Source(makeMutable<Impl>(std::move(id))),
- urlOrTileset(std::move(urlOrTileset_)) {
-}
+ urlOrTileset(std::move(urlOrTileset_)),
+ maxZoom(std::move(maxZoom_)),
+ minZoom(std::move(minZoom_)) {}
VectorSource::~VectorSource() = default;
@@ -61,7 +63,12 @@ void VectorSource::loadDescription(FileSource& fileSource) {
observer->onSourceError(*this, std::make_exception_ptr(util::StyleParseException(error.message)));
return;
}
-
+ if (maxZoom) {
+ tileset->zoomRange.max = *maxZoom;
+ }
+ if (minZoom) {
+ tileset->zoomRange.min = *minZoom;
+ }
util::mapbox::canonicalizeTileset(*tileset, url, getType(), util::tileSize);
bool changed = impl().tileset != *tileset;