summaryrefslogtreecommitdiff
path: root/include/mbgl/style/layers/layer.hpp.ejs
blob: d335829efb39a9436ee6489bbbe69330be962eb5 (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<%
  const type = locals.type;
  const layoutProperties = locals.layoutProperties;
  const paintProperties = locals.paintProperties;
-%>
// This file is generated. Do not edit.

#pragma once

<% if (type === 'heatmap' || type === 'line') { -%>
#include <mbgl/style/color_ramp_property_value.hpp>
<% } -%>
#include <mbgl/style/layer.hpp>
#include <mbgl/style/filter.hpp>
#include <mbgl/style/property_value.hpp>
#include <mbgl/style/expression/formatted.hpp>

#include <mbgl/util/color.hpp>

<% if (type === 'line' || type === 'symbol') { -%>
#include <vector>

<% } -%>
namespace mbgl {
namespace style {

class TransitionOptions;

class <%- camelize(type) %>Layer : public Layer {
public:
<% if (type === 'background') { -%>
    <%- camelize(type) %>Layer(const std::string& layerID);
<% } else { -%>
    <%- camelize(type) %>Layer(const std::string& layerID, const std::string& sourceID);
<% } -%>
    ~<%- camelize(type) %>Layer() final;

    // Dynamic properties
    optional<conversion::Error> setLayoutProperty(const std::string& name, const conversion::Convertible& value) final;
    optional<conversion::Error> setPaintProperty(const std::string& name, const conversion::Convertible& value) final;

<% if (layoutProperties.length) { -%>
    // Layout properties

<% for (const property of layoutProperties) { -%>
    static <%- propertyValueType(property) %> getDefault<%- camelize(property.name) %>();
    <%- propertyValueType(property) %> get<%- camelize(property.name) %>() const;
    void set<%- camelize(property.name) %>(<%- propertyValueType(property) %>);

<% } -%>
<% } -%>
    // Paint properties

<% for (const property of paintProperties) { -%>
    static <%- propertyValueType(property) %> getDefault<%- camelize(property.name) %>();
    <%- propertyValueType(property) %> get<%- camelize(property.name) %>() const;
    void set<%- camelize(property.name) %>(<%- propertyValueType(property) %>);
    void set<%- camelize(property.name) %>Transition(const TransitionOptions&);
    TransitionOptions get<%- camelize(property.name) %>Transition() const;

<% } -%>
    // Private implementation

    class Impl;
    const Impl& impl() const;

    Mutable<Impl> mutableImpl() const;
    <%- camelize(type) %>Layer(Immutable<Impl>);
    std::unique_ptr<Layer> cloneRef(const std::string& id) const final;

protected:
    Mutable<Layer::Impl> mutableBaseImpl() const final;
};

class <%- camelize(type) %>LayerFactory : public LayerFactory {
public:
    <%- camelize(type) %>LayerFactory();
    // LayerFactory overrides.
    ~<%- camelize(type) %>LayerFactory() override;
    bool supportsType(const std::string& type) const noexcept final;
    std::unique_ptr<style::Layer> createLayer(const std::string& id, const conversion::Convertible& value) final;

    static <%- camelize(type) %>LayerFactory* get() noexcept;

private:
    static <%- camelize(type) %>LayerFactory* instance;
};

} // namespace style
} // namespace mbgl