[android] Expose pre-fetching zoom delta. (#15769)
* [android] Expose pre-fetching zoom delta. * [android] Fix Clang format. * [android] Add MapboxMap unit test. * [android] Add prefetching zoom delta into MapboxMapOptions. * [android] Deprecate setPrefetchesTiles to migrate to setPrefetchZoomDelta. * [android] Deprecate getPrefetchesTiles() and migrate to setPrefetchZoomDelta(). * [android] Add unit test to NativeMapViewTest. * [android] Add IntRange annotation to getPrefetchZoomDelta.
This commit is contained in:
@@ -6,6 +6,7 @@ import android.graphics.PointF;
|
||||
import android.graphics.RectF;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.FloatRange;
|
||||
import android.support.annotation.IntRange;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.Size;
|
||||
@@ -246,12 +247,16 @@ public final class MapboxMap {
|
||||
// Style
|
||||
|
||||
/**
|
||||
* Sets tile pre-fetching from MapboxOptions.
|
||||
* Sets tile pre-fetching zoom delta from MapboxOptions.
|
||||
*
|
||||
* @param options the options object
|
||||
*/
|
||||
private void setPrefetchesTiles(@NonNull MapboxMapOptions options) {
|
||||
setPrefetchesTiles(options.getPrefetchesTiles());
|
||||
if (!options.getPrefetchesTiles()) {
|
||||
setPrefetchZoomDelta(0);
|
||||
} else {
|
||||
setPrefetchZoomDelta(options.getPrefetchZoomDelta());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -259,7 +264,9 @@ public final class MapboxMap {
|
||||
* tile is rendered as soon as possible at the expense of a little bandwidth.
|
||||
*
|
||||
* @param enable true to enable
|
||||
* @deprecated Use {@link #setPrefetchZoomDelta(int)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setPrefetchesTiles(boolean enable) {
|
||||
nativeMapView.setPrefetchTiles(enable);
|
||||
}
|
||||
@@ -269,11 +276,38 @@ public final class MapboxMap {
|
||||
*
|
||||
* @return true if enabled
|
||||
* @see MapboxMap#setPrefetchesTiles(boolean)
|
||||
* @deprecated Use {@link #getPrefetchZoomDelta()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean getPrefetchesTiles() {
|
||||
return nativeMapView.getPrefetchTiles();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the tile pre-fetching zoom delta. Pre-fetching makes sure that a low-resolution
|
||||
* tile at the (current_zoom_level - delta) is rendered as soon as possible at the
|
||||
* expense of a little bandwidth.
|
||||
* Note: This operation will override the MapboxMapOptions#setPrefetchesTiles(boolean)
|
||||
* Setting zoom delta to 0 will disable pre-fetching.
|
||||
* Default zoom delta is 4.
|
||||
*
|
||||
* @param delta zoom delta
|
||||
*/
|
||||
public void setPrefetchZoomDelta(@IntRange(from = 0) int delta) {
|
||||
nativeMapView.setPrefetchZoomDelta(delta);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check current pre-fetching zoom delta.
|
||||
*
|
||||
* @return current zoom delta.
|
||||
* @see MapboxMap#setPrefetchZoomDelta(int)
|
||||
*/
|
||||
@IntRange(from = 0)
|
||||
public int getPrefetchZoomDelta() {
|
||||
return nativeMapView.getPrefetchZoomDelta();
|
||||
}
|
||||
|
||||
//
|
||||
// MinZoom
|
||||
//
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.graphics.drawable.Drawable;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.support.annotation.IntRange;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.VisibleForTesting;
|
||||
@@ -70,6 +71,7 @@ public class MapboxMapOptions implements Parcelable {
|
||||
private boolean quickZoomGesturesEnabled = true;
|
||||
|
||||
private boolean prefetchesTiles = true;
|
||||
private int prefetchZoomDelta = 4;
|
||||
private boolean zMediaOverlay = false;
|
||||
|
||||
private boolean localIdeographFontFamilyEnabled = true;
|
||||
@@ -134,6 +136,7 @@ public class MapboxMapOptions implements Parcelable {
|
||||
textureMode = in.readByte() != 0;
|
||||
translucentTextureSurface = in.readByte() != 0;
|
||||
prefetchesTiles = in.readByte() != 0;
|
||||
prefetchZoomDelta = in.readInt();
|
||||
zMediaOverlay = in.readByte() != 0;
|
||||
localIdeographFontFamilyEnabled = in.readByte() != 0;
|
||||
localIdeographFontFamily = in.readString();
|
||||
@@ -257,6 +260,8 @@ public class MapboxMapOptions implements Parcelable {
|
||||
typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_renderTextureTranslucentSurface, false));
|
||||
mapboxMapOptions.setPrefetchesTiles(
|
||||
typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_enableTilePrefetch, true));
|
||||
mapboxMapOptions.setPrefetchZoomDelta(
|
||||
typedArray.getInt(R.styleable.mapbox_MapView_mapbox_prefetchZoomDelta, 4));
|
||||
mapboxMapOptions.renderSurfaceOnTop(
|
||||
typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_enableZMediaOverlay, false));
|
||||
|
||||
@@ -633,13 +638,32 @@ public class MapboxMapOptions implements Parcelable {
|
||||
*
|
||||
* @param enable true to enable
|
||||
* @return This
|
||||
* @deprecated Use {@link #setPrefetchZoomDelta(int)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@NonNull
|
||||
public MapboxMapOptions setPrefetchesTiles(boolean enable) {
|
||||
this.prefetchesTiles = enable;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the tile pre-fetching zoom delta. Pre-fetching makes sure that a low-resolution
|
||||
* tile at the (current_zoom_level - delta) is rendered as soon as possible at the
|
||||
* expense of a little bandwidth.
|
||||
* Note: This operation will override the MapboxMapOptions#setPrefetchesTiles(boolean)
|
||||
* Setting zoom delta to 0 will disable pre-fetching.
|
||||
* Default zoom delta is 4.
|
||||
*
|
||||
* @param delta zoom delta
|
||||
* @return This
|
||||
*/
|
||||
@NonNull
|
||||
public MapboxMapOptions setPrefetchZoomDelta(@IntRange(from = 0) int delta) {
|
||||
this.prefetchZoomDelta = delta;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable cross-source symbol collision detection, defaults to true.
|
||||
* <p>
|
||||
@@ -721,11 +745,23 @@ public class MapboxMapOptions implements Parcelable {
|
||||
* Check whether tile pre-fetching is enabled.
|
||||
*
|
||||
* @return true if enabled
|
||||
* @deprecated Use {@link #getPrefetchZoomDelta()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean getPrefetchesTiles() {
|
||||
return prefetchesTiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check current pre-fetching zoom delta.
|
||||
*
|
||||
* @return current zoom delta.
|
||||
*/
|
||||
@IntRange(from = 0)
|
||||
public int getPrefetchZoomDelta() {
|
||||
return prefetchZoomDelta;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether cross-source symbol collision detection is enabled.
|
||||
*
|
||||
@@ -1081,6 +1117,7 @@ public class MapboxMapOptions implements Parcelable {
|
||||
dest.writeByte((byte) (textureMode ? 1 : 0));
|
||||
dest.writeByte((byte) (translucentTextureSurface ? 1 : 0));
|
||||
dest.writeByte((byte) (prefetchesTiles ? 1 : 0));
|
||||
dest.writeInt(prefetchZoomDelta);
|
||||
dest.writeByte((byte) (zMediaOverlay ? 1 : 0));
|
||||
dest.writeByte((byte) (localIdeographFontFamilyEnabled ? 1 : 0));
|
||||
dest.writeString(localIdeographFontFamily);
|
||||
@@ -1175,6 +1212,9 @@ public class MapboxMapOptions implements Parcelable {
|
||||
if (prefetchesTiles != options.prefetchesTiles) {
|
||||
return false;
|
||||
}
|
||||
if (prefetchZoomDelta != options.prefetchZoomDelta) {
|
||||
return false;
|
||||
}
|
||||
if (zMediaOverlay != options.zMediaOverlay) {
|
||||
return false;
|
||||
}
|
||||
@@ -1231,6 +1271,7 @@ public class MapboxMapOptions implements Parcelable {
|
||||
result = 31 * result + (textureMode ? 1 : 0);
|
||||
result = 31 * result + (translucentTextureSurface ? 1 : 0);
|
||||
result = 31 * result + (prefetchesTiles ? 1 : 0);
|
||||
result = 31 * result + prefetchZoomDelta;
|
||||
result = 31 * result + (zMediaOverlay ? 1 : 0);
|
||||
result = 31 * result + (localIdeographFontFamilyEnabled ? 1 : 0);
|
||||
result = 31 * result + (localIdeographFontFamily != null ? localIdeographFontFamily.hashCode() : 0);
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.graphics.RectF;
|
||||
import android.support.annotation.IntRange;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import com.mapbox.geojson.Feature;
|
||||
import com.mapbox.geojson.Geometry;
|
||||
import com.mapbox.mapboxsdk.annotations.Marker;
|
||||
@@ -214,6 +215,11 @@ interface NativeMap {
|
||||
|
||||
boolean getPrefetchTiles();
|
||||
|
||||
void setPrefetchZoomDelta(@IntRange(from = 0) int delta);
|
||||
|
||||
@IntRange(from = 0)
|
||||
int getPrefetchZoomDelta();
|
||||
|
||||
void setGestureInProgress(boolean inProgress);
|
||||
|
||||
float getPixelRatio();
|
||||
|
||||
@@ -724,6 +724,23 @@ final class NativeMapView implements NativeMap {
|
||||
return nativeGetPrefetchTiles();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPrefetchZoomDelta(@IntRange(from = 0) int delta) {
|
||||
if (checkState("nativeSetPrefetchZoomDelta")) {
|
||||
return;
|
||||
}
|
||||
nativeSetPrefetchZoomDelta(delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
@IntRange(from = 0)
|
||||
public int getPrefetchZoomDelta() {
|
||||
if (checkState("nativeGetPrefetchZoomDelta")) {
|
||||
return 0;
|
||||
}
|
||||
return nativeGetPrefetchZoomDelta();
|
||||
}
|
||||
|
||||
// Runtime style Api
|
||||
|
||||
@Override
|
||||
@@ -1383,6 +1400,12 @@ final class NativeMapView implements NativeMap {
|
||||
@Keep
|
||||
private native boolean nativeGetPrefetchTiles();
|
||||
|
||||
@Keep
|
||||
private native void nativeSetPrefetchZoomDelta(int delta);
|
||||
|
||||
@Keep
|
||||
private native int nativeGetPrefetchZoomDelta();
|
||||
|
||||
@Override
|
||||
public long getNativePtr() {
|
||||
return nativePtr;
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
<public name="mapbox_foregroundLoadColor" type="attr" />
|
||||
|
||||
<public name="mapbox_enableTilePrefetch" type="attr" />
|
||||
<public name="mapbox_prefetchZoomDelta" type="attr"/>
|
||||
<public name="mapbox_enableZMediaOverlay" type="attr" />
|
||||
|
||||
<!-- Exposed content descriptions -->
|
||||
|
||||
@@ -109,6 +109,7 @@
|
||||
<attr name="mapbox_foregroundLoadColor" format="color"/>
|
||||
|
||||
<attr name="mapbox_enableTilePrefetch" format="boolean"/>
|
||||
<attr name="mapbox_prefetchZoomDelta" format="integer"/>
|
||||
<attr name="mapbox_enableZMediaOverlay" format="boolean"/>
|
||||
<attr name="mapbox_pixelRatio" format="float"/>
|
||||
|
||||
|
||||
@@ -167,6 +167,16 @@ public class MapboxMapOptionsTest {
|
||||
assertFalse(new MapboxMapOptions().setPrefetchesTiles(false).getPrefetchesTiles());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPrefetchZoomDelta() {
|
||||
// Default value
|
||||
assertEquals(4, new MapboxMapOptions().getPrefetchZoomDelta());
|
||||
|
||||
// Check mutations
|
||||
assertEquals(5, new MapboxMapOptions().setPrefetchZoomDelta(5).getPrefetchZoomDelta());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testCrossSourceCollisions() {
|
||||
// Default value
|
||||
|
||||
@@ -126,6 +126,18 @@ class MapboxMapTest {
|
||||
verify { nativeMapView.prefetchTiles = true }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testGetPrefetchZoomDelta() {
|
||||
every { nativeMapView.prefetchZoomDelta } answers { 3 }
|
||||
assertEquals(3, mapboxMap.prefetchZoomDelta)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testSetPrefetchZoomDelta() {
|
||||
mapboxMap.prefetchZoomDelta = 2
|
||||
verify { nativeMapView.prefetchZoomDelta = 2 }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testCameraForLatLngBounds() {
|
||||
val bounds = LatLngBounds.Builder().include(LatLng()).include(LatLng(1.0, 1.0)).build()
|
||||
|
||||
@@ -221,6 +221,23 @@ class NativeMapViewTest : AppCenter() {
|
||||
assertEquals("Flag should match", expected, actual)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThreadTest
|
||||
fun testPrefetchZoomDelta() {
|
||||
val expected = 2
|
||||
nativeMapView.prefetchZoomDelta = 2
|
||||
val actual = nativeMapView.prefetchZoomDelta
|
||||
assertEquals("Prefetch zoom delta should match", expected, actual)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThreadTest
|
||||
fun testPrefetchZoomDeltaDefault() {
|
||||
val expected = 4
|
||||
val actual = nativeMapView.prefetchZoomDelta
|
||||
assertEquals("Prefetch zoom delta should match", expected, actual)
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThreadTest
|
||||
fun testSetContentPadding() {
|
||||
|
||||
205
platform/android/src/native_map_view.cpp
Executable file → Normal file
205
platform/android/src/native_map_view.cpp
Executable file → Normal file
@@ -40,19 +40,19 @@
|
||||
#include "style/conversion/filter.hpp"
|
||||
#include "geojson/feature.hpp"
|
||||
|
||||
#include "jni.hpp"
|
||||
#include "attach_env.hpp"
|
||||
#include "map_renderer.hpp"
|
||||
#include "android_renderer_frontend.hpp"
|
||||
#include "file_source.hpp"
|
||||
#include "attach_env.hpp"
|
||||
#include "bitmap.hpp"
|
||||
#include "run_loop_impl.hpp"
|
||||
#include "java/util.hpp"
|
||||
#include "geometry/lat_lng_bounds.hpp"
|
||||
#include "map/camera_position.hpp"
|
||||
#include "map/image.hpp"
|
||||
#include "style/light.hpp"
|
||||
#include "bitmap_factory.hpp"
|
||||
#include "file_source.hpp"
|
||||
#include "geometry/lat_lng_bounds.hpp"
|
||||
#include "java/util.hpp"
|
||||
#include "jni.hpp"
|
||||
#include "map/camera_position.hpp"
|
||||
#include "map/image.hpp"
|
||||
#include "map_renderer.hpp"
|
||||
#include "run_loop_impl.hpp"
|
||||
#include "style/light.hpp"
|
||||
|
||||
namespace mbgl {
|
||||
namespace android {
|
||||
@@ -1050,6 +1050,14 @@ jni::jboolean NativeMapView::getPrefetchTiles(JNIEnv&) {
|
||||
return jni::jboolean(map->getPrefetchZoomDelta() > 0);
|
||||
}
|
||||
|
||||
void NativeMapView::setPrefetchZoomDelta(JNIEnv&, jni::jint delta) {
|
||||
map->setPrefetchZoomDelta(uint8_t(delta));
|
||||
}
|
||||
|
||||
jni::jint NativeMapView::getPrefetchZoomDelta(JNIEnv&) {
|
||||
return jni::jint(map->getPrefetchZoomDelta());
|
||||
}
|
||||
|
||||
mbgl::Map& NativeMapView::getMap() {
|
||||
return *map;
|
||||
}
|
||||
@@ -1063,90 +1071,99 @@ void NativeMapView::registerNative(jni::JNIEnv& env) {
|
||||
#define METHOD(MethodPtr, name) jni::MakeNativePeerMethod<decltype(MethodPtr), (MethodPtr)>(name)
|
||||
|
||||
// Register the peer
|
||||
jni::RegisterNativePeer<NativeMapView>(env, javaClass, "nativePtr",
|
||||
jni::MakePeer<NativeMapView, const jni::Object<NativeMapView>&, const jni::Object<FileSource>&, const jni::Object<MapRenderer>&, jni::jfloat, jni::jboolean>,
|
||||
"nativeInitialize",
|
||||
"nativeDestroy",
|
||||
METHOD(&NativeMapView::resizeView, "nativeResizeView"),
|
||||
METHOD(&NativeMapView::getStyleUrl, "nativeGetStyleUrl"),
|
||||
METHOD(&NativeMapView::setStyleUrl, "nativeSetStyleUrl"),
|
||||
METHOD(&NativeMapView::getStyleJson, "nativeGetStyleJson"),
|
||||
METHOD(&NativeMapView::setStyleJson, "nativeSetStyleJson"),
|
||||
METHOD(&NativeMapView::cancelTransitions, "nativeCancelTransitions"),
|
||||
METHOD(&NativeMapView::setGestureInProgress, "nativeSetGestureInProgress"),
|
||||
METHOD(&NativeMapView::moveBy, "nativeMoveBy"),
|
||||
METHOD(&NativeMapView::jumpTo, "nativeJumpTo"),
|
||||
METHOD(&NativeMapView::easeTo, "nativeEaseTo"),
|
||||
METHOD(&NativeMapView::flyTo, "nativeFlyTo"),
|
||||
METHOD(&NativeMapView::getLatLng, "nativeGetLatLng"),
|
||||
METHOD(&NativeMapView::setLatLng, "nativeSetLatLng"),
|
||||
METHOD(&NativeMapView::getCameraForLatLngBounds, "nativeGetCameraForLatLngBounds"),
|
||||
METHOD(&NativeMapView::getCameraForGeometry, "nativeGetCameraForGeometry"),
|
||||
METHOD(&NativeMapView::setReachability, "nativeSetReachability"),
|
||||
METHOD(&NativeMapView::resetPosition, "nativeResetPosition"),
|
||||
METHOD(&NativeMapView::getPitch, "nativeGetPitch"),
|
||||
METHOD(&NativeMapView::setPitch, "nativeSetPitch"),
|
||||
METHOD(&NativeMapView::getZoom, "nativeGetZoom"),
|
||||
METHOD(&NativeMapView::setZoom, "nativeSetZoom"),
|
||||
METHOD(&NativeMapView::resetZoom, "nativeResetZoom"),
|
||||
METHOD(&NativeMapView::setMinZoom, "nativeSetMinZoom"),
|
||||
METHOD(&NativeMapView::getMinZoom, "nativeGetMinZoom"),
|
||||
METHOD(&NativeMapView::setMaxZoom, "nativeSetMaxZoom"),
|
||||
METHOD(&NativeMapView::getMaxZoom, "nativeGetMaxZoom"),
|
||||
METHOD(&NativeMapView::rotateBy, "nativeRotateBy"),
|
||||
METHOD(&NativeMapView::setBearing, "nativeSetBearing"),
|
||||
METHOD(&NativeMapView::setBearingXY, "nativeSetBearingXY"),
|
||||
METHOD(&NativeMapView::getBearing, "nativeGetBearing"),
|
||||
METHOD(&NativeMapView::resetNorth, "nativeResetNorth"),
|
||||
METHOD(&NativeMapView::setVisibleCoordinateBounds, "nativeSetVisibleCoordinateBounds"),
|
||||
METHOD(&NativeMapView::scheduleSnapshot, "nativeTakeSnapshot"),
|
||||
METHOD(&NativeMapView::getCameraPosition, "nativeGetCameraPosition"),
|
||||
METHOD(&NativeMapView::updateMarker, "nativeUpdateMarker"),
|
||||
METHOD(&NativeMapView::addMarkers, "nativeAddMarkers"),
|
||||
METHOD(&NativeMapView::setDebug, "nativeSetDebug"),
|
||||
METHOD(&NativeMapView::cycleDebugOptions, "nativeCycleDebugOptions"),
|
||||
METHOD(&NativeMapView::getDebug, "nativeGetDebug"),
|
||||
METHOD(&NativeMapView::isFullyLoaded, "nativeIsFullyLoaded"),
|
||||
METHOD(&NativeMapView::onLowMemory, "nativeOnLowMemory"),
|
||||
METHOD(&NativeMapView::getMetersPerPixelAtLatitude, "nativeGetMetersPerPixelAtLatitude"),
|
||||
METHOD(&NativeMapView::projectedMetersForLatLng, "nativeProjectedMetersForLatLng"),
|
||||
METHOD(&NativeMapView::pixelForLatLng, "nativePixelForLatLng"),
|
||||
METHOD(&NativeMapView::latLngForProjectedMeters, "nativeLatLngForProjectedMeters"),
|
||||
METHOD(&NativeMapView::latLngForPixel, "nativeLatLngForPixel"),
|
||||
METHOD(&NativeMapView::addPolylines, "nativeAddPolylines"),
|
||||
METHOD(&NativeMapView::addPolygons, "nativeAddPolygons"),
|
||||
METHOD(&NativeMapView::updatePolyline, "nativeUpdatePolyline"),
|
||||
METHOD(&NativeMapView::updatePolygon, "nativeUpdatePolygon"),
|
||||
METHOD(&NativeMapView::removeAnnotations, "nativeRemoveAnnotations"),
|
||||
METHOD(&NativeMapView::addAnnotationIcon, "nativeAddAnnotationIcon"),
|
||||
METHOD(&NativeMapView::removeAnnotationIcon, "nativeRemoveAnnotationIcon"),
|
||||
METHOD(&NativeMapView::getTopOffsetPixelsForAnnotationSymbol, "nativeGetTopOffsetPixelsForAnnotationSymbol"),
|
||||
METHOD(&NativeMapView::getTransitionOptions, "nativeGetTransitionOptions"),
|
||||
METHOD(&NativeMapView::setTransitionOptions, "nativeSetTransitionOptions"),
|
||||
METHOD(&NativeMapView::queryPointAnnotations, "nativeQueryPointAnnotations"),
|
||||
METHOD(&NativeMapView::queryShapeAnnotations, "nativeQueryShapeAnnotations"),
|
||||
METHOD(&NativeMapView::queryRenderedFeaturesForPoint, "nativeQueryRenderedFeaturesForPoint"),
|
||||
METHOD(&NativeMapView::queryRenderedFeaturesForBox, "nativeQueryRenderedFeaturesForBox"),
|
||||
METHOD(&NativeMapView::getLight, "nativeGetLight"),
|
||||
METHOD(&NativeMapView::getLayers, "nativeGetLayers"),
|
||||
METHOD(&NativeMapView::getLayer, "nativeGetLayer"),
|
||||
METHOD(&NativeMapView::addLayer, "nativeAddLayer"),
|
||||
METHOD(&NativeMapView::addLayerAbove, "nativeAddLayerAbove"),
|
||||
METHOD(&NativeMapView::addLayerAt, "nativeAddLayerAt"),
|
||||
METHOD(&NativeMapView::removeLayerAt, "nativeRemoveLayerAt"),
|
||||
METHOD(&NativeMapView::removeLayer, "nativeRemoveLayer"),
|
||||
METHOD(&NativeMapView::getSources, "nativeGetSources"),
|
||||
METHOD(&NativeMapView::getSource, "nativeGetSource"),
|
||||
METHOD(&NativeMapView::addSource, "nativeAddSource"),
|
||||
METHOD(&NativeMapView::removeSource, "nativeRemoveSource"),
|
||||
METHOD(&NativeMapView::addImage, "nativeAddImage"),
|
||||
METHOD(&NativeMapView::addImages, "nativeAddImages"),
|
||||
METHOD(&NativeMapView::removeImage, "nativeRemoveImage"),
|
||||
METHOD(&NativeMapView::getImage, "nativeGetImage"),
|
||||
METHOD(&NativeMapView::setLatLngBounds, "nativeSetLatLngBounds"),
|
||||
METHOD(&NativeMapView::setPrefetchTiles, "nativeSetPrefetchTiles"),
|
||||
METHOD(&NativeMapView::getPrefetchTiles, "nativeGetPrefetchTiles")
|
||||
);
|
||||
jni::RegisterNativePeer<NativeMapView>(
|
||||
env,
|
||||
javaClass,
|
||||
"nativePtr",
|
||||
jni::MakePeer<NativeMapView,
|
||||
const jni::Object<NativeMapView>&,
|
||||
const jni::Object<FileSource>&,
|
||||
const jni::Object<MapRenderer>&,
|
||||
jni::jfloat,
|
||||
jni::jboolean>,
|
||||
"nativeInitialize",
|
||||
"nativeDestroy",
|
||||
METHOD(&NativeMapView::resizeView, "nativeResizeView"),
|
||||
METHOD(&NativeMapView::getStyleUrl, "nativeGetStyleUrl"),
|
||||
METHOD(&NativeMapView::setStyleUrl, "nativeSetStyleUrl"),
|
||||
METHOD(&NativeMapView::getStyleJson, "nativeGetStyleJson"),
|
||||
METHOD(&NativeMapView::setStyleJson, "nativeSetStyleJson"),
|
||||
METHOD(&NativeMapView::cancelTransitions, "nativeCancelTransitions"),
|
||||
METHOD(&NativeMapView::setGestureInProgress, "nativeSetGestureInProgress"),
|
||||
METHOD(&NativeMapView::moveBy, "nativeMoveBy"),
|
||||
METHOD(&NativeMapView::jumpTo, "nativeJumpTo"),
|
||||
METHOD(&NativeMapView::easeTo, "nativeEaseTo"),
|
||||
METHOD(&NativeMapView::flyTo, "nativeFlyTo"),
|
||||
METHOD(&NativeMapView::getLatLng, "nativeGetLatLng"),
|
||||
METHOD(&NativeMapView::setLatLng, "nativeSetLatLng"),
|
||||
METHOD(&NativeMapView::getCameraForLatLngBounds, "nativeGetCameraForLatLngBounds"),
|
||||
METHOD(&NativeMapView::getCameraForGeometry, "nativeGetCameraForGeometry"),
|
||||
METHOD(&NativeMapView::setReachability, "nativeSetReachability"),
|
||||
METHOD(&NativeMapView::resetPosition, "nativeResetPosition"),
|
||||
METHOD(&NativeMapView::getPitch, "nativeGetPitch"),
|
||||
METHOD(&NativeMapView::setPitch, "nativeSetPitch"),
|
||||
METHOD(&NativeMapView::getZoom, "nativeGetZoom"),
|
||||
METHOD(&NativeMapView::setZoom, "nativeSetZoom"),
|
||||
METHOD(&NativeMapView::resetZoom, "nativeResetZoom"),
|
||||
METHOD(&NativeMapView::setMinZoom, "nativeSetMinZoom"),
|
||||
METHOD(&NativeMapView::getMinZoom, "nativeGetMinZoom"),
|
||||
METHOD(&NativeMapView::setMaxZoom, "nativeSetMaxZoom"),
|
||||
METHOD(&NativeMapView::getMaxZoom, "nativeGetMaxZoom"),
|
||||
METHOD(&NativeMapView::rotateBy, "nativeRotateBy"),
|
||||
METHOD(&NativeMapView::setBearing, "nativeSetBearing"),
|
||||
METHOD(&NativeMapView::setBearingXY, "nativeSetBearingXY"),
|
||||
METHOD(&NativeMapView::getBearing, "nativeGetBearing"),
|
||||
METHOD(&NativeMapView::resetNorth, "nativeResetNorth"),
|
||||
METHOD(&NativeMapView::setVisibleCoordinateBounds, "nativeSetVisibleCoordinateBounds"),
|
||||
METHOD(&NativeMapView::scheduleSnapshot, "nativeTakeSnapshot"),
|
||||
METHOD(&NativeMapView::getCameraPosition, "nativeGetCameraPosition"),
|
||||
METHOD(&NativeMapView::updateMarker, "nativeUpdateMarker"),
|
||||
METHOD(&NativeMapView::addMarkers, "nativeAddMarkers"),
|
||||
METHOD(&NativeMapView::setDebug, "nativeSetDebug"),
|
||||
METHOD(&NativeMapView::cycleDebugOptions, "nativeCycleDebugOptions"),
|
||||
METHOD(&NativeMapView::getDebug, "nativeGetDebug"),
|
||||
METHOD(&NativeMapView::isFullyLoaded, "nativeIsFullyLoaded"),
|
||||
METHOD(&NativeMapView::onLowMemory, "nativeOnLowMemory"),
|
||||
METHOD(&NativeMapView::getMetersPerPixelAtLatitude, "nativeGetMetersPerPixelAtLatitude"),
|
||||
METHOD(&NativeMapView::projectedMetersForLatLng, "nativeProjectedMetersForLatLng"),
|
||||
METHOD(&NativeMapView::pixelForLatLng, "nativePixelForLatLng"),
|
||||
METHOD(&NativeMapView::latLngForProjectedMeters, "nativeLatLngForProjectedMeters"),
|
||||
METHOD(&NativeMapView::latLngForPixel, "nativeLatLngForPixel"),
|
||||
METHOD(&NativeMapView::addPolylines, "nativeAddPolylines"),
|
||||
METHOD(&NativeMapView::addPolygons, "nativeAddPolygons"),
|
||||
METHOD(&NativeMapView::updatePolyline, "nativeUpdatePolyline"),
|
||||
METHOD(&NativeMapView::updatePolygon, "nativeUpdatePolygon"),
|
||||
METHOD(&NativeMapView::removeAnnotations, "nativeRemoveAnnotations"),
|
||||
METHOD(&NativeMapView::addAnnotationIcon, "nativeAddAnnotationIcon"),
|
||||
METHOD(&NativeMapView::removeAnnotationIcon, "nativeRemoveAnnotationIcon"),
|
||||
METHOD(&NativeMapView::getTopOffsetPixelsForAnnotationSymbol, "nativeGetTopOffsetPixelsForAnnotationSymbol"),
|
||||
METHOD(&NativeMapView::getTransitionOptions, "nativeGetTransitionOptions"),
|
||||
METHOD(&NativeMapView::setTransitionOptions, "nativeSetTransitionOptions"),
|
||||
METHOD(&NativeMapView::queryPointAnnotations, "nativeQueryPointAnnotations"),
|
||||
METHOD(&NativeMapView::queryShapeAnnotations, "nativeQueryShapeAnnotations"),
|
||||
METHOD(&NativeMapView::queryRenderedFeaturesForPoint, "nativeQueryRenderedFeaturesForPoint"),
|
||||
METHOD(&NativeMapView::queryRenderedFeaturesForBox, "nativeQueryRenderedFeaturesForBox"),
|
||||
METHOD(&NativeMapView::getLight, "nativeGetLight"),
|
||||
METHOD(&NativeMapView::getLayers, "nativeGetLayers"),
|
||||
METHOD(&NativeMapView::getLayer, "nativeGetLayer"),
|
||||
METHOD(&NativeMapView::addLayer, "nativeAddLayer"),
|
||||
METHOD(&NativeMapView::addLayerAbove, "nativeAddLayerAbove"),
|
||||
METHOD(&NativeMapView::addLayerAt, "nativeAddLayerAt"),
|
||||
METHOD(&NativeMapView::removeLayerAt, "nativeRemoveLayerAt"),
|
||||
METHOD(&NativeMapView::removeLayer, "nativeRemoveLayer"),
|
||||
METHOD(&NativeMapView::getSources, "nativeGetSources"),
|
||||
METHOD(&NativeMapView::getSource, "nativeGetSource"),
|
||||
METHOD(&NativeMapView::addSource, "nativeAddSource"),
|
||||
METHOD(&NativeMapView::removeSource, "nativeRemoveSource"),
|
||||
METHOD(&NativeMapView::addImage, "nativeAddImage"),
|
||||
METHOD(&NativeMapView::addImages, "nativeAddImages"),
|
||||
METHOD(&NativeMapView::removeImage, "nativeRemoveImage"),
|
||||
METHOD(&NativeMapView::getImage, "nativeGetImage"),
|
||||
METHOD(&NativeMapView::setLatLngBounds, "nativeSetLatLngBounds"),
|
||||
METHOD(&NativeMapView::setPrefetchTiles, "nativeSetPrefetchTiles"),
|
||||
METHOD(&NativeMapView::getPrefetchTiles, "nativeGetPrefetchTiles"),
|
||||
METHOD(&NativeMapView::setPrefetchZoomDelta, "nativeSetPrefetchZoomDelta"),
|
||||
METHOD(&NativeMapView::getPrefetchZoomDelta, "nativeGetPrefetchZoomDelta"));
|
||||
}
|
||||
|
||||
} // namespace android
|
||||
|
||||
@@ -235,6 +235,10 @@ public:
|
||||
|
||||
jni::jboolean getPrefetchTiles(JNIEnv&);
|
||||
|
||||
void setPrefetchZoomDelta(JNIEnv&, jni::jint);
|
||||
|
||||
jni::jint getPrefetchZoomDelta(JNIEnv&);
|
||||
|
||||
mbgl::Map& getMap();
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user