[android] getters, setters for minZoom, maxZoom

adds:
map.getMminZoom();
map.setMminZoom(double);
map.getMaxZoom();
map.setMaxZoom(double);
This commit is contained in:
Ansis Brammanis
2016-01-27 11:01:38 -08:00
parent 1644234179
commit ca0099b6a4
4 changed files with 83 additions and 0 deletions

View File

@@ -1670,6 +1670,60 @@ public final class MapView extends FrameLayout {
mNativeMapView.setZoom(zoomLevel, duration);
}
/**
* <p>
* Sets the minimum zoom level the map can be displayed at.
* </p>
*
* @param minZoom The new minimum zoom level.
*/
@UiThread
public void setMinZoom(@FloatRange(from = 0.0, to = 25.0) double minZoom) {
if ((minZoom < 0.0) || (minZoom > 25.0)) {
throw new IllegalArgumentException("zoomLevel is < 0 or > 25");
}
mNativeMapView.setMinZoom(minZoom);
}
/**
* <p>
* Gets the maximum zoom level the map can be displayed at.
* </p>
*
* @return The minimum zoom level.
*/
@UiThread
public double getMinZoom() {
return mNativeMapView.getMinZoom();
}
/**
* <p>
* Sets the maximum zoom level the map can be displayed at.
* </p>
*
* @param maxZoom The new maximum zoom level.
*/
@UiThread
public void setMaxZoom(@FloatRange(from = 0.0, to = 25.0) double maxZoom) {
if ((maxZoom < 0.0) || (maxZoom > 25.0)) {
throw new IllegalArgumentException("zoomLevel is < 0 or > 25");
}
mNativeMapView.setMaxZoom(maxZoom);
}
/**
* <p>
* Gets the maximum zoom level the map can be displayed at.
* </p>
*
* @return The maximum zoom level.
*/
@UiThread
public double getMaxZoom() {
return mNativeMapView.getMaxZoom();
}
/**
* Returns whether the user may zoom the map.
*

View File

@@ -319,10 +319,18 @@ final class NativeMapView {
nativeResetZoom(mNativeMapViewPtr);
}
public void setMinZoom(double zoom) {
nativeSetMinZoom(mNativeMapViewPtr, zoom);
}
public double getMinZoom() {
return nativeGetMinZoom(mNativeMapViewPtr);
}
public void setMaxZoom(double zoom) {
nativeSetMaxZoom(mNativeMapViewPtr, zoom);
}
public double getMaxZoom() {
return nativeGetMaxZoom(mNativeMapViewPtr);
}
@@ -588,8 +596,12 @@ final class NativeMapView {
private native void nativeResetZoom(long nativeMapViewPtr);
private native void nativeSetMinZoom(long nativeMapViewPtr, double zoom);
private native double nativeGetMinZoom(long nativeMapViewPtr);
private native void nativeSetMaxZoom(long nativeMapViewPtr, double zoom);
private native double nativeGetMaxZoom(long nativeMapViewPtr);
private native void nativeRotateBy(long nativeMapViewPtr, double sx,