summaryrefslogtreecommitdiff
path: root/android/cpp
diff options
context:
space:
mode:
authorNicholas Hallahan <nick@theoutpost.io>2015-06-20 16:21:41 -0700
committerNicholas Hallahan <nick@theoutpost.io>2015-06-20 16:21:41 -0700
commitef31fc5aed4e07b3d9e98b25180b8f809d51a5cf (patch)
treeebda0996bbd11172134eea240f57b236ac8eaee3 /android/cpp
parent1779dd870dec2af6074afeaa675deb1e3b4abb5a (diff)
downloadqtlocation-mapboxgl-ef31fc5aed4e07b3d9e98b25180b8f809d51a5cf.tar.gz
attempting to put one annotation on the map - gets to the native call and then nothing happens
Diffstat (limited to 'android/cpp')
-rw-r--r--android/cpp/jni.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp
index 64e72e1499..bfa07a2ffb 100644
--- a/android/cpp/jni.cpp
+++ b/android/cpp/jni.cpp
@@ -419,6 +419,26 @@ void JNICALL nativeSetLatLng(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, j
nativeMapView->getMap().setLatLng(mbgl::LatLng(latitude, longitude), std::chrono::milliseconds(duration));
}
+void JNICALL nativeAddAnnotation(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jobject latLng) {
+ mbgl::Log::Debug(mbgl::Event::JNI, "nativeAddAnnotation");
+ assert(nativeMapViewPtr != 0);
+ NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
+
+ jdouble latitude = env->GetDoubleField(latLng, latLngLatitudeId);
+ if (env->ExceptionCheck()) {
+ env->ExceptionDescribe();
+ return;
+ }
+
+ jdouble longitude = env->GetDoubleField(latLng, latLngLongitudeId);
+ if (env->ExceptionCheck()) {
+ env->ExceptionDescribe();
+ return;
+ }
+
+ nativeMapView->getMap().addPointAnnotation(mbgl::LatLng(latitude, longitude), std::string(""));
+}
+
jobject JNICALL nativeGetLatLng(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetLatLng");
assert(nativeMapViewPtr != 0);
@@ -952,6 +972,8 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
{"nativeMoveBy", "(JDDJ)V", reinterpret_cast<void *>(&nativeMoveBy)},
{"nativeSetLatLng", "(JLcom/mapbox/mapboxgl/geometry/LatLng;J)V",
reinterpret_cast<void *>(&nativeSetLatLng)},
+ {"nativeAddAnnotation", "(JLcom/mapbox/mapboxgl/geometry/LatLng;)V",
+ reinterpret_cast<void *>(&nativeAddAnnotation)},
{"nativeGetLatLng", "(J)Lcom/mapbox/mapboxgl/geometry/LatLng;",
reinterpret_cast<void *>(&nativeGetLatLng)},
{"nativeResetPosition", "(J)V", reinterpret_cast<void *>(&nativeResetPosition)},