summaryrefslogtreecommitdiff
path: root/platform/android/src/native_map_view.cpp
diff options
context:
space:
mode:
authorAnder Conselvan de Oliveira <ander.deoliveira@mapbox.com>2019-03-08 12:43:05 +0200
committerAnder Conselvan de Oliveira <ander.deoliveira@mapbox.com>2019-03-14 18:33:11 +0200
commit57334407473a31ff43baa645dafd2f5e1bd910fb (patch)
treee981f87c0040799a1ebc45f86d05b3ece6916aba /platform/android/src/native_map_view.cpp
parent11de777628e9e2c4b219bae3f1a6eabd86f2a3c5 (diff)
downloadqtlocation-mapboxgl-57334407473a31ff43baa645dafd2f5e1bd910fb.tar.gz
[core] Group Map LatLngBounds, min and max zoom methods
Group bounds, minimum and maximum zoom related methods together using the new BoundOptions. v2: Document that getBounds() initializes all optional fields. - Add test for getBounds() on a map with default values.
Diffstat (limited to 'platform/android/src/native_map_view.cpp')
-rwxr-xr-xplatform/android/src/native_map_view.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/platform/android/src/native_map_view.cpp b/platform/android/src/native_map_view.cpp
index 83a158efa9..3a4e2014ba 100755
--- a/platform/android/src/native_map_view.cpp
+++ b/platform/android/src/native_map_view.cpp
@@ -287,11 +287,13 @@ void NativeMapView::setStyleJson(jni::JNIEnv& env, const jni::String& json) {
}
void NativeMapView::setLatLngBounds(jni::JNIEnv& env, const jni::Object<mbgl::android::LatLngBounds>& jBounds) {
+ mbgl::BoundOptions bounds;
if (jBounds) {
- map->setLatLngBounds(mbgl::android::LatLngBounds::getLatLngBounds(env, jBounds));
+ bounds.withLatLngBounds(mbgl::android::LatLngBounds::getLatLngBounds(env, jBounds));
} else {
- map->setLatLngBounds(mbgl::LatLngBounds::world());
+ bounds.withLatLngBounds(mbgl::LatLngBounds::world());
}
+ map->setBounds(bounds);
}
void NativeMapView::cancelTransitions(jni::JNIEnv&) {
@@ -424,19 +426,19 @@ void NativeMapView::resetZoom(jni::JNIEnv&) {
}
void NativeMapView::setMinZoom(jni::JNIEnv&, jni::jdouble zoom) {
- map->setMinZoom(zoom);
+ map->setBounds(BoundOptions().withMinZoom(zoom));
}
jni::jdouble NativeMapView::getMinZoom(jni::JNIEnv&) {
- return map->getMinZoom();
+ return *map->getBounds().minZoom;
}
void NativeMapView::setMaxZoom(jni::JNIEnv&, jni::jdouble zoom) {
- map->setMaxZoom(zoom);
+ map->setBounds(BoundOptions().withMaxZoom(zoom));
}
jni::jdouble NativeMapView::getMaxZoom(jni::JNIEnv&) {
- return map->getMaxZoom();
+ return *map->getBounds().maxZoom;
}
void NativeMapView::rotateBy(jni::JNIEnv&, jni::jdouble sx, jni::jdouble sy, jni::jdouble ex, jni::jdouble ey, jni::jlong duration) {