diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp index 0e26311f42e..d517bfa6220 100644 --- a/android/cpp/jni.cpp +++ b/android/cpp/jni.cpp @@ -455,6 +455,15 @@ jlong JNICALL nativeAddMarker(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, return (jlong) nativeMapView->getMap().addPointAnnotation(mbgl::PointAnnotation(mbgl::LatLng(latitude, longitude), std::string("default_marker"))); } +jlong JNICALL nativeAddPolyline(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jobject polyline) { + mbgl::Log::Debug(mbgl::Event::JNI, "nativeAddPolyline"); + assert(nativeMapViewPtr != 0); + // NativeMapView *nativeMapView = reinterpret_cast(nativeMapViewPtr); + + + return -1; +} + void JNICALL nativeRemoveAnnotation(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jlong annotationId) { mbgl::Log::Debug(mbgl::Event::JNI, "nativeRemoveAnnotation"); assert(nativeMapViewPtr != 0); @@ -1007,6 +1016,8 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { reinterpret_cast(&nativeSetLatLng)}, {"nativeAddMarker", "(JLcom/mapbox/mapboxgl/geometry/LatLng;)J", reinterpret_cast(&nativeAddMarker)}, + {"nativeAddPolyline", "(JLcom/mapbox/mapboxgl/annotations/Polyline;)J", + reinterpret_cast(&nativeAddPolyline)}, {"nativeRemoveAnnotation", "(JJ)V", reinterpret_cast(&nativeRemoveAnnotation)}, {"nativeGetLatLng", "(J)Lcom/mapbox/mapboxgl/geometry/LatLng;", reinterpret_cast(&nativeGetLatLng)}, 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 449eeb85720..f28cf88ebe4 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 @@ -221,8 +221,7 @@ public long addMarker(Marker marker) { } public long addPolyline(Polyline polyline) { - - return -1; + return nativeAddPolyline(mNativeMapViewPtr, polyline); } public void removeAnnotation(long id) { @@ -463,6 +462,8 @@ private native void nativeSetLatLng(long nativeMapViewPtr, LatLng latLng, private native long nativeAddMarker(long nativeMapViewPtr, LatLng latLng); + private native long nativeAddPolyline(long nativeMapViewPtr, Polyline polyline); + private native void nativeRemoveAnnotation(long nativeMapViewPtr, long id); private native LatLng nativeGetLatLng(long nativeMapViewPtr);