public class MapControllerImp extends java.lang.Object implements MapController
MapController implementation. It provides third party developers a
means to control their MapView instance.MapController.OnAutoCenterChangedListener, MapController.OnPanEnabledChangedListener, MapController.OnZoomEnabledChangedListener, MapController.UnknownLocationException| Constructor and Description |
|---|
MapControllerImp(android.content.Context context,
int reflectionPort) |
| 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()
Check if the map is ready to receive commands.
|
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 |
notifyMapIsConnected() |
void |
notifyMapIsDisconnected() |
void |
onPause()
Called when activity goes to non-active state.
|
void |
onResume()
Called when activity goes to active state.
|
void |
registerMapEventCallbacks(MapEventCallbacks eventCallback)
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
Markers. |
void |
removeMarkers(long layerId,
long[] markerIds)
Removes the given
Markers 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.
|
public MapControllerImp(android.content.Context context,
int reflectionPort)
public void setZoomEnabled(boolean enable)
MapControllersetZoomEnabled in interface MapControllerenable - When true, the user is allowed to zoom the map.public boolean isZoomEnabled()
isZoomEnabled in interface MapControllerpublic int getMinZoomLevel()
getMinZoomLevel in interface MapControllerpublic int getMaxZoomLevel()
getMaxZoomLevel in interface MapControllerpublic int getZoomLevel()
MapControllergetZoomLevel in interface MapControllerpublic void setZoomLevel(int level)
MapControllersetZoomLevel in interface MapControllerlevel - The zoom level.public android.location.Location getMapCenter()
MapControllergetMapCenter in interface MapControllerpublic void setMapCenterToCurrentLocation()
MapControllersetMapCenterToCurrentLocation in interface MapControllerpublic void setAutoCenterEnabled(boolean enable)
MapControllersetAutoCenterEnabled in interface MapControllerenable - When true, the map will be kept centered at the current location.public boolean isAutoCenterEnabled()
isAutoCenterEnabled in interface MapControllerpublic void setUserPanDisablesAutoCenterEnabled(boolean enable)
MapControllersetUserPanDisablesAutoCenterEnabled in interface MapControllerenable - When true, the auto-center will be disabled once the user pans the map. When
false, the auto-center will remain active.public boolean isUserPanDisablesAutoCenterEnabled()
isUserPanDisablesAutoCenterEnabled in interface MapControllerpublic void setMapCenter(android.location.Location location)
MapControllersetMapCenter in interface MapControllerlocation - The location the map should show at the center of the MapView.public void setMapCenter(double latitude,
double longitude)
MapControllersetMapCenter in interface MapControllerlatitude - 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.public void setPanEnabled(boolean enable)
MapControllersetPanEnabled in interface MapControllerenable - When true, the user is allowed to pan the map.public boolean isPanEnabled()
MapControllerisPanEnabled in interface MapController@Deprecated public Marker createMarkerAt(double latitude, double longitude) throws MarkerOperationException
MapControllerMarker at the given location.createMarkerAt in interface MapControllerlatitude - 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 public Marker createMarkerFrom(android.os.Parcel in)
MapControllerMarker from the given Parcel.createMarkerFrom in interface MapControllerin - The Parcel to create the Marker from.Marker.@Deprecated public void removeMarker(Marker marker)
MapControllerMarker from the map.removeMarker in interface MapControllermarker - The Marker to remove.public void removeMarkers(long[] markerIds)
MapControllerMarkers.removeMarkers in interface MapControllermarkerIds - array of marker's ids that will be deleted.public void removeMarkers(long layerId,
long[] markerIds)
MapControllerMarkers from given layer with current ids.removeMarkers in interface MapControllerlayerId - layer's id from which markers will be deleted.markerIds - array of marker's ids that will be deleted.@Deprecated public java.util.List<Marker> getMarkers()
MapControllerMarker's that the map currently contains.getMarkers in interface MapControllerMarker's.public Marker getMarkerWithId(long id)
MapControllerMarker with the given ID. Will search through all layers to find it.getMarkerWithId in interface MapControllerid - The ID of the Marker.Marker with the given ID, or null if it does not exist.public MarkerLayer createLayer()
MapControllerMarkerLayer for the map.createLayer in interface MapControllerMarkerLayer.public void removeLayer(MarkerLayer layer)
MapControllerMarkerLayer from the map.removeLayer in interface MapControllerpublic java.util.List<MarkerLayer> getLayers()
MapControllerMarkerLayer's that the map currently contains.getLayers in interface MapControllerMarkerLayer's.public MarkerLayer getLayerWithId(long id)
MapControllerMarkerLayer with the given ID.getLayerWithId in interface MapControllerid - The ID of the MarkerLayer.MarkerLayer with the given ID, or null if it does not exist.public void setLayerVisibility(MarkerLayer layer, boolean show)
MapControllersetLayerVisibility in interface MapControllerlayer - The MarkerLayer to change the visibility of.show - When true, the layer will be visible; when false the layer will be hidden.public void setLayerVisibility(long layerId,
boolean show)
MapControllerStockLayers.setLayerVisibility in interface MapControllerlayerId - 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.public boolean isLayerVisible(MarkerLayer layer)
MapControllerMarkerLayer is currently shown or not.isLayerVisible in interface MapControllerlayer - The MarkerLayer to determine the visibility of.public void addOnAutoCenterChangedListener(MapController.OnAutoCenterChangedListener onAutoCenterChangedListener)
MapControlleraddOnAutoCenterChangedListener in interface MapControlleronAutoCenterChangedListener - Listener that will be notified of auto-center state changes.public void addOnPanEnabledChangedListener(MapController.OnPanEnabledChangedListener onPanEnabledChangedListener)
MapControlleraddOnPanEnabledChangedListener in interface MapControlleronPanEnabledChangedListener - Listener that will be notified of user panning state changes.public void addOnZoomEnabledChangedListener(MapController.OnZoomEnabledChangedListener onZoomEnabledChangedListener)
MapControlleraddOnZoomEnabledChangedListener in interface MapControlleronZoomEnabledChangedListener - Listener that will be notified of user zooming state changes.public LocationConverter getLocationConverter()
getLocationConverter in interface MapControllerLocationConverter that can be used with this MapController
instance.public void setSensorLocationEnabled(boolean enabled)
MapControllersetSensorLocationEnabled in interface MapControllerenabled - When true then map matched location enabled,
when false - sensor location.public void setSensorLocationEnabled(boolean enabled,
android.graphics.drawable.Drawable icon)
MapControllersetSensorLocationEnabled in interface MapControllerenabled - When true then map matched location enabled,
when false - sensor location.icon - custom icon to show sensor matchpublic boolean isSensorLocationEnabled()
MapControllerisSensorLocationEnabled in interface MapControllerpublic void registerMapEventCallbacks(MapEventCallbacks eventCallback)
MapControllerregisterMapEventCallbacks in interface MapControllereventCallback - map callbackspublic void notifyMapIsConnected()
public void notifyMapIsDisconnected()
public void onResume()
MapControlleronResume in interface MapControllerpublic void onPause()
MapControlleronPause in interface MapControllerpublic boolean isMapReady()
MapControllerisMapReady in interface MapController