[core] Add style::Source::setVolatile()/isVolatile() API
This commit is contained in:
@@ -27,6 +27,18 @@ optional<std::string> Source::getAttribution() const {
|
||||
return baseImpl->getAttribution();
|
||||
}
|
||||
|
||||
bool Source::isVolatile() const noexcept {
|
||||
return baseImpl->isVolatile();
|
||||
}
|
||||
|
||||
void Source::setVolatile(bool set) noexcept {
|
||||
if (isVolatile() == set) return;
|
||||
auto newImpl = createMutable();
|
||||
newImpl->setVolatile(set);
|
||||
baseImpl = std::move(newImpl);
|
||||
observer->onSourceChanged(*this);
|
||||
}
|
||||
|
||||
void Source::setObserver(SourceObserver* observer_) {
|
||||
observer = observer_ ? observer_ : &nullObserver;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/style/source.hpp>
|
||||
#include <mbgl/util/noncopyable.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -27,6 +26,8 @@ public:
|
||||
void setMaxOverscaleFactorForParentTiles(optional<uint8_t> overscaleFactor) noexcept;
|
||||
optional<uint8_t> getMaxOverscaleFactorForParentTiles() const noexcept;
|
||||
|
||||
bool isVolatile() const { return volatileFlag; }
|
||||
void setVolatile(bool set) { volatileFlag = set; }
|
||||
const SourceType type;
|
||||
const std::string id;
|
||||
|
||||
@@ -34,6 +35,7 @@ protected:
|
||||
optional<uint8_t> prefetchZoomDelta;
|
||||
optional<uint8_t> maxOverscaleFactor;
|
||||
Duration minimumTileUpdateInterval{Duration::zero()};
|
||||
bool volatileFlag = false;
|
||||
|
||||
Impl(SourceType, std::string);
|
||||
Impl(const Impl&) = default;
|
||||
|
||||
Reference in New Issue
Block a user