[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
This commit is contained in:
zmiao
2019-09-17 18:00:37 +03:00
committed by GitHub
parent 4f91073414
commit 0a219d182c
7 changed files with 38 additions and 7 deletions

View File

@@ -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;