summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkevin <kevin.li@mapbox.com>2020-02-19 17:35:46 +0800
committerkevin <kevin.li@mapbox.com>2020-02-19 17:56:59 +0800
commit0c9ff59718b76ddd77a5af2e69bf30886367ad9d (patch)
tree2e0d9a2dc980e2d6d575d023c9eeb8fa68f43953
parentd01c6aa322d096229ec122fa64bb71ededf6dfdb (diff)
downloadqtlocation-mapboxgl-0c9ff59718b76ddd77a5af2e69bf30886367ad9d.tar.gz
[android] and jni interface for source zoom delta
-rw-r--r--platform/android/src/style/sources/source.cpp20
-rw-r--r--platform/android/src/style/sources/source.hpp4
2 files changed, 20 insertions, 4 deletions
diff --git a/platform/android/src/style/sources/source.cpp b/platform/android/src/style/sources/source.cpp
index 786e5cb586..55b4c3c841 100644
--- a/platform/android/src/style/sources/source.cpp
+++ b/platform/android/src/style/sources/source.cpp
@@ -93,6 +93,15 @@ namespace android {
return attribution ? jni::Make<jni::String>(env, attribution.value()) : jni::Make<jni::String>(env,"");
}
+ void Source::setPrefetchZoomDelta(jni::JNIEnv&, jint delta) {
+ source.setPrefetchZoomDelta(delta);
+ }
+
+ jint Source::getPrefetchZoomDelta(jni::JNIEnv&) {
+ auto delta = source.getPrefetchZoomDelta();
+ return delta ? delta.value() : 0;
+ }
+
void Source::addToMap(JNIEnv& env, const jni::Object<Source>& obj, mbgl::Map& map, AndroidRendererFrontend& frontend) {
// Check to see if we own the source first
if (!ownedSource) {
@@ -149,10 +158,13 @@ namespace android {
#define METHOD(MethodPtr, name) jni::MakeNativePeerMethod<decltype(MethodPtr), (MethodPtr)>(name)
// Register the peer
- jni::RegisterNativePeer<Source>(env, javaClass, "nativePtr",
- METHOD(&Source::getId, "nativeGetId"),
- METHOD(&Source::getAttribution, "nativeGetAttribution")
- );
+ jni::RegisterNativePeer<Source>(env,
+ javaClass,
+ "nativePtr",
+ METHOD(&Source::getId, "nativeGetId"),
+ METHOD(&Source::getAttribution, "nativeGetAttribution"),
+ METHOD(&Source::setPrefetchZoomDelta, "nativeSetPrefetchZoomDelta"),
+ METHOD(&Source::getPrefetchZoomDelta, "nativeGetPrefetchZoomDelta"));
// Register subclasses
GeoJSONSource::registerNative(env);
diff --git a/platform/android/src/style/sources/source.hpp b/platform/android/src/style/sources/source.hpp
index 93b706425a..090a6222cd 100644
--- a/platform/android/src/style/sources/source.hpp
+++ b/platform/android/src/style/sources/source.hpp
@@ -43,6 +43,10 @@ public:
jni::Local<jni::String> getAttribution(jni::JNIEnv&);
+ void setPrefetchZoomDelta(jni::JNIEnv&, jint delta);
+
+ jint getPrefetchZoomDelta(jni::JNIEnv&);
+
protected:
// Set on newly created sources until added to the map.
std::unique_ptr<mbgl::style::Source> ownedSource;