summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Hallahan <nick@theoutpost.io>2015-07-14 11:11:14 -0700
committerNicholas Hallahan <nick@theoutpost.io>2015-07-14 11:11:14 -0700
commitafcc78a0aba6a7de6bd676982c9671dbc0eb6acd (patch)
tree9ab368f7fd6250216d30662942bb551855b3a5c5
parent1ac1ba0e18a2d99caeacc86cde096b72ea4a89f3 (diff)
downloadqtlocation-mapboxgl-afcc78a0aba6a7de6bd676982c9671dbc0eb6acd.tar.gz
Able to remove an annotation from the map #1716
-rw-r--r--android/cpp/jni.cpp15
-rw-r--r--android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java2
2 files changed, 8 insertions, 9 deletions
diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp
index 61af695f5f..0e26311f42 100644
--- a/android/cpp/jni.cpp
+++ b/android/cpp/jni.cpp
@@ -455,12 +455,12 @@ jlong JNICALL nativeAddMarker(JNIEnv *env, jobject obj, jlong nativeMapViewPtr,
return (jlong) nativeMapView->getMap().addPointAnnotation(mbgl::PointAnnotation(mbgl::LatLng(latitude, longitude), std::string("default_marker")));
}
-// void JNICALL nativeRemoveAnnotation(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jlong annotationId) {
-// mbgl::Log::Debug(mbgl::Event::JNI, "nativeRemoveAnnotation");
-// assert(nativeMapViewPtr != 0);
-// NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
-// nativeMapView->getMap().setLatLng((uint32_t)annotationId);
-// }
+void JNICALL nativeRemoveAnnotation(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jlong annotationId) {
+ mbgl::Log::Debug(mbgl::Event::JNI, "nativeRemoveAnnotation");
+ assert(nativeMapViewPtr != 0);
+ NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
+ nativeMapView->getMap().removeAnnotation((uint32_t)annotationId);
+}
jobject JNICALL nativeGetLatLng(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetLatLng");
@@ -1007,8 +1007,7 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
reinterpret_cast<void *>(&nativeSetLatLng)},
{"nativeAddMarker", "(JLcom/mapbox/mapboxgl/geometry/LatLng;)J",
reinterpret_cast<void *>(&nativeAddMarker)},
- // {"nativeRemoveAnnotation", "(J)V",
- // reinterpret_cast<void *>(&nativeRemoveAnnotation)},
+ {"nativeRemoveAnnotation", "(JJ)V", reinterpret_cast<void *>(&nativeRemoveAnnotation)},
{"nativeGetLatLng", "(J)Lcom/mapbox/mapboxgl/geometry/LatLng;",
reinterpret_cast<void *>(&nativeGetLatLng)},
{"nativeResetPosition", "(J)V", reinterpret_cast<void *>(&nativeResetPosition)},
diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java
index 9ed7d29b94..13260a64bb 100644
--- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java
+++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java
@@ -220,7 +220,7 @@ class NativeMapView {
}
public void removeAnnotation(long id) {
-// nativeRemoveAnnotation(mNativeMapViewPtr, id);
+ nativeRemoveAnnotation(mNativeMapViewPtr, id);
}
public LatLng getLatLng() {