[ios, android] Add methods to remove a custom layer

This commit is contained in:
John Firebaugh
2015-12-17 14:39:19 -08:00
parent d3c92a8b5c
commit 110f1ec796
11 changed files with 68 additions and 3 deletions

View File

@@ -1492,6 +1492,12 @@ void JNICALL nativeAddCustomLayer(JNIEnv *env, jobject obj, jlong nativeMapViewP
before ? std_string_from_jstring(env, before).c_str() : nullptr);
}
void JNICALL nativeRemoveCustomLayer(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jstring id) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeRemoveCustomLayer");
assert(nativeMapViewPtr != 0);
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
nativeMapView->getMap().removeCustomLayer(std_string_from_jstring(env, id));
}
}
@@ -2018,6 +2024,8 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
reinterpret_cast<void *>(&nativeGetTopOffsetPixelsForAnnotationSymbol)},
{"nativeAddCustomLayer", "(JLcom/mapbox/mapboxsdk/layers/CustomLayer;Ljava/lang/String;)V",
reinterpret_cast<void *>(&nativeAddCustomLayer)},
{"nativeRemoveCustomLayer", "(JLjava/lang/String;)V",
reinterpret_cast<void *>(&nativeRemoveCustomLayer)},
};
if (env->RegisterNatives(nativeMapViewClass, methods.data(), methods.size()) < 0) {