public interface TomtomMap
extends androidx.core.app.ActivityCompat.OnRequestPermissionsResultCallback
TomtomMap
is obtained using the MapFragment.getAsyncMap(OnMapReadyCallback)
method on a MapFragment
.Modifier and Type | Method and Description |
---|---|
void |
addLocationUpdateListener(com.tomtom.online.sdk.location.LocationUpdateListener locationUpdateListener)
Add location update listener.
|
Marker |
addMarker(MarkerBuilder markerBuilder)
Add marker to map.
|
void |
addOnCircleClickListener(TomtomMapCallback.OnCircleClickListener listener)
Called to add a listener for circle clicks.
|
void |
addOnMapChangedListener(TomtomMapCallback.OnMapChangedListener onMapChangedListener)
Set callback interface that is executed when the map status is changed.
|
void |
addOnMapClickListener(TomtomMapCallback.OnMapClickListener listener)
Set callback interface that is executed when the user click on the map.
|
void |
addOnMapLongClickListener(TomtomMapCallback.OnMapLongClickListener listener)
Set callback interface that is executed when the user long click on the map.
|
void |
addOnMapViewPortChangedListener(TomtomMapCallback.OnMapViewPortChanged onMapViewPortChangedListener)
Set callback interface that is executed when the map view port is changed.
|
void |
addOnMarkerClickListener(TomtomMapCallback.OnMarkerClickListener listener)
Called to add a listener for marker clicks.
|
void |
addOnMarkerDragListener(TomtomMapCallback.OnMarkerDragListener listener)
Called to add a listener for marker dragging.
|
void |
addOnPolygonClickListener(TomtomMapCallback.OnPolygonClickListener listener)
Called to add a listener for polygon clicks.
|
void |
addOnPolylineClickListener(TomtomMapCallback.OnPolylineClickListener listener)
Called to add a listener for polygon clicks.
|
void |
addOnRouteClickListener(TomtomMapCallback.OnRouteClickListener listener)
Called to add a listener for route clicks.
|
Route |
addRoute(RouteBuilder routeBuilder)
Display route and prepare map to navigate on that route.
|
com.tomtom.online.sdk.matching.MatchingDataProvider |
asMatchingDataProvider()
Convert tomtomMap to matching data provider representation.
|
void |
bringRouteToFront(long routeId)
Bring the specific route to front.
|
void |
centerOn(CameraPosition cameraPosition)
Center map on using given camera position options.
|
void |
centerOn(double latitude,
double longitude)
Center map on given latitude and longitude.
|
void |
centerOn(double latitude,
double longitude,
double zoomLevel)
Center map on given latitude and longitude with a given zoom level.
|
void |
centerOn(double latitude,
double longitude,
double zoomLevel,
int yawAngle)
Center map on given latitude and longitude with a given zoom level and yaw angle (map rotation).
|
void |
centerOn(LatLng location)
Center map on given coordinates/
|
void |
centerOn(LatLng location,
double zoomLevel)
Center map on given coordinates and with given zoom level.
|
void |
centerOnMyLocation()
Center map on current location.
|
void |
centerOnMyLocationWithNorthUp()
Center map on current location and set map orientation to north.
|
void |
centerOnWithDefaultZoom(double latitude,
double longitude)
Center map on given latitude and longitude with default zoom level .
|
void |
clear()
Clear from map all annotation, like markers, polyline, polygon's, routes or chevrons.
|
void |
clearRoute()
Erase route from map.
|
void |
collectLogsToFile(java.lang.String fileName)
Collect logs from logcat to file.
|
void |
displayRouteOverview(long id)
Display route overview using its id.
|
void |
displayRoutesOverview()
Display route overview.
|
Optional<Marker> |
findMarkerByID(long id)
Find marker using its id.
|
Optional<Marker> |
findMarkerByPosition(LatLng location)
Find marker using its location (latitude, longitude).
|
Optional<Marker> |
findMarkerByTag(java.io.Serializable tag)
Find marker using its tag.
|
Optional<Route> |
findRouteByID(long id)
Find route using its id.
|
LatLng |
getCenterOfMap()
Latitude and longitude of map center.
|
com.tomtom.online.sdk.common.location.BoundingBox |
getCurrentBounds()
Gets current region bounds.
|
com.tomtom.online.sdk.location.LocationSource |
getDefaultLocationSource()
Default location source implementation.
|
double |
getDefaultZoomLevel()
Default zoom level for map.
|
DisplaySettings |
getDisplaySettings()
Advanced settings for displayed map components (e.g.
|
DrivingSettings |
getDrivingSettings()
Advanced settings for driving options manipulation.
|
com.tomtom.core.maps.MapGestureDetector |
getGestureDetector()
Get current gesture detector implementation.
|
GesturesDetectionSettings |
getGesturesDetectionSettings()
Obtains the gestures detection settings object.
|
Optional<GpsIndicator> |
getGpsPositionIndicator()
GPS Position icon indicator.
|
com.tomtom.online.sdk.location.LocationSource |
getLocationSource()
Location source provide information about map location.
|
LogoSettings |
getLogoSettings()
Settings for manipulating logo and copyrights text view.
|
java.util.List<Marker> |
getMarkers()
Get list of all markers added to map.
|
MarkerSettings |
getMarkerSettings()
Advanced settings for markers manipulation.
|
com.tomtom.online.sdk.common.callbacks.CallbackContainer<TomtomMapCallback.OnMapChangedListener> |
getOnMapChangedListener()
Returns assigned map changed interface, null otherwise.
|
com.tomtom.online.sdk.common.callbacks.CallbackContainer<TomtomMapCallback.OnMapClickListener> |
getOnMapClickListener()
Returns assigned map click interface, null otherwise.
|
com.tomtom.online.sdk.common.callbacks.CallbackContainer<TomtomMapCallback.OnMapLongClickListener> |
getOnMapLongClickListener()
Returns assigned map long click interface, null otherwise.
|
com.tomtom.online.sdk.common.callbacks.CallbackContainer<TomtomMapCallback.OnMapViewPortChanged> |
getOnMapViewPortChangedListener()
Returns assigned map view port changed interface, null otherwise.
|
OverlaySettings |
getOverlaySettings()
Overlay is shape or polyline or polygon.
|
java.util.List<Route> |
getRoutes()
Get list of all routs added to the map.
|
RouteSettings |
getRouteSettings()
Advanced settings for displaying route on map.
|
StyleSettings |
getStyleSettings()
Advanced settings for style manipulation (e.g.
|
TrafficSettings |
getTrafficSettings()
Settings for manipulating traffic settings.
|
UiSettings |
getUiSettings()
Settings for manipulating map settings related to UI (e.g.
|
android.location.Location |
getUserLocation()
If location is enabled for map, returns user's location (the same as indicated by GPS dot).
|
double |
getZoomLevel()
getZoomLevel.
|
double |
getZoomLevelForBounds(LatLng topLeft,
LatLng bottomRight)
Gets zoom for the minimum region which contains both coordinates.
|
boolean |
is2D()
True if 2D mode is set, false otherwise.
|
boolean |
isMyLocationEnabled()
Gets the status of the my-location layer.
|
boolean |
isUserLocationInMapBoundingBox()
Checks whether user location is inside current map bounding box.
|
LatLng |
latLngForPixel(android.graphics.PointF position)
Convert point on the screen to map position.
|
MapLayers |
layers()
Get settings that allow to manipulate map layers options.
|
void |
moveMapBy(double offsetX,
double offsetY,
long duration)
Moves the map toward x,y vector in specified time.
|
android.graphics.PointF |
pixelForLatLng(LatLng latLng)
Convert map position on the map to screen position.
|
void |
removeLocationUpdateListener(com.tomtom.online.sdk.location.LocationUpdateListener locationUpdateListener)
Remove location update listener.
|
void |
removeMarker(Marker marker)
Remove selected marker, if added to the map.
|
void |
removeMarkerByID(long id)
Remove marker by marker id.
|
void |
removeMarkerByTag(java.io.Serializable tag)
Remove all markers with tag.
|
void |
removeMarkers()
Remove all markers from the map.
|
void |
removeOnCircleClickListener(TomtomMapCallback.OnCircleClickListener listener)
Called to remove a listener for circle clicks.
|
void |
removeOnCircleClickListeners()
Remove all registered circle click listeners.
|
void |
removeOnMapChangedListener(TomtomMapCallback.OnMapChangedListener listener)
Unregister map changed listener.
|
void |
removeOnMapClickListener(TomtomMapCallback.OnMapClickListener listener)
unregister listener
|
void |
removeOnMapLongClickListener(TomtomMapCallback.OnMapLongClickListener listener)
unregister listener
|
void |
removeOnMapViewPortChangedListener(TomtomMapCallback.OnMapViewPortChanged listener)
unregister listener
|
void |
removeOnMarkerClickListener(TomtomMapCallback.OnMarkerClickListener listener)
Called to remove a listener for marker clicks.
|
void |
removeOnMarkerClickListeners()
Remove all registered marker click listeners.
|
void |
removeOnMarkerDragListener(TomtomMapCallback.OnMarkerDragListener listener)
Called to remove a listener for marker dragging.
|
void |
removeOnMarkerDragListeners()
Remove all registered marker drag listeners.
|
void |
removeOnPolygonClickListener(TomtomMapCallback.OnPolygonClickListener listener)
Called to remove a listener for polygon clicks.
|
void |
removeOnPolygonClickListeners()
Remove all registered polygon click listeners.
|
void |
removeOnPolylineClickListener(TomtomMapCallback.OnPolylineClickListener listener)
Called to remove a listener for polyline clicks.
|
void |
removeOnPolylineClickListeners()
Remove all registered polyline click listeners.
|
void |
removeOnRouteClickListener(TomtomMapCallback.OnRouteClickListener listener)
Called to remove a listener for route clicks.
|
void |
removeOnRouteClickListeners()
Remove all registered route click listeners.
|
void |
set25DMode()
Set 2.5 mode for map.
|
void |
set2DMode()
Set 2d mode for map.
|
void |
set3DMode()
Because our map don't support 3d mode yet, 2.5 mode is set.
|
void |
setCurrentBounds(LatLng topLeft,
LatLng bottomRight)
Sets current region as the minimum region which contains both coordinates.
|
void |
setCurrentBounds(java.util.List<LatLng> coordinates)
Sets current region as the minimum region which contains provided coordinates.
|
void |
setGeopoliticalView(java.lang.String geoView)
Set geopolitical view for vector and raster tiles.
|
void |
setGestureDetector(com.tomtom.core.maps.MapGestureDetector mapGestureDetector)
Set custom gesture detector.
|
void |
setGpsPositionIndicator(GpsIndicator gpsPositionIndicator)
Set GPS position indicator.
|
void |
setLanguage(java.lang.String language)
Set language for vector tiles as IETF language tag.
|
void |
setLocationSource(com.tomtom.online.sdk.location.LocationSource locationSource)
Set for map location source.
|
void |
setMyLocationEnabled(boolean enabled)
Enables or disables the my-location layer.
|
void |
setOnMapChangedListener(TomtomMapCallback.OnMapChangedListener onMapChangedListener)
Deprecated.
|
void |
setPadding(double top,
double left,
double bottom,
double right)
Sets padding for the map.
|
MapTiles |
tiles()
Get settings that allow to manipulate map tiles options.
|
com.tomtom.online.sdk.map.TrafficFlowStep |
trafficFlow()
Get settings that allow to manipulate traffic options.
|
com.tomtom.online.sdk.map.TrafficFlowAndIncidentStep |
trafficFlowAndIncidents()
Get settings that allow to manipulate traffic incident and flow options simultaneously.
|
com.tomtom.online.sdk.map.TrafficIncidentsStep |
trafficIncidents()
Get settings that allow to manipulate traffic incidents options.
|
void |
trafficOff()
Turn off traffic layer.
|
void |
updateGesturesDetectionSettings(GesturesDetectionSettings gesturesDetectionSettings)
Updates the current gestures detection settings.
|
void |
updateRouteStyle(long routeId,
RouteStyle routeStyle)
Updates the style of the specific route in terms of route's properties like: width, fillColor and outlineColor.
|
void |
zoomIn()
Zoom map by one level
|
void |
zoomOut()
Zoom out by one level
|
void |
zoomTo(double zoomLevel)
Zoom map to requested level.
|
void |
zoomToAllMarkers()
Zoom map to level where all markers are visible.
|
UiSettings getUiSettings()
@Beta(year=2019, month=12) TrafficSettings getTrafficSettings()
LogoSettings getLogoSettings()
MarkerSettings getMarkerSettings()
OverlaySettings getOverlaySettings()
RouteSettings getRouteSettings()
@Beta(year=2019, month=12) DrivingSettings getDrivingSettings()
@Beta(year=2019, month=12) StyleSettings getStyleSettings()
@Beta(year=2019, month=12) DisplaySettings getDisplaySettings()
@Beta(year=2019, month=12) com.tomtom.online.sdk.matching.MatchingDataProvider asMatchingDataProvider()
boolean isMyLocationEnabled()
void setMyLocationEnabled(boolean enabled)
Manifest.permission#ACCESS_COARSE_LOCATION
or Manifest.permission#ACCESS_FINE_LOCATION
unless you have set a custom location source.enabled
- Optional<GpsIndicator> getGpsPositionIndicator()
void setGpsPositionIndicator(@NonNull GpsIndicator gpsPositionIndicator)
void setGestureDetector(@NonNull com.tomtom.core.maps.MapGestureDetector mapGestureDetector)
com.tomtom.core.maps.MapGestureDetector getGestureDetector()
void clear()
void setLanguage(@NonNull java.lang.String language)
void setGeopoliticalView(@NonNull java.lang.String geoView)
@NonNull GesturesDetectionSettings getGesturesDetectionSettings()
void updateGesturesDetectionSettings(@NonNull GesturesDetectionSettings gesturesDetectionSettings)
gesturesDetectionSettings
- gestures detection settings updatevoid moveMapBy(double offsetX, double offsetY, long duration)
offsetX
- offsetY
- duration
- LatLng latLngForPixel(@NonNull android.graphics.PointF position)
position
- of screen.android.graphics.PointF pixelForLatLng(@NonNull LatLng latLng)
latLng
- position on the map.void collectLogsToFile(java.lang.String fileName)
LogUtils.enableLogs(int)
.
The best place for set log level is Application.onCreate()
method.
Android Runtime Permissions handled by this method. When method is called the Android will ask
about permissions.fileName
- Route addRoute(RouteBuilder routeBuilder)
java.util.List<Route> getRoutes()
void clearRoute()
void displayRoutesOverview()
void displayRouteOverview(long id)
void updateRouteStyle(long routeId, RouteStyle routeStyle)
routeId
- the id of the map's route.routeStyle
- the new style for the map's route.void bringRouteToFront(long routeId)
routeId
- the id of the map's route.@NonNull Marker addMarker(MarkerBuilder markerBuilder)
@NonNull java.util.List<Marker> getMarkers()
@NonNull Optional<Marker> findMarkerByPosition(LatLng location)
@NonNull Optional<Marker> findMarkerByTag(@NonNull java.io.Serializable tag)
void removeMarker(Marker marker)
marker
- void removeMarkers()
void removeMarkerByID(long id)
void removeMarkerByTag(java.io.Serializable tag)
void zoomToAllMarkers()
void centerOnMyLocation()
LocationSource.getLastKnownLocation()
The default location source is {FusedLocationSource}, however, it may
be overridden by SDK user. No action is executed when last location is null.void centerOnMyLocationWithNorthUp()
void centerOn(@NonNull LatLng location)
location
- Coordinates to center map on.void centerOn(@NonNull LatLng location, double zoomLevel)
location
- Coordinates to center map on.zoomLevel
- Map zoom levelvoid centerOn(double latitude, double longitude)
latitude
- Latitude to center map on.longitude
- Longitude to center map on.void centerOn(double latitude, double longitude, double zoomLevel)
latitude
- Latitude to center map on.longitude
- Longitude to center map on.zoomLevel
- Map zoom levelvoid centerOn(double latitude, double longitude, double zoomLevel, int yawAngle)
latitude
- Latitude to center map on.longitude
- Longitude to center map on.zoomLevel
- Map zoom levelyawAngle
- Map rotationvoid centerOnWithDefaultZoom(double latitude, double longitude)
latitude
- Latitude to center map on.longitude
- Longitude to center map on.void centerOn(@NonNull CameraPosition cameraPosition)
cameraPosition
- Camera position to center map on.void zoomTo(double zoomLevel)
zoomLevel
- void zoomIn()
void zoomOut()
double getZoomLevel()
double getZoomLevelForBounds(@NonNull LatLng topLeft, @NonNull LatLng bottomRight)
topLeft
- The top left corner of preferred region.bottomRight
- The bottom right corner of preferred region.com.tomtom.online.sdk.common.location.BoundingBox getCurrentBounds()
void setCurrentBounds(@NonNull LatLng topLeft, @NonNull LatLng bottomRight)
topLeft
- The top left corner of preferred region.bottomRight
- The bottom right corner of preferred region.void setCurrentBounds(@NonNull java.util.List<LatLng> coordinates)
coordinates
- The coordinates to set bounds for.void setPadding(double top, double left, double bottom, double right)
@Nullable android.location.Location getUserLocation()
LocationSourceExtension.addLocationUpdateListener(LocationUpdateListener)
.@NonNull LatLng getCenterOfMap()
double getDefaultZoomLevel()
boolean isUserLocationInMapBoundingBox()
void addOnMapClickListener(TomtomMapCallback.OnMapClickListener listener)
void addOnMapLongClickListener(TomtomMapCallback.OnMapLongClickListener listener)
void addOnMapViewPortChangedListener(TomtomMapCallback.OnMapViewPortChanged onMapViewPortChangedListener)
@Deprecated @DeprecatedSince(year=2019, month=1) void setOnMapChangedListener(TomtomMapCallback.OnMapChangedListener onMapChangedListener)
void addOnMapChangedListener(TomtomMapCallback.OnMapChangedListener onMapChangedListener)
com.tomtom.online.sdk.common.callbacks.CallbackContainer<TomtomMapCallback.OnMapClickListener> getOnMapClickListener()
com.tomtom.online.sdk.common.callbacks.CallbackContainer<TomtomMapCallback.OnMapLongClickListener> getOnMapLongClickListener()
com.tomtom.online.sdk.common.callbacks.CallbackContainer<TomtomMapCallback.OnMapViewPortChanged> getOnMapViewPortChangedListener()
com.tomtom.online.sdk.common.callbacks.CallbackContainer<TomtomMapCallback.OnMapChangedListener> getOnMapChangedListener()
void removeOnMapClickListener(TomtomMapCallback.OnMapClickListener listener)
listener
- void removeOnMapLongClickListener(TomtomMapCallback.OnMapLongClickListener listener)
listener
- void removeOnMapViewPortChangedListener(TomtomMapCallback.OnMapViewPortChanged listener)
listener
- void removeOnMapChangedListener(TomtomMapCallback.OnMapChangedListener listener)
void set2DMode()
void set25DMode()
void set3DMode()
boolean is2D()
@NonNull com.tomtom.online.sdk.map.TrafficFlowStep trafficFlow()
@NonNull com.tomtom.online.sdk.map.TrafficIncidentsStep trafficIncidents()
@NonNull com.tomtom.online.sdk.map.TrafficFlowAndIncidentStep trafficFlowAndIncidents()
void trafficOff()
@NonNull MapTiles tiles()
@NonNull MapLayers layers()
void addOnMarkerClickListener(TomtomMapCallback.OnMarkerClickListener listener)
listener
- Listener to be added for marker clicks.void removeOnMarkerClickListener(TomtomMapCallback.OnMarkerClickListener listener)
listener
- Listener to be removed for marker clicks.void removeOnMarkerClickListeners()
void addOnMarkerDragListener(TomtomMapCallback.OnMarkerDragListener listener)
listener
- Listener to be added for marker dragging.void removeOnMarkerDragListener(TomtomMapCallback.OnMarkerDragListener listener)
listener
- Listener to be removed for marker dragging.void removeOnMarkerDragListeners()
void addOnCircleClickListener(TomtomMapCallback.OnCircleClickListener listener)
listener
- Listener to be added for circle clicks.void removeOnCircleClickListener(TomtomMapCallback.OnCircleClickListener listener)
listener
- Listener to be removed for circle clicks.void removeOnCircleClickListeners()
void addOnPolygonClickListener(TomtomMapCallback.OnPolygonClickListener listener)
listener
- Listener to be added for polygon clicks.void removeOnPolygonClickListener(TomtomMapCallback.OnPolygonClickListener listener)
listener
- Listener to be removed for polygon clicks.void removeOnPolygonClickListeners()
void addOnPolylineClickListener(TomtomMapCallback.OnPolylineClickListener listener)
listener
- Listener to be added for polygon clicks.void removeOnPolylineClickListener(TomtomMapCallback.OnPolylineClickListener listener)
listener
- Listener to be removed for polyline clicks.void removeOnPolylineClickListeners()
void addOnRouteClickListener(TomtomMapCallback.OnRouteClickListener listener)
listener
- Listener to be added for route clicks.void removeOnRouteClickListener(TomtomMapCallback.OnRouteClickListener listener)
listener
- Listener to be removed for route clicks.void removeOnRouteClickListeners()
void setLocationSource(@NonNull com.tomtom.online.sdk.location.LocationSource locationSource)
locationSource
- @NonNull com.tomtom.online.sdk.location.LocationSource getLocationSource()
@NonNull com.tomtom.online.sdk.location.LocationSource getDefaultLocationSource()
void addLocationUpdateListener(@NonNull com.tomtom.online.sdk.location.LocationUpdateListener locationUpdateListener)
LocationSourceExtension.removeLocationUpdateListener(LocationUpdateListener)
.void removeLocationUpdateListener(@NonNull com.tomtom.online.sdk.location.LocationUpdateListener locationUpdateListener)