summaryrefslogtreecommitdiff
path: root/platform/android/src/style/layers/layer.hpp
blob: 37eb34cdd7ff1a7f64c9759f1742a85811bd583d (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
#pragma once

#include <mbgl/util/noncopyable.hpp>
#include <mbgl/map/map.hpp>
#include <mbgl/style/layer.hpp>

#include "../value.hpp"

#include <jni/jni.hpp>

namespace mbgl {
namespace android {

class Layer : private mbgl::util::noncopyable {
public:

    static constexpr auto Name() { return "com/mapbox/mapboxsdk/style/layers/Layer"; };

    static jni::Class<Layer> javaClass;

    static void registerNative(jni::JNIEnv&);

    /*
     * Called when a Java object is created on the c++ side
     */
    Layer(mbgl::Map&, mbgl::style::Layer&);

    /*
     * Called when a Java object was created from the jvm side
     */
    Layer(jni::JNIEnv&, std::unique_ptr<mbgl::style::Layer>);

    virtual ~Layer();

    virtual jni::jobject* createJavaPeer(jni::JNIEnv&) = 0;

    jni::String getId(jni::JNIEnv&);

    //Release the owned view and return it
    std::unique_ptr<mbgl::style::Layer> releaseCoreLayer();

    void setLayoutProperty(jni::JNIEnv&, jni::String, jni::Object<> value);

    void setPaintProperty(jni::JNIEnv&, jni::String, jni::Object<> value);

    void updateStyle(jni::JNIEnv&, jni::jboolean updateClasses);

    //Zoom

    jni::jfloat getMinZoom(jni::JNIEnv&);

    jni::jfloat getMaxZoom(jni::JNIEnv&);

    void setMinZoom(jni::JNIEnv&, jni::jfloat zoom);

    void setMaxZoom(jni::JNIEnv&, jni::jfloat zoom);

    /* common properties, but not shared by all */

    void setFilter(jni::JNIEnv& env, jni::Array<jni::Object<>> jfilter);

    void setSourceLayer(jni::JNIEnv& env, jni::String sourceLayer);

    //Property getters

    jni::Object<jni::ObjectTag> getVisibility(jni::JNIEnv&);

protected:
    std::unique_ptr<mbgl::style::Layer> ownedLayer;
    mbgl::style::Layer& layer;
    mbgl::Map* map;

};

} //android
} //mbgl