summaryrefslogtreecommitdiff
path: root/platform/android/src/style/layers/layer.hpp.ejs
blob: 5791c1650160f6fb400c46742e275434013abf38 (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
<%
  const type = locals.type;
  const properties = locals.properties;
-%>
// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`.

#pragma once

#include "layer.hpp"
#include "../transition_options.hpp"
#include <mbgl/style/layers/<%- type.replace('-', '_') %>_layer.hpp>
#include <jni/jni.hpp>

namespace mbgl {
namespace android {

class <%- camelize(type) %>Layer : public Layer {
public:
    using SuperTag = Layer;
    static constexpr auto Name() { return "com/mapbox/mapboxsdk/style/layers/<%- camelize(type) %>Layer"; };

<% if (type === 'background') { -%>
    <%- camelize(type) %>Layer(jni::JNIEnv&, jni::String&);
<% } else { -%>
    <%- camelize(type) %>Layer(jni::JNIEnv&, jni::String&, jni::String&);
<% } -%>

    <%- camelize(type) %>Layer(mbgl::Map&, mbgl::style::<%- camelize(type) %>Layer&);

    <%- camelize(type) %>Layer(mbgl::Map&, std::unique_ptr<mbgl::style::<%- camelize(type) %>Layer>);

    ~<%- camelize(type) %>Layer();

    // Properties
<% for (const property of properties) { -%>

    jni::Local<jni::Object<jni::ObjectTag>> get<%- camelize(property.name) %>(jni::JNIEnv&);
<% if (property.transition) { -%>
    void set<%- camelize(property.name) %>Transition(jni::JNIEnv&, jlong duration, jlong delay);
    jni::Local<jni::Object<TransitionOptions>> get<%- camelize(property.name) %>Transition(jni::JNIEnv&);
<% } -%>
<% } -%>

}; // class <%- camelize(type) %>Layer

class <%- camelize(type) %>JavaLayerPeerFactory final : public JavaLayerPeerFactory,  public mbgl::style::<%- camelize(type) %>LayerFactory {
public:
    ~<%- camelize(type) %>JavaLayerPeerFactory() override;

    // JavaLayerPeerFactory overrides.
    jni::Local<jni::Object<Layer>> createJavaLayerPeer(jni::JNIEnv&, mbgl::Map&, mbgl::style::Layer&) final;
    jni::Local<jni::Object<Layer>> createJavaLayerPeer(jni::JNIEnv& env, mbgl::Map& map, std::unique_ptr<mbgl::style::Layer>) final;

    void registerNative(jni::JNIEnv&) final;

    style::LayerFactory* getLayerFactory() final { return this; }

};  // class <%- camelize(type) %>JavaLayerPeerFactory

} // namespace android
} // namespace mbgl