diff options
author | Kevin Li <kevin.li@mapbox.com> | 2020-02-28 17:26:15 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-28 17:26:15 +0800 |
commit | e0c2b3e771bdd4a23bb7442240ccc3dbf1c1c57a (patch) | |
tree | fdda566ca135ea676908d292460be34d49dfb210 /platform/android | |
parent | 668a4530222c710020cba62b6b65a1522027ac7e (diff) | |
download | qtlocation-mapboxgl-e0c2b3e771bdd4a23bb7442240ccc3dbf1c1c57a.tar.gz |
[android] Add jni binding for min and max pitch (#16236)
* [android] Add jni binding for min and max pitch
* Update CHANGELOG.md
Diffstat (limited to 'platform/android')
-rw-r--r-- | platform/android/src/native_map_view.cpp | 20 | ||||
-rw-r--r-- | platform/android/src/native_map_view.hpp | 8 |
2 files changed, 28 insertions, 0 deletions
diff --git a/platform/android/src/native_map_view.cpp b/platform/android/src/native_map_view.cpp index db30d87a5b..f6e2e4a22f 100644 --- a/platform/android/src/native_map_view.cpp +++ b/platform/android/src/native_map_view.cpp @@ -479,6 +479,22 @@ jni::jdouble NativeMapView::getMaxZoom(jni::JNIEnv&) { return *map->getBounds().maxZoom; } +void NativeMapView::setMinPitch(jni::JNIEnv&, jni::jdouble pitch) { + map->setBounds(BoundOptions().withMinPitch(pitch)); +} + +jni::jdouble NativeMapView::getMinPitch(jni::JNIEnv&) { + return *map->getBounds().minPitch; +} + +void NativeMapView::setMaxPitch(jni::JNIEnv&, jni::jdouble pitch) { + map->setBounds(BoundOptions().withMaxPitch(pitch)); +} + +jni::jdouble NativeMapView::getMaxPitch(jni::JNIEnv&) { + return *map->getBounds().maxPitch; +} + void NativeMapView::rotateBy(jni::JNIEnv&, jni::jdouble sx, jni::jdouble sy, jni::jdouble ex, jni::jdouble ey, jni::jlong duration) { mbgl::ScreenCoordinate first(sx, sy); mbgl::ScreenCoordinate second(ex, ey); @@ -1172,6 +1188,10 @@ void NativeMapView::registerNative(jni::JNIEnv& env) { METHOD(&NativeMapView::getMinZoom, "nativeGetMinZoom"), METHOD(&NativeMapView::setMaxZoom, "nativeSetMaxZoom"), METHOD(&NativeMapView::getMaxZoom, "nativeGetMaxZoom"), + METHOD(&NativeMapView::setMinPitch, "nativeSetMinPitch"), + METHOD(&NativeMapView::getMinPitch, "nativeGetMinPitch"), + METHOD(&NativeMapView::setMaxPitch, "nativeSetMaxPitch"), + METHOD(&NativeMapView::getMaxPitch, "nativeGetMaxPitch"), METHOD(&NativeMapView::rotateBy, "nativeRotateBy"), METHOD(&NativeMapView::setBearing, "nativeSetBearing"), METHOD(&NativeMapView::setBearingXY, "nativeSetBearingXY"), diff --git a/platform/android/src/native_map_view.hpp b/platform/android/src/native_map_view.hpp index ab93fab81f..ccd62e0b45 100644 --- a/platform/android/src/native_map_view.hpp +++ b/platform/android/src/native_map_view.hpp @@ -127,6 +127,14 @@ public: jni::jdouble getMaxZoom(jni::JNIEnv&); + void setMinPitch(jni::JNIEnv&, jni::jdouble); + + jni::jdouble getMinPitch(jni::JNIEnv&); + + void setMaxPitch(jni::JNIEnv&, jni::jdouble); + + jni::jdouble getMaxPitch(jni::JNIEnv&); + void rotateBy(jni::JNIEnv&, jni::jdouble, jni::jdouble, jni::jdouble, jni::jdouble, jni::jlong); void setBearing(jni::JNIEnv&, jni::jdouble, jni::jlong); |