summaryrefslogtreecommitdiff
path: root/src/mbgl/style/layers/layer_properties.cpp.ejs
blob: 8fef8d29c405c54ff6bd538a3daf8950ee1777b5 (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
<%
  const type = locals.type;
  const layoutProperties = locals.layoutProperties;
  const paintProperties = locals.paintProperties;
-%>
// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`.

#include <mbgl/style/layers/<%- type %>_layer_properties.hpp>

namespace mbgl {
namespace style {

<% if (layoutProperties.length) { -%>
void <%- camelize(type) %>LayoutProperties::parse(const JSValue& value) {
<% for (const property of layoutProperties) { -%>
    <%- camelizeWithLeadingLowercase(property.name) %>.parse(<%- JSON.stringify(property.name) %>, value);
<% } -%>
}

void <%- camelize(type) %>LayoutProperties::recalculate(const CalculationParameters& parameters) {
<% for (const property of layoutProperties) { -%>
    <%- camelizeWithLeadingLowercase(property.name) %>.calculate(parameters);
<% } -%>
}

<% } -%>
void <%- camelize(type) %>PaintProperties::parse(const JSValue& value) {
<% for (const property of paintProperties) { -%>
    <%- camelizeWithLeadingLowercase(property.name) %>.parse(<%- JSON.stringify(property.name) %>, value);
<% } -%>
}

void <%- camelize(type) %>PaintProperties::cascade(const CascadeParameters& parameters) {
<% for (const property of paintProperties) { -%>
    <%- camelizeWithLeadingLowercase(property.name) %>.cascade(parameters);
<% } -%>
}

bool <%- camelize(type) %>PaintProperties::recalculate(const CalculationParameters& parameters) {
    bool hasTransitions = false;

<% for (const property of paintProperties) { -%>
    hasTransitions |= <%- camelizeWithLeadingLowercase(property.name) %>.calculate(parameters);
<% } -%>

    return hasTransitions;
}

} // namespace style
} // namespace mbgl