diff options
author | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2020-02-06 09:44:49 +0200 |
---|---|---|
committer | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2020-02-11 10:40:30 +0200 |
commit | fce4129435ddc5f14abdd1e2ed6a74bf84e1c496 (patch) | |
tree | b0195f13b1783298f940dc0ccf72dac6098532dd /include/mbgl/style | |
parent | a23100586098c2d44682444cdd31001f1eba5859 (diff) | |
download | qtlocation-mapboxgl-fce4129435ddc5f14abdd1e2ed6a74bf84e1c496.tar.gz |
[core] Add runtime API for setting tile prefetch delta for Source
New setPrefetchZoomDelta(optional<uint8_t> delta) method allow overriding
default tile prefetch setting that is defined by the Map instance. The
method can be moved to generic style specification if found to be useful
for gl-js engine.
Diffstat (limited to 'include/mbgl/style')
-rw-r--r-- | include/mbgl/style/source.hpp | 5 | ||||
-rw-r--r-- | include/mbgl/style/sources/custom_geometry_source.hpp | 4 | ||||
-rw-r--r-- | include/mbgl/style/sources/geojson_source.hpp | 3 | ||||
-rw-r--r-- | include/mbgl/style/sources/image_source.hpp | 4 | ||||
-rw-r--r-- | include/mbgl/style/sources/raster_source.hpp | 3 | ||||
-rw-r--r-- | include/mbgl/style/sources/vector_source.hpp | 3 |
6 files changed, 22 insertions, 0 deletions
diff --git a/include/mbgl/style/source.hpp b/include/mbgl/style/source.hpp index c3c0609a9f..59afd6916e 100644 --- a/include/mbgl/style/source.hpp +++ b/include/mbgl/style/source.hpp @@ -73,6 +73,8 @@ public: SourceObserver* observer = nullptr; virtual void loadDescription(FileSource&) = 0; + void setPrefetchZoomDelta(optional<uint8_t> delta) noexcept; + optional<uint8_t> getPrefetchZoomDelta() const noexcept; void dumpDebugLogs() const; virtual bool supportsLayerType(const mbgl::style::LayerTypeInfo*) const = 0; @@ -85,6 +87,9 @@ public: mapbox::base::TypeWrapper peer; virtual mapbox::base::WeakPtr<Source> makeWeakPtr() = 0; + +protected: + virtual Mutable<Impl> createMutable() const noexcept = 0; }; } // namespace style diff --git a/include/mbgl/style/sources/custom_geometry_source.hpp b/include/mbgl/style/sources/custom_geometry_source.hpp index ff04505699..504ec42ea8 100644 --- a/include/mbgl/style/sources/custom_geometry_source.hpp +++ b/include/mbgl/style/sources/custom_geometry_source.hpp @@ -50,6 +50,10 @@ public: mapbox::base::WeakPtr<Source> makeWeakPtr() override { return weakFactory.makeWeakPtr(); } + +protected: + Mutable<Source::Impl> createMutable() const noexcept final; + private: std::shared_ptr<ThreadPool> threadPool; std::unique_ptr<Actor<CustomTileLoader>> loader; diff --git a/include/mbgl/style/sources/geojson_source.hpp b/include/mbgl/style/sources/geojson_source.hpp index 750d29627d..4bd250b895 100644 --- a/include/mbgl/style/sources/geojson_source.hpp +++ b/include/mbgl/style/sources/geojson_source.hpp @@ -81,6 +81,9 @@ public: return weakFactory.makeWeakPtr(); } +protected: + Mutable<Source::Impl> createMutable() const noexcept final; + private: optional<std::string> url; std::unique_ptr<AsyncRequest> req; diff --git a/include/mbgl/style/sources/image_source.hpp b/include/mbgl/style/sources/image_source.hpp index 699a3c6494..d2b7c37bdf 100644 --- a/include/mbgl/style/sources/image_source.hpp +++ b/include/mbgl/style/sources/image_source.hpp @@ -33,6 +33,10 @@ public: mapbox::base::WeakPtr<Source> makeWeakPtr() override { return weakFactory.makeWeakPtr(); } + +protected: + Mutable<Source::Impl> createMutable() const noexcept final; + private: optional<std::string> url; std::unique_ptr<AsyncRequest> req; diff --git a/include/mbgl/style/sources/raster_source.hpp b/include/mbgl/style/sources/raster_source.hpp index 00a3b788c2..e06c3404e9 100644 --- a/include/mbgl/style/sources/raster_source.hpp +++ b/include/mbgl/style/sources/raster_source.hpp @@ -31,6 +31,9 @@ public: return weakFactory.makeWeakPtr(); } +protected: + Mutable<Source::Impl> createMutable() const noexcept final; + private: const variant<std::string, Tileset> urlOrTileset; std::unique_ptr<AsyncRequest> req; diff --git a/include/mbgl/style/sources/vector_source.hpp b/include/mbgl/style/sources/vector_source.hpp index 4165af0a61..83fcae95d6 100644 --- a/include/mbgl/style/sources/vector_source.hpp +++ b/include/mbgl/style/sources/vector_source.hpp @@ -30,6 +30,9 @@ public: return weakFactory.makeWeakPtr(); } +protected: + Mutable<Source::Impl> createMutable() const noexcept final; + private: const variant<std::string, Tileset> urlOrTileset; std::unique_ptr<AsyncRequest> req; |