diff options
author | Nicholas Hallahan <nick@theoutpost.io> | 2015-07-16 07:39:14 -0700 |
---|---|---|
committer | Nicholas Hallahan <nick@theoutpost.io> | 2015-07-16 07:39:14 -0700 |
commit | 8589cee9e28306adbfc6fffa417432ab9d9bfd95 (patch) | |
tree | e44ddbb59936781aa8d5a4338ccb499a68804f19 /android/cpp | |
parent | 062a942c462a04c729907365ab7b0fc025d5683d (diff) | |
download | qtlocation-mapboxgl-8589cee9e28306adbfc6fffa417432ab9d9bfd95.tar.gz |
accessing points list #1716
Diffstat (limited to 'android/cpp')
-rw-r--r-- | android/cpp/jni.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp index e635eaa251..bb815fefd6 100644 --- a/android/cpp/jni.cpp +++ b/android/cpp/jni.cpp @@ -46,6 +46,7 @@ jfieldID polylineAlphaId = nullptr; jfieldID polylineVisibleId = nullptr; jfieldID polylineColorId = nullptr; jfieldID polylineWidthId = nullptr; +jfieldID polylinePointsId = nullptr; jclass latLngZoomClass = nullptr; jmethodID latLngZoomConstructorId = nullptr; @@ -501,6 +502,15 @@ jlong JNICALL nativeAddPolyline(JNIEnv *env, jobject obj, jlong nativeMapViewPtr return -1; } + jobject points = env->GetObjectField(polyline, polylinePointsId); + if (points == nullptr) { + if (env->ThrowNew(nullPointerExceptionClass, "List cannot be null.") < 0) { + env->ExceptionDescribe(); + return -1; + } + return -1; + } + return (jlong)width; } @@ -897,6 +907,12 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { return JNI_ERR; } + polylinePointsId = env->GetFieldID(polylineClass, "points", "Ljava/util/List;"); + if (polylineWidthId == nullptr) { + env->ExceptionDescribe(); + return JNI_ERR; + } + latLngZoomClass = env->FindClass("com/mapbox/mapboxgl/geometry/LatLngZoom"); if (latLngZoomClass == nullptr) { env->ExceptionDescribe(); |