summaryrefslogtreecommitdiff
path: root/src/mbgl/style/layers/custom_layer.cpp
blob: 42d8349c41d33f2adc458ed488366e06dd441da7 (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
53
54
55
56
57
58
59
60
61
62
63
64
#include <mbgl/style/layers/custom_layer.hpp>
#include <mbgl/style/layers/custom_layer_impl.hpp>
#include <mbgl/style/layer_observer.hpp>

namespace mbgl {
namespace style {

namespace {
    const LayerTypeInfo typeInfoCustom{ "", LayerTypeInfo::SourceNotRequired };
}  // namespace

CustomLayer::CustomLayer(const std::string& layerID,
                         std::unique_ptr<CustomLayerHost> host)
    : Layer(makeMutable<Impl>(layerID, std::move(host))) {
}

CustomLayer::~CustomLayer() = default;

const CustomLayer::Impl& CustomLayer::impl() const {
    return static_cast<const Impl&>(*baseImpl);
}

Mutable<CustomLayer::Impl> CustomLayer::mutableImpl() const {
    return makeMutable<Impl>(impl());
}

std::unique_ptr<Layer> CustomLayer::cloneRef(const std::string&) const {
    assert(false);
    return nullptr;
}

using namespace conversion;

optional<Error> CustomLayer::setPaintProperty(const std::string&, const Convertible&) {
    return Error { "layer doesn't support this property" };
}

optional<Error> CustomLayer::setLayoutProperty(const std::string&, const Convertible&) {
    return Error { "layer doesn't support this property" };
}

Mutable<Layer::Impl> CustomLayer::mutableBaseImpl() const {
    return staticMutableCast<Layer::Impl>(mutableImpl());
}

const LayerTypeInfo* CustomLayer::Impl::getTypeInfo() const noexcept {
    return &typeInfoCustom;
}

CustomLayerFactory::CustomLayerFactory() = default;

CustomLayerFactory::~CustomLayerFactory() = default;

const LayerTypeInfo* CustomLayerFactory::getTypeInfo() const noexcept {
    return &typeInfoCustom;
}

std::unique_ptr<style::Layer> CustomLayerFactory::createLayer(const std::string&, const conversion::Convertible&) {
    assert(false);
    return nullptr;
}

} // namespace style
} // namespace mbgl