@UiThread
public final class MapboxMap
extends java.lang.Object
MapboxMap
object directly, rather,
you must obtain one from the getMapAsync() method on a MapFragment or MapView that you have
added to your application.
Note: Similar to a View object, a MapboxMap should only be read and modified from the main thread.
Modifier and Type | Class and Description |
---|---|
static interface |
MapboxMap.CancelableCallback
Interface definition for a callback to be invoked when a task is complete or cancelled.
|
static interface |
MapboxMap.InfoWindowAdapter
Interface definition for a callback to be invoked when an info window will be shown.
|
static class |
MapboxMap.MarkerViewAdapter<U extends MarkerView>
Deprecated.
Use a
SymbolLayer instead. An example of converting Android
SDK views to be used as a symbol see https://github.com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java |
static interface |
MapboxMap.OnCameraChangeListener
Deprecated.
Replaced by
MapboxMap.OnCameraMoveStartedListener , MapboxMap.OnCameraMoveListener and
MapboxMap.OnCameraIdleListener . The order in which the deprecated onCameraChange method will be called in
relation to the methods in the new camera change listeners is undefined. |
static interface |
MapboxMap.OnCameraIdleListener
Interface definition for a callback to be invoked for when camera movement has ended.
|
static interface |
MapboxMap.OnCameraMoveCanceledListener
Interface definition for a callback to be invoked for when the camera's motion has been stopped or when the camera
starts moving for a new reason.
|
static interface |
MapboxMap.OnCameraMoveListener
Interface definition for a callback to be invoked for when the camera changes position.
|
static interface |
MapboxMap.OnCameraMoveStartedListener
Interface definition for a callback to be invoked for when the camera motion starts.
|
static interface |
MapboxMap.OnCompassAnimationListener
Interface definition for a callback to be invoked for when the compass is animating.
|
static interface |
MapboxMap.OnFlingListener
Interface definition for a callback to be invoked when the map is flinged.
|
static interface |
MapboxMap.OnFpsChangedListener
Interface definition for a callback to be invoked when a frame is rendered to the map view.
|
static interface |
MapboxMap.OnInfoWindowClickListener
Interface definition for a callback to be invoked when the user clicks on an info window.
|
static interface |
MapboxMap.OnInfoWindowCloseListener
Interface definition for a callback to be invoked when a marker's info window is closed.
|
static interface |
MapboxMap.OnInfoWindowLongClickListener
Interface definition for a callback to be invoked when the user long presses on a marker's info window.
|
static interface |
MapboxMap.OnMapClickListener
Interface definition for a callback to be invoked when the user clicks on the map view.
|
static interface |
MapboxMap.OnMapLongClickListener
Interface definition for a callback to be invoked when the user long clicks on the map view.
|
static interface |
MapboxMap.OnMarkerClickListener
Interface definition for a callback to be invoked when the user clicks on a marker.
|
static interface |
MapboxMap.OnMarkerViewClickListener
Interface definition for a callback to be invoked when the user clicks on a MarkerView.
|
static interface |
MapboxMap.OnMoveListener
Interface definition for a callback to be invoked when the map is moved.
|
static interface |
MapboxMap.OnPolygonClickListener
Interface definition for a callback to be invoked when the user clicks on a polygon.
|
static interface |
MapboxMap.OnPolylineClickListener
Interface definition for a callback to be invoked when the user clicks on a polyline.
|
static interface |
MapboxMap.OnRotateListener
Interface definition for a callback to be invoked when the map is rotated.
|
static interface |
MapboxMap.OnScaleListener
Interface definition for a callback to be invoked when the map is scaled.
|
static interface |
MapboxMap.OnScrollListener
Deprecated.
Use
MapboxMap.OnMoveListener instead. |
static interface |
MapboxMap.OnShoveListener
Interface definition for a callback to be invoked when the map is tilted.
|
static interface |
MapboxMap.OnStyleLoadedListener
Interface definition for a callback to be invoked when the style has finished loading.
|
static interface |
MapboxMap.SnapshotReadyCallback
Interface definition for a callback to be invoked when the snapshot has been taken.
|
Modifier and Type | Method and Description |
---|---|
void |
addImage(java.lang.String name,
android.graphics.Bitmap image)
Adds an image to be used in the map's style
|
void |
addImages(java.util.HashMap<java.lang.String,android.graphics.Bitmap> images)
Adds an images to be used in the map's style
|
void |
addLayer(Layer layer)
Adds the layer to the map.
|
void |
addLayerAbove(Layer layer,
java.lang.String above)
Adds the layer to the map.
|
void |
addLayerAt(Layer layer,
int index)
Adds the layer to the map at the specified index.
|
void |
addLayerBelow(Layer layer,
java.lang.String below)
Adds the layer to the map.
|
Marker |
addMarker(BaseMarkerOptions markerOptions)
Adds a marker to this map.
|
MarkerView |
addMarker(BaseMarkerViewOptions markerOptions)
Deprecated.
Use a
SymbolLayer instead. An example of converting Android
SDK views to be used as a symbol see https://github.com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java |
MarkerView |
addMarker(BaseMarkerViewOptions markerOptions,
MarkerViewManager.OnMarkerViewAddedListener onMarkerViewAddedListener)
Deprecated.
Use a
SymbolLayer instead. An example of converting Android
SDK views to be used as a symbol see https://github.com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java |
Marker |
addMarker(MarkerOptions markerOptions)
Adds a marker to this map.
|
java.util.List<Marker> |
addMarkers(java.util.List<? extends BaseMarkerOptions> markerOptionsList)
Adds multiple markers to this map.
|
java.util.List<MarkerView> |
addMarkerViews(java.util.List<? extends BaseMarkerViewOptions> markerViewOptions)
Deprecated.
Use a
SymbolLayer instead. An example of converting Android
SDK views to be used as a symbol see https://github.com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java |
void |
addOnCameraIdleListener(MapboxMap.OnCameraIdleListener listener)
Adds a callback that is invoked when camera movement has ended.
|
void |
addOnCameraMoveCancelListener(MapboxMap.OnCameraMoveCanceledListener listener)
Adds a callback that is invoked when camera movement was cancelled.
|
void |
addOnCameraMoveListener(MapboxMap.OnCameraMoveListener listener)
Adds a callback that is invoked when camera position changes.
|
void |
addOnCameraMoveStartedListener(MapboxMap.OnCameraMoveStartedListener listener)
Adds a callback that is invoked when camera movement has started.
|
void |
addOnFlingListener(MapboxMap.OnFlingListener listener)
Adds a callback that's invoked when the map is flinged.
|
void |
addOnMapClickListener(MapboxMap.OnMapClickListener listener)
Adds a callback that's invoked when the user clicks on the map view.
|
void |
addOnMapLongClickListener(MapboxMap.OnMapLongClickListener listener)
Adds a callback that's invoked when the user long clicks on the map view.
|
void |
addOnMoveListener(MapboxMap.OnMoveListener listener)
Adds a callback that's invoked when the map is moved.
|
void |
addOnRotateListener(MapboxMap.OnRotateListener listener)
Adds a callback that's invoked when the map is rotated.
|
void |
addOnScaleListener(MapboxMap.OnScaleListener listener)
Adds a callback that's invoked when the map is scaled.
|
void |
addOnScrollListener(MapboxMap.OnScrollListener listener)
Adds a callback that's invoked when the map is scrolled.
|
void |
addOnShoveListener(MapboxMap.OnShoveListener listener)
Adds a callback that's invoked when the map is tilted.
|
Polygon |
addPolygon(PolygonOptions polygonOptions)
Adds a polygon to this map.
|
java.util.List<Polygon> |
addPolygons(java.util.List<PolygonOptions> polygonOptionsList)
Adds multiple polygons to this map.
|
Polyline |
addPolyline(PolylineOptions polylineOptions)
Adds a polyline to this map.
|
java.util.List<Polyline> |
addPolylines(java.util.List<PolylineOptions> polylineOptionsList)
Adds multiple polylines to this map.
|
void |
addSource(Source source)
Adds the source to the map.
|
void |
animateCamera(CameraUpdate update)
Animate the camera to a new location defined within
CameraUpdate using a transition
animation that evokes powered flight. |
void |
animateCamera(CameraUpdate update,
int durationMs)
Animate the camera to a new location defined within
CameraUpdate using a transition
animation that evokes powered flight. |
void |
animateCamera(CameraUpdate update,
int durationMs,
MapboxMap.CancelableCallback callback)
Animate the camera to a new location defined within
CameraUpdate using a transition
animation that evokes powered flight. |
void |
animateCamera(CameraUpdate update,
MapboxMap.CancelableCallback callback)
Animate the camera to a new location defined within
CameraUpdate using a transition
animation that evokes powered flight. |
void |
cancelAllVelocityAnimations()
Interrupts any ongoing gesture velocity animations.
|
void |
cancelTransitions()
Cancels ongoing animations.
|
void |
clear()
Removes all markers, polylines, polygons, overlays, etc from the map.
|
void |
cycleDebugOptions()
Cycles through the map debug options.
|
void |
deselectMarker(Marker marker)
Deselects a currently selected marker.
|
void |
deselectMarkers()
Deselects any currently selected marker.
|
void |
easeCamera(CameraUpdate update)
Gradually move the camera by the default duration, zoom will not be affected unless specified
within
CameraUpdate . |
void |
easeCamera(CameraUpdate update,
int durationMs)
Gradually move the camera by a specified duration in milliseconds, zoom will not be affected
unless specified within
CameraUpdate . |
void |
easeCamera(CameraUpdate update,
int durationMs,
boolean easingInterpolator)
Gradually move the camera by a specified duration in milliseconds, zoom will not be affected
unless specified within
CameraUpdate . |
void |
easeCamera(CameraUpdate update,
int durationMs,
boolean easingInterpolator,
MapboxMap.CancelableCallback callback)
Gradually move the camera by a specified duration in milliseconds, zoom will not be affected
unless specified within
CameraUpdate . |
void |
easeCamera(CameraUpdate update,
int durationMs,
boolean easingInterpolator,
MapboxMap.CancelableCallback callback,
boolean isDismissable)
Gradually move the camera by a specified duration in milliseconds, zoom will not be affected
unless specified within
CameraUpdate . |
void |
easeCamera(CameraUpdate update,
int durationMs,
MapboxMap.CancelableCallback callback)
Gradually move the camera by a specified duration in milliseconds, zoom will not be affected
unless specified within
CameraUpdate . |
Annotation |
getAnnotation(long id)
Return a annotation based on its id.
|
java.util.List<Annotation> |
getAnnotations()
Returns a list of all the annotations on the map.
|
CameraPosition |
getCameraForGeometry(com.mapbox.geojson.Geometry geometry,
double bearing,
int[] padding)
Get a camera position that fits a provided shape with a given bearing and padding.
|
CameraPosition |
getCameraForLatLngBounds(LatLngBounds latLngBounds,
int[] padding)
Get a camera position that fits a provided bounds and padding.
|
CameraPosition |
getCameraPosition()
Gets the current position of the camera.
|
com.mapbox.android.gestures.AndroidGesturesManager |
getGesturesManager()
|
float |
getHeight()
Returns the measured height of the Map.
|
android.graphics.Bitmap |
getImage(java.lang.String name) |
MapboxMap.InfoWindowAdapter |
getInfoWindowAdapter()
Gets the callback to be invoked when an info window will be shown.
|
Layer |
getLayer(java.lang.String layerId)
Get the layer by id
|
<T extends Layer> |
getLayerAs(java.lang.String layerId)
Tries to cast the Layer to T, returns null if it's another type.
|
java.util.List<Layer> |
getLayers()
Retrieve all the layers in the style
|
Light |
getLight()
Get the global light source used to change lighting conditions on extruded fill layers.
|
java.util.List<Marker> |
getMarkers()
Returns a list of all the markers on the map.
|
MarkerViewManager |
getMarkerViewManager()
Get the MarkerViewManager associated to the MapView.
|
java.util.List<MarkerView> |
getMarkerViewsInRect(android.graphics.RectF rect)
Deprecated.
Use a
SymbolLayer instead. An example of converting Android
SDK views to be used as a symbol see https://github.com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java |
double |
getMaxZoomLevel()
Gets the maximum zoom level the map can be displayed at.
|
double |
getMinZoomLevel()
Gets the minimum zoom level the map can be displayed at.
|
MapboxMap.OnInfoWindowClickListener |
getOnInfoWindowClickListener()
Return the InfoWindow click listener
|
MapboxMap.OnInfoWindowCloseListener |
getOnInfoWindowCloseListener()
Return the InfoWindow close listener
|
MapboxMap.OnInfoWindowLongClickListener |
getOnInfoWindowLongClickListener()
Return the InfoWindow long click listener
|
int[] |
getPadding()
Returns the current configured content padding on map view.
|
java.util.List<Polygon> |
getPolygons()
Returns a list of all the polygons on the map.
|
java.util.List<Polyline> |
getPolylines()
Returns a list of all the polylines on the map.
|
boolean |
getPrefetchesTiles()
Check whether tile pre-fetching is enabled or not.
|
Projection |
getProjection()
Get the Projection object that you can use to convert between screen coordinates and latitude/longitude
coordinates.
|
java.util.List<Marker> |
getSelectedMarkers()
Gets the currently selected marker.
|
Source |
getSource(java.lang.String sourceId)
Retrieve a source by id
|
<T extends Source> |
getSourceAs(java.lang.String sourceId)
Tries to cast the Source to T, returns null if it's another type.
|
java.util.List<Source> |
getSources()
Retrieve all the sources in the style
|
java.lang.String |
getStyleJson()
Returns the map style json currently displayed in the map view.
|
java.lang.String |
getStyleUrl()
Returns the map style url currently displayed in the map view.
|
long |
getTransitionDelay()
Get the animation delay for style changes.
|
long |
getTransitionDuration()
Get the animation duration for style changes.
|
UiSettings |
getUiSettings()
Gets the user interface settings for the map.
|
float |
getWidth()
Returns the measured width of the Map.
|
boolean |
isAllowConcurrentMultipleOpenInfoWindows()
Returns whether the map allows concurrent multiple infowindows to be shown.
|
boolean |
isDebugActive()
Returns whether the map debug information is currently shown.
|
void |
moveCamera(CameraUpdate update)
Repositions the camera according to the instructions defined in the update.
|
void |
moveCamera(CameraUpdate update,
MapboxMap.CancelableCallback callback)
Repositions the camera according to the instructions defined in the update.
|
java.util.List<com.mapbox.geojson.Feature> |
queryRenderedFeatures(android.graphics.PointF coordinates,
Expression filter,
java.lang.String... layerIds)
Queries the map for rendered features
|
java.util.List<com.mapbox.geojson.Feature> |
queryRenderedFeatures(android.graphics.PointF coordinates,
java.lang.String... layerIds)
Queries the map for rendered features
|
java.util.List<com.mapbox.geojson.Feature> |
queryRenderedFeatures(android.graphics.RectF coordinates,
Expression filter,
java.lang.String... layerIds)
Queries the map for rendered features
|
java.util.List<com.mapbox.geojson.Feature> |
queryRenderedFeatures(android.graphics.RectF coordinates,
java.lang.String... layerIds)
Queries the map for rendered features
|
void |
removeAnnotation(Annotation annotation)
Removes an annotation from the map.
|
void |
removeAnnotation(long id)
Removes an annotation from the map
|
void |
removeAnnotations()
Removes all annotations from the map.
|
void |
removeAnnotations(java.util.List<? extends Annotation> annotationList)
Removes multiple annotations from the map.
|
void |
removeImage(java.lang.String name)
Removes an image from the map's style
|
Layer |
removeLayer(Layer layer)
Removes the layer.
|
Layer |
removeLayer(java.lang.String layerId)
Removes the layer.
|
Layer |
removeLayerAt(int index)
Removes the layer.
|
void |
removeMarker(Marker marker)
Convenience method for removing a Marker from the map.
|
void |
removeOnCameraIdleListener(MapboxMap.OnCameraIdleListener listener)
Removes a callback that is invoked when camera movement has ended.
|
void |
removeOnCameraMoveCancelListener(MapboxMap.OnCameraMoveCanceledListener listener)
Removes a callback that is invoked when camera movement was cancelled.
|
void |
removeOnCameraMoveListener(MapboxMap.OnCameraMoveListener listener)
Removes a callback that is invoked when camera position changes.
|
void |
removeOnCameraMoveStartedListener(MapboxMap.OnCameraMoveStartedListener listener)
Removes a callback that is invoked when camera movement has started.
|
void |
removeOnFlingListener(MapboxMap.OnFlingListener listener)
Removes a callback that's invoked when the map is flinged.
|
void |
removeOnMapClickListener(MapboxMap.OnMapClickListener listener)
Removes a callback that's invoked when the user clicks on the map view.
|
void |
removeOnMapLongClickListener(MapboxMap.OnMapLongClickListener listener)
Removes a callback that's invoked when the user long clicks on the map view.
|
void |
removeOnMoveListener(MapboxMap.OnMoveListener listener)
Removes a callback that's invoked when the map is moved.
|
void |
removeOnRotateListener(MapboxMap.OnRotateListener listener)
Removes a callback that's invoked when the map is rotated.
|
void |
removeOnScaleListener(MapboxMap.OnScaleListener listener)
Removes a callback that's invoked when the map is scaled.
|
void |
removeOnScrollListener(MapboxMap.OnScrollListener listener)
Removes a callback that's invoked when the map is scrolled.
|
void |
removeOnShoveListener(MapboxMap.OnShoveListener listener)
Remove a callback that's invoked when the map is tilted.
|
void |
removePolygon(Polygon polygon)
Convenience method for removing a Polygon from the map.
|
void |
removePolyline(Polyline polyline)
Convenience method for removing a Polyline from the map.
|
Source |
removeSource(Source source)
Removes the source, preserving the reverence for re-use
|
Source |
removeSource(java.lang.String sourceId)
Removes the source.
|
void |
resetNorth()
Resets the map view to face north.
|
void |
selectMarker(Marker marker)
Selects a marker.
|
void |
setAllowConcurrentMultipleOpenInfoWindows(boolean allow)
Changes whether the map allows concurrent multiple infowindows to be shown.
|
void |
setCameraPosition(CameraPosition cameraPosition)
Repositions the camera according to the cameraPosition.
|
void |
setDebugActive(boolean debugActive)
Changes whether the map debug information is shown.
|
void |
setFocalBearing(double bearing,
float focalX,
float focalY,
long duration)
Transform the map bearing given a bearing, focal point coordinates, and a duration.
|
void |
setGesturesManager(com.mapbox.android.gestures.AndroidGesturesManager androidGesturesManager,
boolean attachDefaultListeners,
boolean setDefaultMutuallyExclusives)
|
void |
setInfoWindowAdapter(MapboxMap.InfoWindowAdapter infoWindowAdapter)
Sets a custom renderer for the contents of info window.
|
void |
setLatLngBoundsForCameraTarget(LatLngBounds latLngBounds)
Sets a LatLngBounds that constraints map transformations to this bounds.
|
void |
setMaxZoomPreference(double maxZoom)
Sets the maximum zoom level the map can be displayed at.
|
void |
setMinZoomPreference(double minZoom)
Sets the minimum zoom level the map can be displayed at.
|
void |
setOnCameraChangeListener(MapboxMap.OnCameraChangeListener listener)
Deprecated.
|
void |
setOnCameraIdleListener(MapboxMap.OnCameraIdleListener listener)
Deprecated.
|
void |
setOnCameraMoveCancelListener(MapboxMap.OnCameraMoveCanceledListener listener)
|
void |
setOnCameraMoveListener(MapboxMap.OnCameraMoveListener listener)
Deprecated.
|
void |
setOnCameraMoveStartedListener(MapboxMap.OnCameraMoveStartedListener listener)
|
void |
setOnFlingListener(MapboxMap.OnFlingListener listener)
Deprecated.
Use
addOnFlingListener(OnFlingListener) instead. |
void |
setOnFpsChangedListener(MapboxMap.OnFpsChangedListener listener)
Sets a callback that's invoked on every frame rendered to the map view.
|
void |
setOnInfoWindowClickListener(MapboxMap.OnInfoWindowClickListener listener)
Sets a callback that's invoked when the user clicks on an info window.
|
void |
setOnInfoWindowCloseListener(MapboxMap.OnInfoWindowCloseListener listener)
Set an callback to be invoked when an InfoWindow closes.
|
void |
setOnInfoWindowLongClickListener(MapboxMap.OnInfoWindowLongClickListener listener)
Sets a callback that's invoked when a marker's info window is long pressed.
|
void |
setOnMapClickListener(MapboxMap.OnMapClickListener listener)
Deprecated.
Use
addOnMapClickListener(OnMapClickListener) instead. |
void |
setOnMapLongClickListener(MapboxMap.OnMapLongClickListener listener)
Deprecated.
Use
addOnMapLongClickListener(OnMapLongClickListener) instead. |
void |
setOnMarkerClickListener(MapboxMap.OnMarkerClickListener listener)
Sets a callback that's invoked when the user clicks on a marker.
|
void |
setOnPolygonClickListener(MapboxMap.OnPolygonClickListener listener)
Sets a callback that's invoked when the user clicks on a polygon.
|
void |
setOnPolylineClickListener(MapboxMap.OnPolylineClickListener listener)
Sets a callback that's invoked when the user clicks on a polyline.
|
void |
setOnScrollListener(MapboxMap.OnScrollListener listener)
Deprecated.
Use
addOnScrollListener(OnScrollListener) instead. |
void |
setPadding(int left,
int top,
int right,
int bottom)
Sets the distance from the edges of the map view's frame to the edges of the map
view's logical viewport.
|
void |
setPrefetchesTiles(boolean enable)
Enable or disable tile pre-fetching.
|
void |
setStyle(java.lang.String style)
Loads a new map style from the specified bundled style.
|
void |
setStyle(java.lang.String style,
MapboxMap.OnStyleLoadedListener callback)
Loads a new map style from the specified bundled style.
|
void |
setStyleJson(java.lang.String styleJson)
Loads a new map style from a json string.
|
void |
setStyleUrl(java.lang.String url)
Loads a new map style asynchronous from the specified URL.
|
void |
setStyleUrl(java.lang.String url,
MapboxMap.OnStyleLoadedListener callback)
Loads a new map style asynchronous from the specified URL.
|
void |
setTransitionDelay(long delayMs)
Set the animation delay for style changes.
|
void |
setTransitionDuration(long durationMs)
Set the animation duration for style changes.
|
void |
snapshot(MapboxMap.SnapshotReadyCallback callback)
Takes a snapshot of the map.
|
void |
updateMarker(Marker updatedMarker)
Updates a marker on this map.
|
void |
updatePolygon(Polygon polygon)
Update a polygon on this map.
|
void |
updatePolyline(Polyline polyline)
Update a polyline on this map.
|
public long getTransitionDuration()
Get the animation duration for style changes.
The default value is zero, so any changes take effect without animation.public void setTransitionDuration(long durationMs)
durationMs
- Duration in millisecondspublic long getTransitionDelay()
Get the animation delay for style changes.
The default value is zero, so any changes begin to animate immediately.public void setTransitionDelay(long delayMs)
delayMs
- Delay in millisecondspublic void setPrefetchesTiles(boolean enable)
enable
- true to enablepublic boolean getPrefetchesTiles()
setPrefetchesTiles(boolean)
public java.util.List<Layer> getLayers()
@Nullable public Layer getLayer(@NonNull java.lang.String layerId)
layerId
- the layer's id@Nullable public <T extends Layer> T getLayerAs(@NonNull java.lang.String layerId)
T
- the generic attribute of a LayerlayerId
- the layer id used to look up a layerpublic void addLayer(@NonNull Layer layer)
layer
- the layer to addpublic void addLayerBelow(@NonNull Layer layer, @NonNull java.lang.String below)
layer
- the layer to addbelow
- the layer id to add this layer beforepublic void addLayerAbove(@NonNull Layer layer, @NonNull java.lang.String above)
layer
- the layer to addabove
- the layer id to add this layer abovepublic void addLayerAt(@NonNull Layer layer, int index)
layer
- the layer to addindex
- the index to insert the layer at@Nullable public Layer removeLayer(@NonNull java.lang.String layerId)
layerId
- the layer to remove@Nullable public Layer removeLayer(@NonNull Layer layer)
layer
- the layer to remove@Nullable public Layer removeLayerAt(int index)
index
- the layer indexpublic java.util.List<Source> getSources()
@Nullable public Source getSource(@NonNull java.lang.String sourceId)
sourceId
- the source's id@Nullable public <T extends Source> T getSourceAs(@NonNull java.lang.String sourceId)
T
- the generic type of a SourcesourceId
- the id used to look up a layerpublic void addSource(@NonNull Source source)
source
- the source to add@Nullable public Source removeSource(@NonNull java.lang.String sourceId)
sourceId
- the source to remove@Nullable public Source removeSource(@NonNull Source source)
source
- the source to removepublic void addImage(@NonNull java.lang.String name, @NonNull android.graphics.Bitmap image)
name
- the name of the imageimage
- the pre-multiplied Bitmappublic void addImages(@NonNull java.util.HashMap<java.lang.String,android.graphics.Bitmap> images)
public void removeImage(java.lang.String name)
name
- the name of the image to removepublic android.graphics.Bitmap getImage(@NonNull java.lang.String name)
public void setMinZoomPreference(double minZoom)
Sets the minimum zoom level the map can be displayed at.
minZoom
- The new minimum zoom level.public double getMinZoomLevel()
Gets the minimum zoom level the map can be displayed at.
public void setMaxZoomPreference(double maxZoom)
Sets the maximum zoom level the map can be displayed at.
The default maximum zoomn level is 22. The upper bound for this value is 25.5.
maxZoom
- The new maximum zoom level.public double getMaxZoomLevel()
Gets the maximum zoom level the map can be displayed at.
public UiSettings getUiSettings()
public Projection getProjection()
@Nullable public Light getLight()
public void cancelTransitions()
This invokes the MapboxMap.CancelableCallback
for ongoing camera updates.
public final CameraPosition getCameraPosition()
public void setCameraPosition(@NonNull CameraPosition cameraPosition)
cameraPosition
- the camera position to setpublic final void moveCamera(CameraUpdate update)
update
- The change that should be applied to the camera.public final void moveCamera(CameraUpdate update, MapboxMap.CancelableCallback callback)
update
- The change that should be applied to the cameracallback
- the callback to be invoked when an animation finishes or is canceledpublic final void easeCamera(CameraUpdate update)
CameraUpdate
. If getCameraPosition()
is called during the animation,
it will return the current location of the camera in flight.update
- The change that should be applied to the camera.for a set of updates.
public final void easeCamera(CameraUpdate update, int durationMs)
CameraUpdate
. If getCameraPosition()
is called
during the animation, it will return the current location of the camera in flight.update
- The change that should be applied to the camera.durationMs
- The duration of the animation in milliseconds. This must be strictly
positive, otherwise an IllegalArgumentException will be thrown.for a set of updates.
public final void easeCamera(CameraUpdate update, int durationMs, MapboxMap.CancelableCallback callback)
CameraUpdate
. A callback can be used to be notified when
easing the camera stops. If getCameraPosition()
is called during the animation, it
will return the current location of the camera in flight.
Note that this will cancel location tracking mode if enabled.
update
- The change that should be applied to the camera.durationMs
- The duration of the animation in milliseconds. This must be strictly
positive, otherwise an IllegalArgumentException will be thrown.callback
- An optional callback to be notified from the main thread when the animation
stops. If the animation stops due to its natural completion, the callback
will be notified with onFinish(). If the animation stops due to interruption
by a later camera movement or a user gesture, onCancel() will be called.
Do not update or ease the camera from within onCancel().for a set of updates.
public final void easeCamera(CameraUpdate update, int durationMs, boolean easingInterpolator)
CameraUpdate
. A callback can be used to be notified when
easing the camera stops. If getCameraPosition()
is called during the animation, it
will return the current location of the camera in flight.
Note that this will cancel location tracking mode if enabled.
update
- The change that should be applied to the camera.durationMs
- The duration of the animation in milliseconds. This must be strictly
positive, otherwise an IllegalArgumentException will be thrown.easingInterpolator
- True for easing interpolator, false for linear.public final void easeCamera(CameraUpdate update, int durationMs, boolean easingInterpolator, MapboxMap.CancelableCallback callback)
CameraUpdate
. A callback can be used to be notified when
easing the camera stops. If getCameraPosition()
is called during the animation, it
will return the current location of the camera in flight.update
- The change that should be applied to the camera.durationMs
- The duration of the animation in milliseconds. This must be strictly
positive, otherwise an IllegalArgumentException will be thrown.easingInterpolator
- True for easing interpolator, false for linear.callback
- An optional callback to be notified from the main thread when the animation
stops. If the animation stops due to its natural completion, the callback
will be notified with onFinish(). If the animation stops due to interruption
by a later camera movement or a user gesture, onCancel() will be called.
Do not update or ease the camera from within onCancel().public final void easeCamera(CameraUpdate update, int durationMs, boolean easingInterpolator, MapboxMap.CancelableCallback callback, boolean isDismissable)
CameraUpdate
. A callback can be used to be notified when
easing the camera stops. If getCameraPosition()
is called during the animation, it
will return the current location of the camera in flight.update
- The change that should be applied to the camera.durationMs
- The duration of the animation in milliseconds. This must be strictly
positive, otherwise an IllegalArgumentException will be thrown.easingInterpolator
- True for easing interpolator, false for linear.callback
- An optional callback to be notified from the main thread when the animation
stops. If the animation stops due to its natural completion, the callback
will be notified with onFinish(). If the animation stops due to interruption
by a later camera movement or a user gesture, onCancel() will be called.
Do not update or ease the camera from within onCancel().isDismissable
- true will allow animated camera changes dismiss a tracking mode.public final void animateCamera(CameraUpdate update)
CameraUpdate
using a transition
animation that evokes powered flight. The animation will last the default amount of time.
During the animation, a call to getCameraPosition()
returns an intermediate location
of the camera in flight.update
- The change that should be applied to the camera.for a set of updates.
public final void animateCamera(CameraUpdate update, MapboxMap.CancelableCallback callback)
CameraUpdate
using a transition
animation that evokes powered flight. The animation will last the default amount of time. A
callback can be used to be notified when animating the camera stops. During the animation, a
call to getCameraPosition()
returns an intermediate location of the camera in flight.update
- The change that should be applied to the camera.callback
- The callback to invoke from the main thread when the animation stops. If the
animation completes normally, onFinish() is called; otherwise, onCancel() is
called. Do not update or animate the camera from within onCancel().for a set of updates.
public final void animateCamera(CameraUpdate update, int durationMs)
CameraUpdate
using a transition
animation that evokes powered flight. The animation will last a specified amount of time
given in milliseconds. During the animation, a call to getCameraPosition()
returns
an intermediate location of the camera in flight.update
- The change that should be applied to the camera.durationMs
- The duration of the animation in milliseconds. This must be strictly
positive, otherwise an IllegalArgumentException will be thrown.for a set of updates.
public final void animateCamera(CameraUpdate update, int durationMs, MapboxMap.CancelableCallback callback)
CameraUpdate
using a transition
animation that evokes powered flight. The animation will last a specified amount of time
given in milliseconds. A callback can be used to be notified when animating the camera stops.
During the animation, a call to getCameraPosition()
returns an intermediate location
of the camera in flight.update
- The change that should be applied to the camera.durationMs
- The duration of the animation in milliseconds. This must be strictly
positive, otherwise an IllegalArgumentException will be thrown.callback
- An optional callback to be notified from the main thread when the animation
stops. If the animation stops due to its natural completion, the callback
will be notified with onFinish(). If the animation stops due to interruption
by a later camera movement or a user gesture, onCancel() will be called.
Do not update or animate the camera from within onCancel(). If a callback
isn't required, leave it as null.for a set of updates.
public void resetNorth()
public void setFocalBearing(double bearing, float focalX, float focalY, long duration)
bearing
- The bearing of the Map to be transformed tofocalX
- The x coordinate of the focal pointfocalY
- The y coordinate of the focal pointduration
- The duration of the transformationpublic float getHeight()
public float getWidth()
public boolean isDebugActive()
public void setDebugActive(boolean debugActive)
Changes whether the map debug information is shown.
The default value is false.debugActive
- If true, map debug information is shown.public void cycleDebugOptions()
Cycles through the map debug options.
The value of isDebugActive reflects whether there are any map debug options enabled or disabled.isDebugActive()
public void setStyleUrl(@NonNull java.lang.String url)
Loads a new map style asynchronous from the specified URL.
url
can take the following forms:
Style.*
: load one of the bundled styles in Style
.mapbox://styles/<user>/<style>
:
loads the style from a Mapbox account.
user
is your username. style
is the ID of your custom
style created in Mapbox Studio.http://...
or https://...
:
loads the style over the Internet from any web server.asset://...
:
loads the style from the APK assets/
directory.
This is used to load a style bundled with your app.null
: loads the default Style.MAPBOX_STREETS
style.
This method is asynchronous and will return before the style finishes loading.
If you wish to wait for the map to finish loading, listen for the MapView.DID_FINISH_LOADING_MAP
event
or use the setStyleUrl(String, OnStyleLoadedListener)
method instead.
MapView.DID_FAIL_LOADING_MAP
event will be
emitted.url
- The URL of the map styleStyle
public void setStyleUrl(@NonNull java.lang.String url, @Nullable MapboxMap.OnStyleLoadedListener callback)
Loads a new map style asynchronous from the specified URL.
url
can take the following forms:
Style.*
: load one of the bundled styles in Style
.mapbox://styles/<user>/<style>
:
loads the style from a Mapbox account.
user
is your username. style
is the ID of your custom
style created in Mapbox Studio.http://...
or https://...
:
loads the style over the Internet from any web server.asset://...
:
loads the style from the APK assets/
directory.
This is used to load a style bundled with your app.null
: loads the default Style.MAPBOX_STREETS
style.
If the style fails to load or an invalid style URL is set, the map view will become blank.
An error message will be logged in the Android logcat and MapView.DID_FAIL_LOADING_MAP
event will be
emitted.
url
- The URL of the map stylecallback
- The callback that is invoked when the style has loaded.Style
public void setStyle(java.lang.String style)
Loads a new map style from the specified bundled style.
This method is asynchronous and will return before the style finishes loading.
If you wish to wait for the map to finish loading, listen for the MapView.DID_FINISH_LOADING_MAP
event
or use the setStyle(String, OnStyleLoadedListener)
method instead.
MapView.DID_FAIL_LOADING_MAP
event will be
sent.style
- The bundled style.Style
public void setStyle(java.lang.String style, @Nullable MapboxMap.OnStyleLoadedListener callback)
Loads a new map style from the specified bundled style.
If the style fails to load or an invalid style URL is set, the map view will become blank. An error message will be logged in the Android logcat andMapView.DID_FAIL_LOADING_MAP
event will be
sent.style
- The bundled style.callback
- The callback to be invoked when the style has finished loadingStyle
@Nullable public java.lang.String getStyleUrl()
public void setStyleJson(@NonNull java.lang.String styleJson)
If the style fails to load or an invalid style URL is set, the map view will become blank.
An error message will be logged in the Android logcat and MapView.DID_FAIL_LOADING_MAP
event will be
sent.
public java.lang.String getStyleJson()
@NonNull public Marker addMarker(@NonNull MarkerOptions markerOptions)
Adds a marker to this map.
The marker's icon is rendered on the map at the locationMarker.position
.
If Marker.title
is defined, the map shows an info box with the marker's title and snippet.markerOptions
- A marker options object that defines how to render the markerMarker
that was added to the map@NonNull public Marker addMarker(@NonNull BaseMarkerOptions markerOptions)
Adds a marker to this map.
The marker's icon is rendered on the map at the locationMarker.position
.
If Marker.title
is defined, the map shows an info box with the marker's title and snippet.markerOptions
- A marker options object that defines how to render the markerMarker
that was added to the map@NonNull @Deprecated public MarkerView addMarker(@NonNull BaseMarkerViewOptions markerOptions)
SymbolLayer
instead. An example of converting Android
SDK views to be used as a symbol see https://github.com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.javaAdds a marker to this map.
The marker's icon is rendered on the map at the locationMarker.position
.
If Marker.title
is defined, the map shows an info box with the marker's title and snippet.markerOptions
- A marker options object that defines how to render the markerMarker
that was added to the map@Deprecated @NonNull public MarkerView addMarker(@NonNull BaseMarkerViewOptions markerOptions, MarkerViewManager.OnMarkerViewAddedListener onMarkerViewAddedListener)
SymbolLayer
instead. An example of converting Android
SDK views to be used as a symbol see https://github.com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.javaAdds a marker to this map.
The marker's icon is rendered on the map at the locationMarker.position
.
If Marker.title
is defined, the map shows an info box with the marker's title and snippet.markerOptions
- A marker options object that defines how to render the markeronMarkerViewAddedListener
- Callback invoked when the View has been added to the mapMarker
that was added to the map@NonNull @Deprecated public java.util.List<MarkerView> addMarkerViews(@NonNull java.util.List<? extends BaseMarkerViewOptions> markerViewOptions)
SymbolLayer
instead. An example of converting Android
SDK views to be used as a symbol see https://github.com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java
The marker's icon is rendered on the map at the location Marker.position
.
If Marker.title
is defined, the map shows an info box with the marker's title and snippet.
markerViewOptions
- A list of markerView options objects that defines how to render the markersMarkerView
s that were added to the map@NonNull @Deprecated public java.util.List<MarkerView> getMarkerViewsInRect(@NonNull android.graphics.RectF rect)
SymbolLayer
instead. An example of converting Android
SDK views to be used as a symbol see https://github.com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.javarect
- the rectangular area on the map to query for markerViews@NonNull public java.util.List<Marker> addMarkers(@NonNull java.util.List<? extends BaseMarkerOptions> markerOptionsList)
Adds multiple markers to this map.
The marker's icon is rendered on the map at the locationMarker.position
.
If Marker.title
is defined, the map shows an info box with the marker's title and snippet.markerOptionsList
- A list of marker options objects that defines how to render the markersMarker
s that were added to the mappublic void updateMarker(@NonNull Marker updatedMarker)
Updates a marker on this map. Does nothing if the marker isn't already added.
updatedMarker
- An updated marker object@NonNull public Polyline addPolyline(@NonNull PolylineOptions polylineOptions)
polylineOptions
- A polyline options object that defines how to render the polylinePolyine
that was added to the map@NonNull public java.util.List<Polyline> addPolylines(@NonNull java.util.List<PolylineOptions> polylineOptionsList)
polylineOptionsList
- A list of polyline options objects that defines how to render the polylines.Polyline
s that were added to the map.public void updatePolyline(Polyline polyline)
polyline
- An updated polyline object.@NonNull public Polygon addPolygon(@NonNull PolygonOptions polygonOptions)
polygonOptions
- A polygon options object that defines how to render the polygon.Polygon
that was added to the map.@NonNull public java.util.List<Polygon> addPolygons(@NonNull java.util.List<PolygonOptions> polygonOptionsList)
polygonOptionsList
- A list of polygon options objects that defines how to render the polygonsPolygon
s that were added to the mappublic void updatePolygon(Polygon polygon)
polygon
- An updated polygon objectpublic void removeMarker(@NonNull Marker marker)
Convenience method for removing a Marker from the map.
Calls removeAnnotation() internally.marker
- Marker to removepublic void removePolyline(@NonNull Polyline polyline)
Convenience method for removing a Polyline from the map.
Calls removeAnnotation() internally.polyline
- Polyline to removepublic void removePolygon(@NonNull Polygon polygon)
Convenience method for removing a Polygon from the map.
Calls removeAnnotation() internally.polygon
- Polygon to removepublic void removeAnnotation(@NonNull Annotation annotation)
annotation
- The annotation object to remove.public void removeAnnotation(long id)
id
- The identifier associated to the annotation to be removedpublic void removeAnnotations(@NonNull java.util.List<? extends Annotation> annotationList)
annotationList
- A list of annotation objects to remove.public void removeAnnotations()
public void clear()
@Nullable public Annotation getAnnotation(long id)
id
- the id used to look up an annotation@NonNull public java.util.List<Annotation> getAnnotations()
@NonNull public java.util.List<Marker> getMarkers()
@NonNull public java.util.List<Polygon> getPolygons()
@NonNull public java.util.List<Polyline> getPolylines()
public void setOnMarkerClickListener(@Nullable MapboxMap.OnMarkerClickListener listener)
listener
- The callback that's invoked when the user clicks on a marker.
To unset the callback, use null.public void setOnPolygonClickListener(@Nullable MapboxMap.OnPolygonClickListener listener)
listener
- The callback that's invoked when the user clicks on a polygon.
To unset the callback, use null.public void setOnPolylineClickListener(@Nullable MapboxMap.OnPolylineClickListener listener)
listener
- The callback that's invoked when the user clicks on a polyline.
To unset the callback, use null.public void selectMarker(@NonNull Marker marker)
Selects a marker. The selected marker will have it's info window opened. Any other open info windows will be closed unless isAllowConcurrentMultipleOpenInfoWindows() is true.
Selecting an already selected marker will have no effect.marker
- The marker to select.public void deselectMarkers()
public void deselectMarker(@NonNull Marker marker)
marker
- the marker to deselectpublic java.util.List<Marker> getSelectedMarkers()
public MarkerViewManager getMarkerViewManager()
public void setInfoWindowAdapter(@Nullable MapboxMap.InfoWindowAdapter infoWindowAdapter)
Sets a custom renderer for the contents of info window.
When set your callback is invoked when an info window is about to be shown. By returning a customView
, the default info window will be replaced.infoWindowAdapter
- The callback to be invoked when an info window will be shown.
To unset the callback, use null.@Nullable public MapboxMap.InfoWindowAdapter getInfoWindowAdapter()
public void setAllowConcurrentMultipleOpenInfoWindows(boolean allow)
allow
- If true, map allows concurrent multiple infowindows to be shown.public boolean isAllowConcurrentMultipleOpenInfoWindows()
public void setLatLngBoundsForCameraTarget(@Nullable LatLngBounds latLngBounds)
Set to null to clear current bounds, newly set bounds will override previously set bounds.
latLngBounds
- the bounds to constrain the map withpublic CameraPosition getCameraForLatLngBounds(@NonNull LatLngBounds latLngBounds, int[] padding)
latLngBounds
- the bounds to constrain the map withpadding
- the padding to apply to the boundspublic CameraPosition getCameraForGeometry(com.mapbox.geojson.Geometry geometry, double bearing, int[] padding)
geometry
- the geometry to constrain the map withbearing
- the bearing at which to compute the geometry's boundspadding
- the padding to apply to the boundspublic void setPadding(int left, int top, int right, int bottom)
Sets the distance from the edges of the map view's frame to the edges of the map view's logical viewport.
When the value of this property is equal to {0,0,0,0}, viewport properties such as 'centerCoordinate' assume a viewport that matches the map view's frame. Otherwise, those properties are inset, excluding part of the frame from the viewport. For instance, if the only the top edge is inset, the map center is effectively shifted downward.
left
- The left margin in pixels.top
- The top margin in pixels.right
- The right margin in pixels.bottom
- The bottom margin in pixels.public int[] getPadding()
@Deprecated public void setOnCameraChangeListener(@Nullable MapboxMap.OnCameraChangeListener listener)
listener
- The callback that's invoked on every camera change position.
To unset the callback, use null.@Deprecated public void setOnCameraIdleListener(@Nullable MapboxMap.OnCameraIdleListener listener)
addOnCameraIdleListener(OnCameraIdleListener)
and removeOnCameraIdleListener(OnCameraIdleListener)
insteadlistener
- the listener to notifypublic void addOnCameraIdleListener(@NonNull MapboxMap.OnCameraIdleListener listener)
listener
- the listener to notifypublic void removeOnCameraIdleListener(@NonNull MapboxMap.OnCameraIdleListener listener)
listener
- the listener to remove@Deprecated public void setOnCameraMoveCancelListener(@Nullable MapboxMap.OnCameraMoveCanceledListener listener)
addOnCameraMoveCancelListener(OnCameraMoveCanceledListener)
and
removeOnCameraMoveCancelListener(OnCameraMoveCanceledListener)
insteadlistener
- the listener to notifypublic void addOnCameraMoveCancelListener(@NonNull MapboxMap.OnCameraMoveCanceledListener listener)
listener
- the listener to notifypublic void removeOnCameraMoveCancelListener(@NonNull MapboxMap.OnCameraMoveCanceledListener listener)
listener
- the listener to remove@Deprecated public void setOnCameraMoveStartedListener(@Nullable MapboxMap.OnCameraMoveStartedListener listener)
addOnCameraMoveStartedListener(OnCameraMoveStartedListener)
and
removeOnCameraMoveStartedListener(OnCameraMoveStartedListener)
insteadlistener
- the listener to notifypublic void addOnCameraMoveStartedListener(@NonNull MapboxMap.OnCameraMoveStartedListener listener)
listener
- the listener to notifypublic void removeOnCameraMoveStartedListener(@NonNull MapboxMap.OnCameraMoveStartedListener listener)
listener
- the listener to remove@Deprecated public void setOnCameraMoveListener(@Nullable MapboxMap.OnCameraMoveListener listener)
addOnCameraMoveListener(OnCameraMoveListener)
and
removeOnCameraMoveListener(OnCameraMoveListener)
insteadlistener
- the listener to notifypublic void addOnCameraMoveListener(@NonNull MapboxMap.OnCameraMoveListener listener)
listener
- the listener to notifypublic void removeOnCameraMoveListener(@NonNull MapboxMap.OnCameraMoveListener listener)
listener
- the listener to removepublic void setOnFpsChangedListener(@Nullable MapboxMap.OnFpsChangedListener listener)
listener
- The callback that's invoked on every frame rendered to the map view.
To unset the callback, use null.@Deprecated public void setOnScrollListener(@Nullable MapboxMap.OnScrollListener listener)
addOnScrollListener(OnScrollListener)
instead.listener
- The callback that's invoked when the map is scrolled.
To unset the callback, use null.public void addOnScrollListener(@NonNull MapboxMap.OnScrollListener listener)
listener
- The callback that's invoked when the map is scrolled.public void removeOnScrollListener(@NonNull MapboxMap.OnScrollListener listener)
listener
- The callback that's invoked when the map is scrolled.@Deprecated public void setOnFlingListener(@Nullable MapboxMap.OnFlingListener listener)
addOnFlingListener(OnFlingListener)
instead.listener
- The callback that's invoked when the map is flinged.
To unset the callback, use null.public void addOnFlingListener(@NonNull MapboxMap.OnFlingListener listener)
listener
- The callback that's invoked when the map is flinged.public void removeOnFlingListener(@NonNull MapboxMap.OnFlingListener listener)
listener
- The callback that's invoked when the map is flinged.public void addOnMoveListener(@NonNull MapboxMap.OnMoveListener listener)
listener
- The callback that's invoked when the map is moved.public void removeOnMoveListener(@NonNull MapboxMap.OnMoveListener listener)
listener
- The callback that's invoked when the map is moved.public void addOnRotateListener(@NonNull MapboxMap.OnRotateListener listener)
listener
- The callback that's invoked when the map is rotated.public void removeOnRotateListener(@NonNull MapboxMap.OnRotateListener listener)
listener
- The callback that's invoked when the map is rotated.public void addOnScaleListener(@NonNull MapboxMap.OnScaleListener listener)
listener
- The callback that's invoked when the map is scaled.public void removeOnScaleListener(@NonNull MapboxMap.OnScaleListener listener)
listener
- The callback that's invoked when the map is scaled.public void addOnShoveListener(@NonNull MapboxMap.OnShoveListener listener)
listener
- The callback that's invoked when the map is tilted.public void removeOnShoveListener(@NonNull MapboxMap.OnShoveListener listener)
listener
- The callback that's invoked when the map is tilted.public void setGesturesManager(com.mapbox.android.gestures.AndroidGesturesManager androidGesturesManager, boolean attachDefaultListeners, boolean setDefaultMutuallyExclusives)
androidGesturesManager
- Gestures manager that interprets gestures based on the motion events.attachDefaultListeners
- If true, pre-defined listeners will be attach
to change map based on AndroidGesturesManager
callbacks.setDefaultMutuallyExclusives
- If true, pre-defined mutually exclusive gesture sets
will be added to the passed gestures manager.public com.mapbox.android.gestures.AndroidGesturesManager getGesturesManager()
public void cancelAllVelocityAnimations()
@Deprecated public void setOnMapClickListener(@Nullable MapboxMap.OnMapClickListener listener)
addOnMapClickListener(OnMapClickListener)
instead.listener
- The callback that's invoked when the user clicks on the map view.
To unset the callback, use null.public void addOnMapClickListener(@NonNull MapboxMap.OnMapClickListener listener)
listener
- The callback that's invoked when the user clicks on the map view.public void removeOnMapClickListener(@NonNull MapboxMap.OnMapClickListener listener)
listener
- The callback that's invoked when the user clicks on the map view.@Deprecated public void setOnMapLongClickListener(@Nullable MapboxMap.OnMapLongClickListener listener)
addOnMapLongClickListener(OnMapLongClickListener)
instead.listener
- The callback that's invoked when the user long clicks on the map view.
To unset the callback, use null.public void addOnMapLongClickListener(@NonNull MapboxMap.OnMapLongClickListener listener)
listener
- The callback that's invoked when the user long clicks on the map view.public void removeOnMapLongClickListener(@NonNull MapboxMap.OnMapLongClickListener listener)
listener
- The callback that's invoked when the user long clicks on the map view.public void setOnInfoWindowClickListener(@Nullable MapboxMap.OnInfoWindowClickListener listener)
listener
- The callback that's invoked when the user clicks on an info window.
To unset the callback, use null.public MapboxMap.OnInfoWindowClickListener getOnInfoWindowClickListener()
public void setOnInfoWindowLongClickListener(@Nullable MapboxMap.OnInfoWindowLongClickListener listener)
listener
- The callback that's invoked when a marker's info window is long pressed. To unset the callback,
use null.public MapboxMap.OnInfoWindowLongClickListener getOnInfoWindowLongClickListener()
public void setOnInfoWindowCloseListener(@Nullable MapboxMap.OnInfoWindowCloseListener listener)
listener
- callback invoked when an InfoWindow closespublic MapboxMap.OnInfoWindowCloseListener getOnInfoWindowCloseListener()
public void snapshot(@NonNull MapboxMap.SnapshotReadyCallback callback)
callback
- Callback method invoked when the snapshot is taken.@NonNull public java.util.List<com.mapbox.geojson.Feature> queryRenderedFeatures(@NonNull android.graphics.PointF coordinates, @Nullable java.lang.String... layerIds)
coordinates
- the point to querylayerIds
- optionally - only query these layers@NonNull public java.util.List<com.mapbox.geojson.Feature> queryRenderedFeatures(@NonNull android.graphics.PointF coordinates, @Nullable Expression filter, @Nullable java.lang.String... layerIds)
coordinates
- the point to queryfilter
- filters the returned features with an expressionlayerIds
- optionally - only query these layers@NonNull public java.util.List<com.mapbox.geojson.Feature> queryRenderedFeatures(@NonNull android.graphics.RectF coordinates, @Nullable java.lang.String... layerIds)
coordinates
- the box to querylayerIds
- optionally - only query these layers@NonNull public java.util.List<com.mapbox.geojson.Feature> queryRenderedFeatures(@NonNull android.graphics.RectF coordinates, @Nullable Expression filter, @Nullable java.lang.String... layerIds)
coordinates
- the box to queryfilter
- filters the returned features with an expressionlayerIds
- optionally - only query these layers