diff options
Diffstat (limited to 'platform/android/src')
6 files changed, 12 insertions, 11 deletions
diff --git a/platform/android/src/geometry/lat_lng_bounds.cpp b/platform/android/src/geometry/lat_lng_bounds.cpp index d76ff5b365..c7d139bf58 100644 --- a/platform/android/src/geometry/lat_lng_bounds.cpp +++ b/platform/android/src/geometry/lat_lng_bounds.cpp @@ -9,7 +9,8 @@ jni::Local<jni::Object<LatLngBounds>> LatLngBounds::New(jni::JNIEnv& env, mbgl:: return javaClass.New(env, constructor, bounds.north(), bounds.east(), bounds.south(), bounds.west()); } -mbgl::LatLngBounds LatLngBounds::getLatLngBounds(jni::JNIEnv& env, const jni::Object<LatLngBounds>& bounds) { +mbgl::LatLngBounds LatLngBounds::getLatLngUnwrappedBounds(jni::JNIEnv &env, + const jni::Object<LatLngBounds> &bounds) { static auto& javaClass = jni::Class<LatLngBounds>::Singleton(env); static auto swLatField = javaClass.GetField<jni::jdouble>(env, "latitudeSouth"); static auto swLonField = javaClass.GetField<jni::jdouble>(env, "longitudeWest"); @@ -19,8 +20,6 @@ mbgl::LatLngBounds LatLngBounds::getLatLngBounds(jni::JNIEnv& env, const jni::Ob mbgl::LatLng sw = { bounds.Get(env, swLatField), bounds.Get(env, swLonField) }; mbgl::LatLng ne = { bounds.Get(env, neLatField), bounds.Get(env, neLonField) }; - sw.unwrapForShortestPath(ne); - return mbgl::LatLngBounds::hull(sw, ne); } diff --git a/platform/android/src/geometry/lat_lng_bounds.hpp b/platform/android/src/geometry/lat_lng_bounds.hpp index d51026711d..819d0ca847 100644 --- a/platform/android/src/geometry/lat_lng_bounds.hpp +++ b/platform/android/src/geometry/lat_lng_bounds.hpp @@ -12,11 +12,12 @@ namespace android { class LatLngBounds : private mbgl::util::noncopyable { public: - static constexpr auto Name() { return "com/mapbox/mapboxsdk/geometry/LatLngBounds"; }; + static constexpr auto Name() { return "com/mapbox/mapboxsdk/geometry/LatLngUnwrappedBounds"; }; static jni::Local<jni::Object<LatLngBounds>> New(jni::JNIEnv&, mbgl::LatLngBounds); - static mbgl::LatLngBounds getLatLngBounds(jni::JNIEnv&, const jni::Object<LatLngBounds>&); + static mbgl::LatLngBounds getLatLngUnwrappedBounds(jni::JNIEnv &, + const jni::Object<LatLngBounds> &); static void registerNative(jni::JNIEnv&); }; diff --git a/platform/android/src/native_map_view.cpp b/platform/android/src/native_map_view.cpp index d908b14d36..58bc105c81 100755 --- a/platform/android/src/native_map_view.cpp +++ b/platform/android/src/native_map_view.cpp @@ -231,7 +231,7 @@ void NativeMapView::setStyleJson(jni::JNIEnv& env, const jni::String& json) { void NativeMapView::setLatLngBounds(jni::JNIEnv& env, const jni::Object<mbgl::android::LatLngBounds>& jBounds) { if (jBounds) { - map->setLatLngBounds(mbgl::android::LatLngBounds::getLatLngBounds(env, jBounds)); + map->setLatLngBounds(mbgl::android::LatLngBounds::getLatLngUnwrappedBounds(env, jBounds)); } else { map->setLatLngBounds(mbgl::LatLngBounds::world()); } @@ -324,7 +324,8 @@ void NativeMapView::setLatLng(jni::JNIEnv&, jni::jdouble latitude, jni::jdouble jni::Local<jni::Object<CameraPosition>> NativeMapView::getCameraForLatLngBounds(jni::JNIEnv& env, const jni::Object<LatLngBounds>& jBounds, double top, double left, double bottom, double right, double bearing, double tilt) { mbgl::EdgeInsets padding = {top, left, bottom, right}; - return CameraPosition::New(env, map->cameraForLatLngBounds(mbgl::android::LatLngBounds::getLatLngBounds(env, jBounds), padding, bearing, tilt)); + return CameraPosition::New(env, map->cameraForLatLngBounds( + mbgl::android::LatLngBounds::getLatLngUnwrappedBounds(env, jBounds), padding, bearing, tilt)); } jni::Local<jni::Object<CameraPosition>> NativeMapView::getCameraForGeometry(jni::JNIEnv& env, const jni::Object<geojson::Geometry>& jGeometry, double top, double left, double bottom, double right, double bearing, double tilt) { diff --git a/platform/android/src/offline/offline_region_definition.cpp b/platform/android/src/offline/offline_region_definition.cpp index 23e5b7466b..fbb2396adb 100644 --- a/platform/android/src/offline/offline_region_definition.cpp +++ b/platform/android/src/offline/offline_region_definition.cpp @@ -50,7 +50,7 @@ mbgl::OfflineTilePyramidRegionDefinition OfflineTilePyramidRegionDefinition::get return mbgl::OfflineTilePyramidRegionDefinition( jni::Make<std::string>(env, jDefinition.Get(env, styleURLF)), - LatLngBounds::getLatLngBounds(env, jDefinition.Get(env, boundsF)), + LatLngBounds::getLatLngUnwrappedBounds(env, jDefinition.Get(env, boundsF)), jDefinition.Get(env, minZoomF), jDefinition.Get(env, maxZoomF), jDefinition.Get(env, pixelRatioF) diff --git a/platform/android/src/snapshotter/map_snapshotter.cpp b/platform/android/src/snapshotter/map_snapshotter.cpp index a5f44a1d4c..3da5245f42 100644 --- a/platform/android/src/snapshotter/map_snapshotter.cpp +++ b/platform/android/src/snapshotter/map_snapshotter.cpp @@ -47,7 +47,7 @@ MapSnapshotter::MapSnapshotter(jni::JNIEnv& _env, optional<mbgl::LatLngBounds> bounds; if (region) { - bounds = LatLngBounds::getLatLngBounds(_env, region); + bounds = LatLngBounds::getLatLngUnwrappedBounds(_env, region); } std::pair<bool, std::string> style; @@ -130,7 +130,7 @@ void MapSnapshotter::setCameraPosition(JNIEnv& env, const jni::Object<CameraPosi } void MapSnapshotter::setRegion(JNIEnv& env, const jni::Object<LatLngBounds>& region) { - snapshotter->setRegion(LatLngBounds::getLatLngBounds(env, region)); + snapshotter->setRegion(LatLngBounds::getLatLngUnwrappedBounds(env, region)); } diff --git a/platform/android/src/style/sources/custom_geometry_source.cpp b/platform/android/src/style/sources/custom_geometry_source.cpp index 057f5c99ba..0c3b582e3e 100644 --- a/platform/android/src/style/sources/custom_geometry_source.cpp +++ b/platform/android/src/style/sources/custom_geometry_source.cpp @@ -142,7 +142,7 @@ namespace android { } void CustomGeometrySource::invalidateBounds(jni::JNIEnv& env, const jni::Object<LatLngBounds>& jBounds) { - auto bounds = LatLngBounds::getLatLngBounds(env, jBounds); + auto bounds = LatLngBounds::getLatLngUnwrappedBounds(env, jBounds); source.as<mbgl::style::CustomGeometrySource>()->CustomGeometrySource::invalidateRegion(bounds); } |