Able to remove an annotation from the map #1716

This commit is contained in:
Nicholas Hallahan
2015-07-14 11:11:14 -07:00
parent 1ac1ba0e18
commit afcc78a0ab
2 changed files with 8 additions and 9 deletions

View File

@@ -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)},