public interface MapController
Modifier and Type | Interface and Description |
---|---|
static interface |
MapController.OnAutoCenterChangedListener
These listeners will be triggered when the auto-centering option changes.
|
static interface |
MapController.OnPanEnabledChangedListener
These listeners will be triggered when the user panning option changes.
|
static interface |
MapController.OnZoomEnabledChangedListener
These listeners will be triggered when the user zooming option changes.
|
static class |
MapController.UnknownLocationException
Thrown when trying to get the current location but the enabled providers don't have one and
there is no last known location available.
|
Modifier and Type | Method and Description |
---|---|
void |
addOnAutoCenterChangedListener(MapController.OnAutoCenterChangedListener onAutoCenterChangedListener)
Adds an auto-center listener to the list.
|
void |
addOnPanEnabledChangedListener(MapController.OnPanEnabledChangedListener onPanEnabledChangedListener)
Adds a user panning listener to the list.
|
void |
addOnZoomEnabledChangedListener(MapController.OnZoomEnabledChangedListener onZoomEnabledChangedListener)
Adds a user zooming listener to the list.
|
MarkerLayer |
createLayer()
Creates a new
MarkerLayer for the map. |
Marker |
createMarkerAt(double latitude,
double longitude)
Deprecated.
|
Marker |
createMarkerFrom(android.os.Parcel in)
Deprecated.
|
java.util.List<MarkerLayer> |
getLayers()
Returns the list of all
MarkerLayer 's that the map currently contains. |
MarkerLayer |
getLayerWithId(long id)
Returns the
MarkerLayer with the given ID. |
LocationConverter |
getLocationConverter() |
android.location.Location |
getMapCenter()
Returns the current location as shown at the center of the map.
|
java.util.List<Marker> |
getMarkers()
Deprecated.
|
Marker |
getMarkerWithId(long id)
Returns the
Marker with the given ID. |
int |
getMaxZoomLevel() |
int |
getMinZoomLevel() |
int |
getZoomLevel()
Returns the current zoom level.
|
boolean |
isAutoCenterEnabled() |
boolean |
isLayerVisible(MarkerLayer layer)
Determine if a
MarkerLayer is currently shown or not. |
boolean |
isMapReady()
Deprecated.
|
boolean |
isPanEnabled()
Note that setting this to false will not prevent panning when the panning functions are
called.
|
boolean |
isSensorLocationEnabled()
Check if map matched location enabled.
|
boolean |
isUserPanDisablesAutoCenterEnabled() |
boolean |
isZoomEnabled() |
void |
onPause()
Called when activity goes to non-active state.
|
void |
onResume()
Called when activity goes to active state.
|
void |
registerMapEventCallbacks(MapEventCallbacks eventCallbacks)
Register callbacks to be invoked on map events.
|
void |
removeLayer(MarkerLayer layer)
Removes the given
MarkerLayer from the map. |
void |
removeMarker(Marker marker)
Deprecated.
|
void |
removeMarkers(long[] markerIds)
Removes the given default
Marker s. |
void |
removeMarkers(long layerId,
long[] markersIds)
Removes the given
Marker s from given layer with current ids. |
void |
setAutoCenterEnabled(boolean enable)
Keeps the map centered at the current location of the device.
|
void |
setLayerVisibility(long layerId,
boolean show)
Show or hide a specific layer, including
StockLayers . |
void |
setLayerVisibility(MarkerLayer layer,
boolean show)
Show or hide a specific layer.
|
void |
setMapCenter(double latitude,
double longitude)
Centers the map on the given location.
|
void |
setMapCenter(android.location.Location location)
Centers the map on the given location.
|
void |
setMapCenterToCurrentLocation()
Centers the map on the current location of the device.
|
void |
setPanEnabled(boolean enable)
Control whether or not the user is allowed to pan the map using touch gestures.
|
void |
setSensorLocationEnabled(boolean enabled)
Enable/disable sensor location.
|
void |
setSensorLocationEnabled(boolean enabled,
android.graphics.drawable.Drawable icon)
Enable/disable sensor location.
|
void |
setUserPanDisablesAutoCenterEnabled(boolean enable)
Disables the auto-center mode once the user pans.
|
void |
setZoomEnabled(boolean enable)
Control whether or not the user is allowed to zoom the map using touch gestures.
|
void |
setZoomLevel(int level)
Zoom the map to the given level.
|
void setZoomEnabled(boolean enable)
enable
- When true, the user is allowed to zoom the map.boolean isZoomEnabled()
int getMinZoomLevel()
int getMaxZoomLevel()
int getZoomLevel()
void setZoomLevel(int level)
level
- The zoom level.java.lang.IllegalArgumentException
- When the given value is outside the range [0, 20].void addOnZoomEnabledChangedListener(MapController.OnZoomEnabledChangedListener onZoomEnabledChangedListener)
onZoomEnabledChangedListener
- Listener that will be notified of user zooming state changes.android.location.Location getMapCenter()
void setPanEnabled(boolean enable)
enable
- When true, the user is allowed to pan the map.boolean isPanEnabled()
void addOnPanEnabledChangedListener(MapController.OnPanEnabledChangedListener onPanEnabledChangedListener)
onPanEnabledChangedListener
- Listener that will be notified of user panning state changes.void setAutoCenterEnabled(boolean enable)
enable
- When true, the map will be kept centered at the current location.boolean isAutoCenterEnabled()
void addOnAutoCenterChangedListener(MapController.OnAutoCenterChangedListener onAutoCenterChangedListener)
onAutoCenterChangedListener
- Listener that will be notified of auto-center state changes.void setUserPanDisablesAutoCenterEnabled(boolean enable)
enable
- When true, the auto-center will be disabled once the user pans the map. When
false, the auto-center will remain active.boolean isUserPanDisablesAutoCenterEnabled()
void setMapCenterToCurrentLocation()
MapController.UnknownLocationException
- If no provider is enabled.void setMapCenter(android.location.Location location)
location
- The location the map should show at the center of the MapView.java.lang.IllegalArgumentException
- When the Location
is invalid.void setMapCenter(double latitude, double longitude)
latitude
- The latitude degrees of the location the map should show at the center of the
MapView.longitude
- The longitude degrees of the location the map should show at the center of the
MapView.java.lang.IllegalArgumentException
- When one of the given values is invalid.@Deprecated Marker createMarkerAt(double latitude, double longitude) throws MarkerOperationException
Marker
at the given location.latitude
- The latitude degrees of the location of the marker.longitude
- The longitude degrees of the locaiton of the marker.Marker
.MarkerOperationException
- When the Marker
could not be created.@Deprecated Marker createMarkerFrom(android.os.Parcel in)
Marker
from the given Parcel
.@Deprecated void removeMarker(Marker marker)
Marker
from the map.marker
- The Marker
to remove.void removeMarkers(long[] markerIds)
Marker
s.markerIds
- array of marker's ids that will be deleted.void removeMarkers(long layerId, long[] markersIds)
Marker
s from given layer with current ids.layerId
- layer's id from which markers will be deleted.markersIds
- array of marker's ids that will be deleted.@Deprecated java.util.List<Marker> getMarkers()
Marker
's that the map currently contains.Marker
's.Marker getMarkerWithId(long id)
Marker
with the given ID. Will search through all layers to find it.MarkerLayer createLayer()
MarkerLayer
for the map.MarkerLayer
.void removeLayer(MarkerLayer layer)
MarkerLayer
from the map.marker
- The MarkerLayer
to remove.java.util.List<MarkerLayer> getLayers()
MarkerLayer
's that the map currently contains.MarkerLayer
's.MarkerLayer getLayerWithId(long id)
MarkerLayer
with the given ID.id
- The ID of the MarkerLayer
.MarkerLayer
with the given ID, or null if it does not exist.void setLayerVisibility(MarkerLayer layer, boolean show)
layer
- The MarkerLayer
to change the visibility of.show
- When true, the layer will be visible; when false the layer will be hidden.void setLayerVisibility(long layerId, boolean show)
StockLayers
.layerId
- The id of the layer to change the visibility of. Can be one of the
StockLayers
values.show
- When true, the layer will be visible; when false the layer will be hidden.boolean isLayerVisible(MarkerLayer layer)
MarkerLayer
is currently shown or not.layer
- The MarkerLayer
to determine the visibility of.LocationConverter getLocationConverter()
LocationConverter
that can be used with this MapController
instance.void setSensorLocationEnabled(boolean enabled)
enabled
- When true then map matched location enabled,
when false - sensor location.void setSensorLocationEnabled(boolean enabled, android.graphics.drawable.Drawable icon)
enabled
- When true then map matched location enabled,
when false - sensor location.icon
- custom icon to show sensor matchboolean isSensorLocationEnabled()
void registerMapEventCallbacks(MapEventCallbacks eventCallbacks)
eventCallbacks
- map callbacksvoid onResume()
void onPause()
@Deprecated boolean isMapReady()