blob: 644a31dace6501b8a12b6e17b7e0e52c77513a1a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#include <mbgl/style/source.hpp>
#include <mbgl/style/source_impl.hpp>
#include <mbgl/style/source_observer.hpp>
#include <mbgl/util/logging.hpp>
namespace mbgl {
namespace style {
static SourceObserver nullObserver;
Source::Source(Immutable<Impl> impl)
: baseImpl(std::move(impl)),
observer(&nullObserver) {
}
Source::~Source() = default;
SourceType Source::getType() const {
return baseImpl->type;
}
std::string Source::getID() const {
return baseImpl->id;
}
optional<std::string> Source::getAttribution() const {
return baseImpl->getAttribution();
}
void Source::setObserver(SourceObserver* observer_) {
observer = observer_ ? observer_ : &nullObserver;
}
void Source::setPrefetchZoomDelta(optional<uint8_t> delta) noexcept {
if (getPrefetchZoomDelta() == delta) return;
auto newImpl = createMutable();
newImpl->setPrefetchZoomDelta(std::move(delta));
baseImpl = std::move(newImpl);
observer->onSourceChanged(*this);
}
optional<uint8_t> Source::getPrefetchZoomDelta() const noexcept {
return baseImpl->getPrefetchZoomDelta();
}
void Source::dumpDebugLogs() const {
Log::Info(Event::General, "Source::id: %s", getID().c_str());
Log::Info(Event::General, "Source::loaded: %d", loaded);
}
} // namespace style
} // namespace mbgl
|