diff --git a/platform/android/src/style/sources/source.cpp b/platform/android/src/style/sources/source.cpp index 5c43c2ae7..b33e7da72 100644 --- a/platform/android/src/style/sources/source.cpp +++ b/platform/android/src/style/sources/source.cpp @@ -118,6 +118,22 @@ static std::unique_ptr createSourcePeer(jni::JNIEnv& env, return jni::Local(env, nullptr); } + void Source::setMaxOverscaleFactorForParentTiles(jni::JNIEnv& env, jni::Integer& maxOverscaleFactor) { + if (!maxOverscaleFactor) { + source.setMaxOverscaleFactorForParentTiles(nullopt); + } else { + source.setMaxOverscaleFactorForParentTiles(jni::Unbox(env, maxOverscaleFactor)); + } + } + + jni::Local Source::getMaxOverscaleFactorForParentTiles(jni::JNIEnv& env) { + auto maxOverscaleFactor = source.getMaxOverscaleFactorForParentTiles(); + if (maxOverscaleFactor) { + return jni::Box(env, jni::jint(*maxOverscaleFactor)); + } + return jni::Local(env, nullptr); + } + void Source::addToStyle(JNIEnv& env, const jni::Object& obj, mbgl::style::Style& style) { if (!ownedSource) { throw std::runtime_error("Cannot add source twice"); @@ -189,13 +205,16 @@ static std::unique_ptr createSourcePeer(jni::JNIEnv& env, #define METHOD(MethodPtr, name) jni::MakeNativePeerMethod(name) // Register the peer - jni::RegisterNativePeer(env, - javaClass, - "nativePtr", - METHOD(&Source::getId, "nativeGetId"), - METHOD(&Source::getAttribution, "nativeGetAttribution"), - METHOD(&Source::setPrefetchZoomDelta, "nativeSetPrefetchZoomDelta"), - METHOD(&Source::getPrefetchZoomDelta, "nativeGetPrefetchZoomDelta")); + jni::RegisterNativePeer( + env, + javaClass, + "nativePtr", + METHOD(&Source::getId, "nativeGetId"), + METHOD(&Source::getAttribution, "nativeGetAttribution"), + METHOD(&Source::setPrefetchZoomDelta, "nativeSetPrefetchZoomDelta"), + METHOD(&Source::getPrefetchZoomDelta, "nativeGetPrefetchZoomDelta"), + METHOD(&Source::setMaxOverscaleFactorForParentTiles, "nativeSetMaxOverscaleFactorForParentTiles"), + METHOD(&Source::getMaxOverscaleFactorForParentTiles, "nativeGetMaxOverscaleFactorForParentTiles")); // Register subclasses GeoJSONSource::registerNative(env); diff --git a/platform/android/src/style/sources/source.hpp b/platform/android/src/style/sources/source.hpp index e0f2b2229..fbeb201c7 100644 --- a/platform/android/src/style/sources/source.hpp +++ b/platform/android/src/style/sources/source.hpp @@ -48,6 +48,10 @@ public: jni::Local getPrefetchZoomDelta(jni::JNIEnv&); + void setMaxOverscaleFactorForParentTiles(jni::JNIEnv& env, jni::Integer& delta); + + jni::Local getMaxOverscaleFactorForParentTiles(jni::JNIEnv&); + void addToStyle(JNIEnv& env, const jni::Object& obj, mbgl::style::Style& style); protected: