Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[android] Add jni binding for min and max pitch (#16236)
Browse files Browse the repository at this point in the history
* [android] Add jni binding for min and max pitch

* Update CHANGELOG.md
  • Loading branch information
Kevin Li authored Feb 28, 2020
1 parent 668a453 commit e0c2b3e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

New method allows serialization of a layer into a Value type, including all modifications done via runtime style API. New method is also an enabler for Style object serialization (sources, layers, etc).

- [android] Add jni binding for min and max pitch ([#16236](https://github.com/mapbox/mapbox-gl-native/pull/16236))

##### ⚠️ Breaking changes

- Changes to `mbgl::FileSourceManager::getFileSource()` ([#16238](https://github.com/mapbox/mapbox-gl-native/pull/16238))
Expand Down
20 changes: 20 additions & 0 deletions platform/android/src/native_map_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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"),
Expand Down
8 changes: 8 additions & 0 deletions platform/android/src/native_map_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ class NativeMapView : public MapObserver {

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);
Expand Down

0 comments on commit e0c2b3e

Please sign in to comment.