summaryrefslogtreecommitdiff
path: root/src/mbgl/style/layers/custom_layer.cpp
blob: cda8a157f06205307a59361ba096fa2fee82b088 (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
#include <mbgl/style/layers/custom_layer.hpp>
#include <mbgl/style/layers/custom_layer_impl.hpp>
#include <mbgl/util/logging.hpp>

namespace mbgl {
namespace style {

CustomLayer::CustomLayer(const std::string& layerID,
                         CustomLayerInitializeFunction init,
                         CustomLayerRenderFunction render,
                         CustomLayerDeinitializeFunction deinit,
                         void* context)
    : Layer(LayerType::Custom, std::make_unique<Impl>(layerID, init, render, deinit, context))
    , impl(static_cast<Impl*>(baseImpl.get())) {
    Log::Info(Event::General, "New custom layer: %s", layerID.c_str());
}

CustomLayer::CustomLayer(const Impl& other)
    : Layer(LayerType::Custom, std::make_unique<Impl>(other))
    , impl(static_cast<Impl*>(baseImpl.get())) {
}

CustomLayer::~CustomLayer() = default;

template <>
bool Layer::is<CustomLayer>() const {
    return type == LayerType::Custom;
}

} // namespace style
} // namespace mbgl