summaryrefslogtreecommitdiff
path: root/src/mbgl/sourcemanager/custom_geometry_source_factory.cpp
blob: 51a738b3ca868c2c57f30ac0969a65a54ed01f2f (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
#include <mbgl/renderer/sources/render_custom_geometry_source.hpp>
#include <mbgl/sourcemanager/custom_geometry_source_factory.hpp>
#include <mbgl/style/sources/custom_geometry_source.hpp>
#include <mbgl/style/sources/custom_geometry_source_impl.hpp>

namespace mbgl {

const style::SourceTypeInfo* CustomGeometrySourceFactory::getTypeInfo() const noexcept {
    return style::CustomGeometrySource::Impl::staticTypeInfo();
}

std::unique_ptr<style::Source> CustomGeometrySourceFactory::createSource(const std::string& id,
                                                                         const style::conversion::Convertible&,
                                                                         style::conversion::Error&) noexcept {
    return std::unique_ptr<style::Source>(new style::CustomGeometrySource(id, style::CustomGeometrySource::Options{}));
}

std::unique_ptr<RenderSource> CustomGeometrySourceFactory::createRenderSource(
    Immutable<style::Source::Impl> impl) noexcept {
    assert(impl->getTypeInfo() == getTypeInfo());
    return std::make_unique<RenderCustomGeometrySource>(staticImmutableCast<style::CustomGeometrySource::Impl>(impl));
}

Value CustomGeometrySourceFactory::getPropertyDefaultValue(const std::string& property) noexcept {
    return style::CustomGeometrySource::getPropertyDefaultValue(property);
}

} // namespace mbgl