diff options
author | Leith Bade <leith@mapbox.com> | 2015-01-18 17:05:01 +1100 |
---|---|---|
committer | Leith Bade <leith@mapbox.com> | 2015-01-18 17:05:01 +1100 |
commit | 5feba9ac073485811592d5d7f69c52992e5a3e0f (patch) | |
tree | 98e83a3ff646692ac4a8f97bca84cdc4aa004edf /android/cpp | |
parent | 016c2948c5e5d0f49c6169bd5802b54747c60312 (diff) | |
download | qtlocation-mapboxgl-5feba9ac073485811592d5d7f69c52992e5a3e0f.tar.gz |
get/setAppliedStyleClasses -> get/setClasses
Diffstat (limited to 'android/cpp')
-rw-r--r-- | android/cpp/jni.cpp | 49 |
1 files changed, 38 insertions, 11 deletions
diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp index b08acb6490..10c332f756 100644 --- a/android/cpp/jni.cpp +++ b/android/cpp/jni.cpp @@ -334,19 +334,40 @@ void JNICALL nativeResize(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jint nativeMapView->getMap().resize(width, height, ratio, fbWidth, fbHeight); } +void JNICALL nativeRemoveClass(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jstring clazz) { + mbgl::Log::Debug(mbgl::Event::JNI, "nativeRemoveClass"); + assert(nativeMapViewPtr != 0); + NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr); + nativeMapView->getMap().removeClass(std_string_from_jstring(env, clazz)); +} + +jboolean JNICALL nativeHasClass(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jstring clazz) { + mbgl::Log::Debug(mbgl::Event::JNI, "nativeHasClass"); + assert(nativeMapViewPtr != 0); + NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr); + return nativeMapView->getMap().hasClass(std_string_from_jstring(env, clazz)); +} + +void JNICALL nativeAddClass(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jstring clazz) { + mbgl::Log::Debug(mbgl::Event::JNI, "nativeAddClass"); + assert(nativeMapViewPtr != 0); + NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr); + nativeMapView->getMap().addClass(std_string_from_jstring(env, clazz)); +} + void JNICALL -nativeSetAppliedClasses(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jobject classes) { - mbgl::Log::Debug(mbgl::Event::JNI, "nativeSetAppliedClasses"); +nativeSetClasses(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jobject classes) { + mbgl::Log::Debug(mbgl::Event::JNI, "nativeSetClasses"); assert(nativeMapViewPtr != 0); NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr); - nativeMapView->getMap().setAppliedClasses(std_vector_string_from_jobject(env, classes)); + nativeMapView->getMap().setClasses(std_vector_string_from_jobject(env, classes)); } -jobject JNICALL nativeGetAppliedClasses(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) { - mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetAppliedClasses"); +jobject JNICALL nativeGetClasses(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) { + mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetClasses"); assert(nativeMapViewPtr != 0); NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr); - return std_vector_string_to_jobject(env, nativeMapView->getMap().getAppliedClasses()); + return std_vector_string_to_jobject(env, nativeMapView->getMap().getClasses()); } void JNICALL nativeSetDefaultTransitionDuration(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, @@ -806,7 +827,7 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { // NOTE: if you get java.lang.UnsatisfiedLinkError you likely forgot to set the size of the // array correctly (too large) - std::array<JNINativeMethod, 59> methods = {{ // Can remove the extra brace in C++14 + std::array<JNINativeMethod, 62> methods = {{ // Can remove the extra brace in C++14 {"nativeCreate", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)J", reinterpret_cast<void *>(&nativeCreate)}, {"nativeDestroy", "(J)V", reinterpret_cast<void *>(&nativeDestroy)}, @@ -834,10 +855,16 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { {"nativeResize", "(JIIFII)V", reinterpret_cast<void *>(static_cast<void JNICALL ( *)(JNIEnv *, jobject, jlong, jint, jint, jfloat, jint, jint)>(&nativeResize))}, - {"nativeSetAppliedClasses", "(JLjava/util/List;)V", - reinterpret_cast<void *>(&nativeSetAppliedClasses)}, - {"nativeGetAppliedClasses", "(J)Ljava/util/List;", - reinterpret_cast<void *>(&nativeGetAppliedClasses)}, + {"nativeAddClass", "(JLjava/lang/String;)V", + reinterpret_cast<void *>(&nativeAddClass)}, + {"nativeRemoveClass", "(JLjava/lang/String;)V", + reinterpret_cast<void *>(&nativeRemoveClass)}, + {"nativeHasClass", "(JLjava/lang/String;)Z", + reinterpret_cast<void *>(&nativeHasClass)}, + {"nativeSetClasses", "(JLjava/util/List;)V", + reinterpret_cast<void *>(&nativeSetClasses)}, + {"nativeGetClasses", "(J)Ljava/util/List;", + reinterpret_cast<void *>(&nativeGetClasses)}, {"nativeSetDefaultTransitionDuration", "(JJ)V", reinterpret_cast<void *>(&nativeSetDefaultTransitionDuration)}, {"nativeGetDefaultTransitionDuration", "(J)J", |