[android] - add binding integration for Map::setLatLngbounds, add example (#8622)

This commit is contained in:
Tobrun
2017-04-13 16:06:09 +02:00
committed by GitHub
parent 0810192163
commit 21f54cc506
10 changed files with 206 additions and 3 deletions

View File

@@ -36,6 +36,7 @@ import com.mapbox.mapboxsdk.constants.MyBearingTracking;
import com.mapbox.mapboxsdk.constants.MyLocationTracking;
import com.mapbox.mapboxsdk.constants.Style;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.geometry.LatLngBounds;
import com.mapbox.mapboxsdk.maps.widgets.MyLocationViewSettings;
import com.mapbox.mapboxsdk.style.layers.Filter;
import com.mapbox.mapboxsdk.style.layers.Layer;
@@ -1504,6 +1505,22 @@ public final class MapboxMap {
return annotationManager.getInfoWindowManager().isAllowConcurrentMultipleOpenInfoWindows();
}
//
// LatLngBounds
//
/**
* Sets a LatLngBounds that constraints map transformations to this bounds.
* <p>
* Set to null to clear current bounds, newly set bounds will override previously set bounds.
* </p>
*
* @param latLngBounds the bounds to constrain the map with
*/
public void setLatLngBoundsForCameraTarget(@Nullable LatLngBounds latLngBounds) {
nativeMapView.setLatLngBounds(latLngBounds);
}
//
// Padding
//

View File

@@ -19,6 +19,7 @@ import com.mapbox.mapboxsdk.annotations.Polygon;
import com.mapbox.mapboxsdk.annotations.Polyline;
import com.mapbox.mapboxsdk.constants.MapboxConstants;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.geometry.LatLngBounds;
import com.mapbox.mapboxsdk.geometry.ProjectedMeters;
import com.mapbox.mapboxsdk.storage.FileSource;
import com.mapbox.mapboxsdk.style.layers.CannotAddLayerException;
@@ -259,6 +260,13 @@ final class NativeMapView {
return nativeGetStyleJson();
}
public void setLatLngBounds(LatLngBounds latLngBounds) {
if (isDestroyedOn("setLatLngBounds")) {
return;
}
nativeSetLatLngBounds(latLngBounds);
}
public void cancelTransitions() {
if (isDestroyedOn("cancelTransitions")) {
return;
@@ -999,6 +1007,8 @@ final class NativeMapView {
private native String nativeGetStyleJson();
private native void nativeSetLatLngBounds(LatLngBounds latLngBounds);
private native void nativeCancelTransitions();
private native void nativeSetGestureInProgress(boolean inProgress);