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

move calculation of LatLngBounds to core #8765

Merged
merged 1 commit into from
Apr 20, 2017
Merged

Conversation

tobrun
Copy link
Member

@tobrun tobrun commented Apr 19, 2017

closes #4796

This PR moves calculating LatLngBounds to core instead of doing it in java. To achieve this I had to expose a public CameraPosition getCameraForLatLngbounds(LatLngBounds bounds) on MapboxMap (afaik the only way to make it work with our current CameraUpdateFactory setup).

This PR also refactors returning a CameraPosition directly from core instead of an double array. (this refactors the code for getCameraValues into getCameraPosition.

ezgif com-video-to-gif 38

TODO:

  • instead or returning double[] containing the camera values (cfr. NativeMapView#getCameraValues), it would be cleaner to return an actual CameraPosition object (this refactor needs to happpen for both getCameraForLatLngBounds as for getCameraPosition).
  • cleanup code related to CameraOptions (currently unused and I would prefer going with CameraPosition class instead for consistency).
  • fix missing padding used by the public API / ticket separately

@tobrun tobrun added the Android Mapbox Maps SDK for Android label Apr 19, 2017
@tobrun tobrun added this to the android-v5.1.0 milestone Apr 19, 2017
@tobrun tobrun self-assigned this Apr 19, 2017
@tobrun tobrun changed the title [android] - move calculation of LatLngBounds to core move calculation of LatLngBounds to core Apr 19, 2017
@tobrun tobrun force-pushed the tvn-test-latlngbounds-core branch 3 times, most recently from e970512 to 4883614 Compare April 20, 2017 14:04
@@ -449,6 +450,10 @@ void NativeMapView::setLatLng(jni::JNIEnv&, jni::jdouble latitude, jni::jdouble
map->setLatLng(mbgl::LatLng(latitude, longitude), insets, mbgl::AnimationOptions{mbgl::Milliseconds(duration)});
}

jni::Object<CameraPosition> NativeMapView::getCameraForLatLngBounds(jni::JNIEnv& env, jni::Object<LatLngBounds> jBounds) {\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this compile with the trailing slash?

@tobrun tobrun force-pushed the tvn-test-latlngbounds-core branch from 4883614 to a53022b Compare April 20, 2017 15:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate LatLngBounds to core implemenation
2 participants