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 /src/mbgl/annotation | |
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 'src/mbgl/annotation')
-rw-r--r-- | src/mbgl/annotation/annotation_source.cpp | 8 | ||||
-rw-r--r-- | src/mbgl/annotation/annotation_source.hpp | 4 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/mbgl/annotation/annotation_source.cpp b/src/mbgl/annotation/annotation_source.cpp index 7a137f1881..318241a914 100644 --- a/src/mbgl/annotation/annotation_source.cpp +++ b/src/mbgl/annotation/annotation_source.cpp @@ -14,6 +14,10 @@ AnnotationSource::Impl::Impl() : Source::Impl(SourceType::Annotations, AnnotationManager::SourceID) { } +const AnnotationSource::Impl& AnnotationSource::impl() const { + return static_cast<const Impl&>(*baseImpl); +} + void AnnotationSource::loadDescription(FileSource&) { loaded = true; } @@ -26,4 +30,8 @@ bool AnnotationSource::supportsLayerType(const mbgl::style::LayerTypeInfo* info) return !std::strcmp(info->type, "line") || !std::strcmp(info->type, "symbol") || !std::strcmp(info->type, "fill"); } +Mutable<Source::Impl> AnnotationSource::createMutable() const noexcept { + return staticMutableCast<Source::Impl>(makeMutable<Impl>(impl())); +} + } // namespace mbgl diff --git a/src/mbgl/annotation/annotation_source.hpp b/src/mbgl/annotation/annotation_source.hpp index 0379426b3e..de432202a0 100644 --- a/src/mbgl/annotation/annotation_source.hpp +++ b/src/mbgl/annotation/annotation_source.hpp @@ -12,13 +12,15 @@ public: class Impl; const Impl& impl() const; +protected: + Mutable<Source::Impl> createMutable() const noexcept final; + private: void loadDescription(FileSource&) final; bool supportsLayerType(const mbgl::style::LayerTypeInfo*) const override; mapbox::base::WeakPtr<Source> makeWeakPtr() override { return weakFactory.makeWeakPtr(); } - Mutable<Impl> mutableImpl() const; mapbox::base::WeakPtrFactory<Source> weakFactory {this}; }; |