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
Marker s. |
void |
removeMarkers(long layerId,
long[] markerIds)
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.
|
public MapControllerImp(android.content.Context context, int reflectionPort)
public void setZoomEnabled(boolean enable)
MapController
setZoomEnabled
in interface MapController
enable
- When true, the user is allowed to zoom the map.public boolean isZoomEnabled()
isZoomEnabled
in interface MapController
public int getMinZoomLevel()
getMinZoomLevel
in interface MapController
public int getMaxZoomLevel()
getMaxZoomLevel
in interface MapController
public int getZoomLevel()
MapController
getZoomLevel
in interface MapController
public void setZoomLevel(int level)
MapController
setZoomLevel
in interface MapController
level
- The zoom level.public android.location.Location getMapCenter()
MapController
getMapCenter
in interface MapController
public void setMapCenterToCurrentLocation()
MapController
setMapCenterToCurrentLocation
in interface MapController
public void setAutoCenterEnabled(boolean enable)
MapController
setAutoCenterEnabled
in interface MapController
enable
- When true, the map will be kept centered at the current location.public boolean isAutoCenterEnabled()
isAutoCenterEnabled
in interface MapController
public void setUserPanDisablesAutoCenterEnabled(boolean enable)
MapController
setUserPanDisablesAutoCenterEnabled
in interface MapController
enable
- 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 MapController
public void setMapCenter(android.location.Location location)
MapController
setMapCenter
in interface MapController
location
- The location the map should show at the center of the MapView.public void setMapCenter(double latitude, double longitude)
MapController
setMapCenter
in interface MapController
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.public void setPanEnabled(boolean enable)
MapController
setPanEnabled
in interface MapController
enable
- When true, the user is allowed to pan the map.public boolean isPanEnabled()
MapController
isPanEnabled
in interface MapController
@Deprecated public Marker createMarkerAt(double latitude, double longitude) throws MarkerOperationException
MapController
Marker
at the given location.createMarkerAt
in interface MapController
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 public Marker createMarkerFrom(android.os.Parcel in)
MapController
Marker
from the given Parcel
.createMarkerFrom
in interface MapController
in
- The Parcel
to create the Marker
from.Marker
.@Deprecated public void removeMarker(Marker marker)
MapController
Marker
from the map.removeMarker
in interface MapController
marker
- The Marker
to remove.public void removeMarkers(long[] markerIds)
MapController
Marker
s.removeMarkers
in interface MapController
markerIds
- array of marker's ids that will be deleted.public void removeMarkers(long layerId, long[] markerIds)
MapController
Marker
s from given layer with current ids.removeMarkers
in interface MapController
layerId
- 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()
MapController
Marker
's that the map currently contains.getMarkers
in interface MapController
Marker
's.public Marker getMarkerWithId(long id)
MapController
Marker
with the given ID. Will search through all layers to find it.getMarkerWithId
in interface MapController
id
- The ID of the Marker
.Marker
with the given ID, or null if it does not exist.public MarkerLayer createLayer()
MapController
MarkerLayer
for the map.createLayer
in interface MapController
MarkerLayer
.public void removeLayer(MarkerLayer layer)
MapController
MarkerLayer
from the map.removeLayer
in interface MapController
public java.util.List<MarkerLayer> getLayers()
MapController
MarkerLayer
's that the map currently contains.getLayers
in interface MapController
MarkerLayer
's.public MarkerLayer getLayerWithId(long id)
MapController
MarkerLayer
with the given ID.getLayerWithId
in interface MapController
id
- The ID of the MarkerLayer
.MarkerLayer
with the given ID, or null if it does not exist.public void setLayerVisibility(MarkerLayer layer, boolean show)
MapController
setLayerVisibility
in interface MapController
layer
- 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)
MapController
StockLayers
.setLayerVisibility
in interface MapController
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.public boolean isLayerVisible(MarkerLayer layer)
MapController
MarkerLayer
is currently shown or not.isLayerVisible
in interface MapController
layer
- The MarkerLayer
to determine the visibility of.public void addOnAutoCenterChangedListener(MapController.OnAutoCenterChangedListener onAutoCenterChangedListener)
MapController
addOnAutoCenterChangedListener
in interface MapController
onAutoCenterChangedListener
- Listener that will be notified of auto-center state changes.public void addOnPanEnabledChangedListener(MapController.OnPanEnabledChangedListener onPanEnabledChangedListener)
MapController
addOnPanEnabledChangedListener
in interface MapController
onPanEnabledChangedListener
- Listener that will be notified of user panning state changes.public void addOnZoomEnabledChangedListener(MapController.OnZoomEnabledChangedListener onZoomEnabledChangedListener)
MapController
addOnZoomEnabledChangedListener
in interface MapController
onZoomEnabledChangedListener
- Listener that will be notified of user zooming state changes.public LocationConverter getLocationConverter()
getLocationConverter
in interface MapController
LocationConverter
that can be used with this MapController
instance.public void setSensorLocationEnabled(boolean enabled)
MapController
setSensorLocationEnabled
in interface MapController
enabled
- When true then map matched location enabled,
when false - sensor location.public void setSensorLocationEnabled(boolean enabled, android.graphics.drawable.Drawable icon)
MapController
setSensorLocationEnabled
in interface MapController
enabled
- When true then map matched location enabled,
when false - sensor location.icon
- custom icon to show sensor matchpublic boolean isSensorLocationEnabled()
MapController
isSensorLocationEnabled
in interface MapController
public void registerMapEventCallbacks(MapEventCallbacks eventCallback)
MapController
registerMapEventCallbacks
in interface MapController
eventCallback
- map callbackspublic void notifyMapIsConnected()
public void notifyMapIsDisconnected()
public void onResume()
MapController
onResume
in interface MapController
public void onPause()
MapController
onPause
in interface MapController
public boolean isMapReady()
MapController
isMapReady
in interface MapController