blob: 3f854da2ea2d5e9bd4b4821d10e7298be5d2a4f0 (
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
|
#include <mbgl/util/geo.hpp>
#include "pointf.hpp"
namespace mbgl {
namespace android {
jni::Object<PointF> PointF::New(jni::JNIEnv& env, float x, float y) {
static auto constructor = PointF::javaClass.GetConstructor<float, float>(env);
return PointF::javaClass.New(env, constructor, x, y);
}
mbgl::ScreenCoordinate PointF::getScreenCoordinate(jni::JNIEnv& env, jni::Object<PointF> point) {
static auto xField = PointF::javaClass.GetField<jni::jfloat>(env, "x");
static auto yField = PointF::javaClass.GetField<jni::jfloat>(env, "y");
return mbgl::ScreenCoordinate{point.Get(env, xField), point.Get(env, yField)};
}
void PointF::registerNative(jni::JNIEnv& env) {
// Lookup the class
PointF::javaClass = *jni::Class<PointF>::Find(env).NewGlobalRef(env).release();
}
jni::Class<PointF> PointF::javaClass;
} // namespace android
} // namespace mbgl
|