blob: 742cedef2d5083adf10be4ce8b5c1ecfc5692f49 (
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
|
#include <mbgl/renderer/render_source.hpp>
#include <mbgl/sourcemanager/source_factory.hpp>
#include <mbgl/sourcemanager/source_manager.hpp>
#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/style/source.hpp>
#include <mbgl/style/source_impl.hpp>
namespace mbgl {
std::unique_ptr<style::Source> SourceManager::createSource(const std::string& type,
const std::string& id,
const style::conversion::Convertible& value,
style::conversion::Error& error) noexcept {
SourceFactory* factory = getFactory(type);
if (factory) {
return factory->createSource(id, value, error);
} else {
error.message = "Null factory for type: " + type;
}
error.message = "Unsupported source type! " + error.message;
return nullptr;
}
std::unique_ptr<RenderSource> SourceManager::createRenderSource(Immutable<style::Source::Impl> impl) noexcept {
SourceFactory* factory = getFactory(impl->getTypeInfo());
assert(factory);
return factory->createRenderSource(std::move(impl));
}
} // namespace mbgl
|