summaryrefslogtreecommitdiff
path: root/src/mbgl/layer/custom_layer.hpp
blob: 315d158802064c1f1d8f470694999fdb65ca93e0 (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
#ifndef MBGL_CUSTOM_LAYER
#define MBGL_CUSTOM_LAYER

#include <mbgl/style/style_layer.hpp>

namespace mbgl {

class TransformState;

class CustomLayer : public StyleLayer {
public:
    CustomLayer(const std::string& id,
                CustomLayerInitializeFunction,
                CustomLayerRenderFunction,
                CustomLayerDeinitializeFunction,
                void* context);

    CustomLayer(const CustomLayer&);
    ~CustomLayer();

    void initialize();
    void render(const TransformState&) const;

private:
    std::unique_ptr<StyleLayer> clone() const final;

    void parseLayout(const JSValue&) final {}
    void parsePaints(const JSValue&) final {}

    void cascade(const StyleCascadeParameters&) final {}
    bool recalculate(const StyleCalculationParameters&) final;

    std::unique_ptr<Bucket> createBucket(StyleBucketParameters&) const final;

    CustomLayerInitializeFunction initializeFn = nullptr;
    CustomLayerRenderFunction renderFn = nullptr;
    CustomLayerDeinitializeFunction deinitializeFn = nullptr;
    void* context = nullptr;
};

} // namespace mbgl

#endif