summaryrefslogtreecommitdiff
path: root/include/mbgl/android/jni.hpp
blob: 62cb399d3fd5778281d0fcdcddde81e5c67899c2 (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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#ifndef MBGL_ANDROID_JNI
#define MBGL_ANDROID_JNI

#include <string>
#include <vector>

// Forward definition of JNI types
typedef class _jclass* jclass;
typedef class _jstring* jstring;
typedef class _jobject* jobject;
typedef class _jlongArray* jlongArray;
typedef struct _jmethodID* jmethodID;
typedef struct _jfieldID* jfieldID;

struct _JavaVM;
typedef _JavaVM JavaVM;

struct _JNIEnv;
typedef _JNIEnv JNIEnv;

namespace mbgl {
namespace android {

extern JavaVM* theJVM;

extern std::string cachePath;
extern std::string dataPath;
extern std::string apkPath;
extern std::string androidRelease;

extern jmethodID onInvalidateId;
extern jmethodID onMapChangedId;
extern jmethodID onFpsChangedId;

extern jclass latLngClass;
extern jmethodID latLngConstructorId;
extern jfieldID latLngLatitudeId;
extern jfieldID latLngLongitudeId;

extern jclass latLngZoomClass;
extern jmethodID latLngZoomConstructorId;
extern jfieldID latLngZoomLatitudeId;
extern jfieldID latLngZoomLongitudeId;
extern jfieldID latLngZoomZoomId;

extern jclass markerClass;
extern jmethodID markerConstructorId;
extern jfieldID markerPositionId;
extern jfieldID markerSpriteId;

extern jclass polylineClass;
extern jmethodID polylineConstructorId;
extern jfieldID polylineAlphaId;
extern jfieldID polylineVisibleId;
extern jfieldID polylineColorId;
extern jfieldID polylineWidthId;
extern jfieldID polylinePointsId;

extern jclass polygonClass;
extern jmethodID polygonConstructorId;
extern jfieldID polygonAlphaId;
extern jfieldID polygonVisibleId;
extern jfieldID polygonFillColorId;
extern jfieldID polygonStrokeColorId;
extern jfieldID polygonStrokeWidthId;
extern jfieldID polygonPointsId;
extern jfieldID polygonHolesId;

extern jclass runtimeExceptionClass;
extern jclass nullPointerExceptionClass;

extern jmethodID listToArrayId;

extern jclass arrayListClass;
extern jmethodID arrayListConstructorId;
extern jmethodID arrayListAddId;

extern jclass projectedMetersClass;
extern jmethodID projectedMetersConstructorId;
extern jfieldID projectedMetersNorthingId;
extern jfieldID projectedMetersEastingId;

extern jclass pointFClass;
extern jmethodID pointFConstructorId;
extern jfieldID pointFXId;
extern jfieldID pointFYId;

extern jclass httpContextClass;
extern jmethodID httpContextGetInstanceId;
extern jmethodID httpContextCreateRequestId;

extern jclass httpRequestClass;
extern jmethodID httpRequestStartId;
extern jmethodID httpRequestCancelId;

extern bool throw_jni_error(JNIEnv *env, const char *msg);
extern bool attach_jni_thread(JavaVM* vm, JNIEnv** env, std::string threadName);
extern void detach_jni_thread(JavaVM* vm, JNIEnv** env, bool detach);
extern std::string std_string_from_jstring(JNIEnv *env, jstring jstr);
extern jstring std_string_to_jstring(JNIEnv *env, std::string str);
extern std::vector<std::string> std_vector_string_from_jobject(JNIEnv *env, jobject jlist);
extern jobject std_vector_string_to_jobject(JNIEnv *env, std::vector<std::string> vector);
extern jlongArray std_vector_uint_to_jobject(JNIEnv *env, std::vector<uint32_t> vector);

}
}

#endif