sdk-maps / com.tomtom.online.sdk.map / TomtomMap

TomtomMap

interface TomtomMap : RouteExtension, MarkerExtension, MapManipulationExtension, MapInfoExtension, MapCallbacksExtension, MapViewExtension, MarkersCallbackExtension, OverlaysCallbackExtension, RouteCallbackExtension, LocationSourceExtension, OnRequestPermissionsResultCallback, CameraCallbacksExtension

Interface that is the main entry point for all methods related to the map. TomtomMap is obtained using the MapFragment#getAsyncMap(OnMapReadyCallback) method on a MapFragment.

Functions

asMatchingDataProvider

abstract fun asMatchingDataProvider(): MatchingDataProvider!

Convert tomtomMap to matching data provider representation. Road network is obtained in real-time from map tiles, according to current GPS position.

clear

abstract fun clear(): Unit

Clear from map all annotation, like markers, polyline, polygon's, routes or chevrons.

collectLogsToFile

abstract fun collectLogsToFile(fileName: String!): Unit

Collect logs from logcat to file. Set log level by com.tomtom.online.sdk.common.util.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.

getDisplaySettings

abstract fun getDisplaySettings(): DisplaySettings!

Advanced settings for displayed map components (e.g. get rendered features).

getDrivingSettings

abstract fun getDrivingSettings(): DrivingSettings!

Advanced settings for driving options manipulation.

getGesturesConfiguration

abstract fun getGesturesConfiguration(): GesturesConfiguration

Obtains the GesturesConfiguration.

getGesturesDetectionSettings

abstract fun getGesturesDetectionSettings(): GesturesDetectionSettings

Obtains the gestures detection settings object.

getGpsPositionIndicator

abstract fun getGpsPositionIndicator(): Optional<GpsIndicator!>!

GPS Position icon indicator. Visible only when my location is enabled.

getLogoSettings

abstract fun getLogoSettings(): LogoSettings!

Settings for manipulating logo and copyrights text view.

getMarkerSettings

abstract fun getMarkerSettings(): MarkerSettings!

Advanced settings for markers manipulation.

getOverlaySettings

abstract fun getOverlaySettings(): OverlaySettings!

Overlay is shape or polyline or polygon.

getRouteSettings

abstract fun getRouteSettings(): RouteSettings!

Advanced settings for displaying route on map.

getStyleSettings

abstract fun getStyleSettings(): StyleSettings!

Advanced settings for style manipulation (e.g. get layer info or add source in runtime).

getTrafficSettings

abstract fun getTrafficSettings(): TrafficSettings!

Settings for manipulating traffic settings.

getUiSettings

abstract fun getUiSettings(): UiSettings!

Settings for manipulating map settings related to the UI (e.g., styling).

isMyLocationEnabled

abstract fun isMyLocationEnabled(): Boolean

Gets the status of the my-location layer.

latLngForPixel

abstract fun latLngForPixel(position: PointF): LatLng!

Convert point on the screen to map position.

moveMapBy

abstract fun moveMapBy(offsetX: Double, offsetY: Double, duration: Long): Unit

Moves the map toward x,y vector in specified time.

pixelForLatLng

abstract fun pixelForLatLng(latLng: LatLng): PointF!

Convert map position on the map to screen position.

setGeopoliticalView

abstract fun setGeopoliticalView(geoView: String): Unit

Set geopolitical view for vector and raster tiles. By default, international view is used.

setGpsPositionIndicator

abstract fun setGpsPositionIndicator(gpsPositionIndicator: GpsIndicator): Unit

Set GPS position indicator.

setLanguage

abstract fun setLanguage(language: String): Unit

Set language for vector tiles as IETF language tag. By default, Neutral Ground Truth (NGT) is used.

setMyLocationEnabled

abstract fun setMyLocationEnabled(enabled: Boolean): Unit

Enables or disables the my-location layer. While enabled and the location is available, the my-location layer continuously draws an indication of a user's current location and bearing, and displays UI controls that allow a user to interact with their location (for example, to enable or disable camera tracking of their location and bearing). In order to use the my-location-layer feature, the SDK request permission for either Manifest.permission#ACCESS_COARSE_LOCATION or Manifest.permission#ACCESS_FINE_LOCATION unless you have set a custom location source.

updateGesturesConfiguration

abstract fun updateGesturesConfiguration(gesturesConfiguration: GesturesConfiguration): Unit

Updates the current gestures configuration. It allows to enable/disable particular gestures such as: rotation, zooming, panning and tilt.

updateGesturesDetectionSettings

abstract fun updateGesturesDetectionSettings(gesturesDetectionSettings: GesturesDetectionSettings): Unit

Updates the current gestures detection settings. It allows to enable/disable particular gestures: rotation, zooming and panning.

Inherited Functions

addLocationUpdateListener

abstract fun addLocationUpdateListener(locationUpdateListener: LocationUpdateListener): Unit

Add location update listener. When using this method, you shoud remember to unregister using LocationSourceExtension#removeLocationUpdateListener(LocationUpdateListener).

addMarker

abstract fun addMarker(markerBuilder: MarkerBuilder!): Marker

Add marker to map.

addOnCameraChangedListener

abstract fun addOnCameraChangedListener(listener: TomtomMapCallback.OnCameraChangedListener): Unit

Adds a listener that is executed when the camera has changed. For example, it happens when a map is panned or zoomed.

addOnCameraMoveCanceledListener

abstract fun addOnCameraMoveCanceledListener(listener: TomtomMapCallback.OnCameraMoveCanceledListener): Unit

Registers a listener that will be executed when the camera move is canceled.

addOnCameraMoveFinishedListener

abstract fun addOnCameraMoveFinishedListener(listener: TomtomMapCallback.OnCameraMoveFinishedListener): Unit

Registers a listener that will be executed when the camera move is completed.

addOnCameraMoveListener

abstract fun addOnCameraMoveListener(listener: TomtomMapCallback.OnCameraMoveListener): Unit

Registers a listener that will be executed when the camera move is in progress.

addOnCameraMoveStartedListener

abstract fun addOnCameraMoveStartedListener(listener: TomtomMapCallback.OnCameraMoveStartedListener): Unit

Registers a listener that will be executed when the camera starts moving.

addOnCircleClickListener

abstract fun addOnCircleClickListener(listener: TomtomMapCallback.OnCircleClickListener!): Unit

Called to add a listener for circle clicks.

addOnMapChangedListener

abstract fun addOnMapChangedListener(onMapChangedListener: TomtomMapCallback.OnMapChangedListener!): Unit

Sets a callback interface that is executed when the map status is changed.

addOnMapClickListener

abstract fun addOnMapClickListener(listener: TomtomMapCallback.OnMapClickListener!): Unit

Sets a callback interface that is executed when the user clicks on the map.

addOnMapDoubleClickListener

abstract fun addOnMapDoubleClickListener(listener: TomtomMapCallback.OnMapDoubleClickListener!): Unit

Set callback interface that is executed when the user performs a double-click on the map.

addOnMapLongClickListener

abstract fun addOnMapLongClickListener(listener: TomtomMapCallback.OnMapLongClickListener!): Unit

Set callback interface that is executed when the user long click on the map.

addOnMapPanningListener

abstract fun addOnMapPanningListener(onMapPanningListener: TomtomMapCallback.OnMapPanningListener!): Unit

Sets a callback interface that is executed when the map panning is executed.

addOnMapRotateListener

abstract fun addOnMapRotateListener(listener: TomtomMapCallback.OnMapRotateListener!): Unit

Sets a callback interface that is executed when the user rotates the map.

addOnMapViewPortChangedListener

abstract fun addOnMapViewPortChangedListener(onMapViewPortChangedListener: TomtomMapCallback.OnMapViewPortChanged!): Unit

Sets a callback interface that is executed when the map view port is changed. For example, it happens when a map is panned or zoomed. Use CameraCallbacksExtension#addOnCameraChangedListener(TomtomMapCallback.OnCameraChangedListener)

addOnMarkerClickListener

abstract fun addOnMarkerClickListener(listener: TomtomMapCallback.OnMarkerClickListener!): Unit

Called to add a listener for marker clicks.

addOnMarkerDragListener

abstract fun addOnMarkerDragListener(listener: TomtomMapCallback.OnMarkerDragListener!): Unit

Called to add a listener for marker dragging.

addOnPolygonClickListener

abstract fun addOnPolygonClickListener(listener: TomtomMapCallback.OnPolygonClickListener!): Unit

Called to add a listener for polygon clicks.

addOnPolylineClickListener

abstract fun addOnPolylineClickListener(listener: TomtomMapCallback.OnPolylineClickListener!): Unit

Called to add a listener for polygon clicks.

addOnRouteClickListener

abstract fun addOnRouteClickListener(listener: TomtomMapCallback.OnRouteClickListener!): Unit

Called to add a listener for route clicks.

addRoute

abstract fun addRoute(routeBuilder: RouteBuilder!): Route!

Display route and prepare map to navigate on that route.

bringRouteToFront

abstract fun bringRouteToFront(routeId: Long): Unit

Bring the specific route to front. As a result, it will be drawn on top of other routes.

centerOn

abstract fun centerOn(location: LatLng): Unit

Center map on given coordinates/

abstract fun centerOn(location: LatLng, zoomLevel: Double): Unit

Center map on given coordinates and with given zoom level. When zoom level is out of range, the minimum zoom level will be set. Zoom levels are in range [0, 20]

abstract fun centerOn(latitude: Double, longitude: Double): Unit

Center map on given latitude and longitude. Latitude and longitude is set in degrees minutes seconds format.

abstract fun centerOn(latitude: Double, longitude: Double, zoomLevel: Double): Unit

Center map on given latitude and longitude with a given zoom level. When zoom level is out of range, the minimum zoom level will be set. Zoom levels are in range [0, 20], where 0 is the whole world and 20 is the highest zoom level. Latitude and longitude is set in degrees minutes seconds format.

abstract fun centerOn(latitude: Double, longitude: Double, zoomLevel: Double, yawAngle: Int): Unit

Center map on given latitude and longitude with a given zoom level and yaw angle (map rotation). When zoom level is out of range, the minimum zoom level will be set. Zoom levels are in range [0, 20], where 0 is the whole world and 20 is the highest zoom level. Yaw angle is in range [0, 360], where 0 is north, 90 is east, 180 is south, and 270 is west. Latitude and longitude is set in degrees minutes seconds format.

abstract fun centerOn(cameraPosition: CameraPosition): Unit

Center map on using given camera position options. The required parameters for camera position are latitude and longitude (set in degrees minutes seconds format). Zoom, bearing and pitch are not mandatory, will be used once they are set.

abstract fun centerOn(cameraFocusArea: CameraFocusArea): Unit
abstract fun centerOn(cameraFocusArea: CameraFocusArea, callback: OnMapCenteredCallback!): Unit

Centers a map on the area determined by the BoundingBox defined in the CameraFocusArea. Configurable bearing and pitch are optional.

abstract fun centerOn(cameraFocusArea: CameraFocusArea, animationDuration: AnimationDuration!): Unit
abstract fun centerOn(cameraFocusArea: CameraFocusArea, animationDuration: AnimationDuration!, callback: OnMapCenteredCallback!): Unit

Centers a map on the area determined by the BoundingBox defined in the CameraFocusArea. Configurable bearing and pitch are optional. Map centering can be animated with a set time determined by the given AnimationDuration parameter.

abstract fun centerOn(cameraPosition: CameraPosition, callback: OnMapCenteredCallback!): Unit

Center the map when using the given camera position options. The required parameters for camera position are latitude and longitude (set in the degrees minutes seconds format). Zoom, bearing, and pitch are not mandatory and will be used once they are set.

centerOnMyLocation

abstract fun centerOnMyLocation(): Unit

Center map on current location. The current location is obtained using 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.

centerOnMyLocationWithNorthUp

abstract fun centerOnMyLocationWithNorthUp(): Unit

Center map on current location and set map orientation to north. No action is executed when last location is null.

centerOnWithDefaultZoom

abstract fun centerOnWithDefaultZoom(latitude: Double, longitude: Double): Unit

Center map on given latitude and longitude with default zoom level {@value MapConstants#DEFAULT_ZOOM_LEVEL}. Latitude and longitude is set in degrees minutes seconds format.

clearRoute

abstract fun clearRoute(): Unit

Erase route from map.

displayRouteOverview

abstract fun displayRouteOverview(id: Long): Unit

Display route overview using its id. No action when route not found.

displayRoutesOverview

abstract fun displayRoutesOverview(): Unit

Display route overview. All added routes will be visible.

findMarkerByID

abstract fun findMarkerByID(id: Long): Optional<Marker!>

Find marker using its id.

findMarkerByPosition

abstract fun findMarkerByPosition(location: LatLng!): Optional<Marker!>

Find marker using its location (latitude, longitude).

findMarkerByTag

abstract fun findMarkerByTag(tag: Serializable): Optional<Marker!>

Find marker using its tag.

findRouteByID

abstract fun findRouteByID(id: Long): Optional<Route!>!

Find route using its id.

getCenterOfMap

abstract fun getCenterOfMap(): LatLng

Latitude and longitude of map center.

getCurrentBounds

abstract fun getCurrentBounds(): BoundingBox!

Gets the current region bounds.

getDefaultLocationSource

abstract fun getDefaultLocationSource(): LocationSource

Default location source implementation. This method creates a new instance that can be used by user.

getDefaultZoomLevel

abstract fun getDefaultZoomLevel(): Double

Default zoom level for map. See {@value MapConstants#DEFAULT_ZOOM_LEVEL}.

getLocationSource

abstract fun getLocationSource(): LocationSource

Location source provide information about map location. LocationSource is registered in onResume and unregister in onPause method.

getMarkers

abstract fun getMarkers(): MutableList<Marker!>

Get list of all markers added to map. Even marker which already not visible on map.

getRoutes

abstract fun getRoutes(): MutableList<Route!>!

Get list of all routs added to the map.

getUserLocation

abstract fun getUserLocation(): Location?

If location is enabled for map, returns user's location (the same as indicated by GPS dot). If GPS position is not available, this method returns null. It is possible to observe location events using TomtomMap#addLocationUpdateListener(LocationUpdateListener).

getZoomLevel

abstract fun getZoomLevel(): Double

getZoomLevel.

getZoomLevelForBounds

abstract fun getZoomLevelForBounds(topLeft: LatLng, bottomRight: LatLng): Double

Gets zoom for the minimum region which contains both coordinates.

is2D

abstract fun is2D(): Boolean

True if 2D mode is set, false otherwise.

isUserLocationInMapBoundingBox

abstract fun isUserLocationInMapBoundingBox(): Boolean

Checks whether user location is inside current map bounding box.

layers

abstract fun layers(): MapLayers

Get settings that allow to manipulate map layers options.

removeLocationUpdateListener

abstract fun removeLocationUpdateListener(locationUpdateListener: LocationUpdateListener): Unit

Remove location update listener.

removeMarker

abstract fun removeMarker(marker: Marker!): Unit

Remove selected marker, if added to the map.

removeMarkerByID

abstract fun removeMarkerByID(id: Long): Unit

Remove marker by marker id. Because id is unique, method should remove one marker.

removeMarkerByTag

abstract fun removeMarkerByTag(tag: Serializable!): Unit

Remove all markers with tag.

removeMarkers

abstract fun removeMarkers(): Unit

Remove all markers from the map.

removeOnCameraChangedListener

abstract fun removeOnCameraChangedListener(listener: TomtomMapCallback.OnCameraChangedListener): Unit

Removes the previously added listener.

removeOnCameraMoveCanceledListener

abstract fun removeOnCameraMoveCanceledListener(listener: TomtomMapCallback.OnCameraMoveCanceledListener): Unit

Unregisters the TomtomMapCallback.OnCameraMoveCanceledListener.

removeOnCameraMoveFinishedListener

abstract fun removeOnCameraMoveFinishedListener(listener: TomtomMapCallback.OnCameraMoveFinishedListener): Unit

Unregisters the TomtomMapCallback.OnCameraMoveFinishedListener.

removeOnCameraMoveListener

abstract fun removeOnCameraMoveListener(listener: TomtomMapCallback.OnCameraMoveListener): Unit

Unregisters the TomtomMapCallback.OnCameraMoveListener.

removeOnCameraMoveStartedListener

abstract fun removeOnCameraMoveStartedListener(listener: TomtomMapCallback.OnCameraMoveStartedListener): Unit

Unregisters the TomtomMapCallback.OnCameraMoveStartedListener.

removeOnCircleClickListener

abstract fun removeOnCircleClickListener(listener: TomtomMapCallback.OnCircleClickListener!): Unit

Called to remove a listener for circle clicks.

removeOnCircleClickListeners

abstract fun removeOnCircleClickListeners(): Unit

Remove all registered circle click listeners.

removeOnMapChangedListener

abstract fun removeOnMapChangedListener(listener: TomtomMapCallback.OnMapChangedListener!): Unit

Unregister the map changed listener.

removeOnMapClickListener

abstract fun removeOnMapClickListener(listener: TomtomMapCallback.OnMapClickListener!): Unit

Unregister the map click listener given as the parameter.

removeOnMapDoubleClickListener

abstract fun removeOnMapDoubleClickListener(listener: TomtomMapCallback.OnMapDoubleClickListener!): Unit

Unregister the map double-click listener given as the parameter.

removeOnMapLongClickListener

abstract fun removeOnMapLongClickListener(listener: TomtomMapCallback.OnMapLongClickListener!): Unit

Unregister the map long listener given as the parameter.

removeOnMapPanningListener

abstract fun removeOnMapPanningListener(listener: TomtomMapCallback.OnMapPanningListener!): Unit

Unregister the map panning listener.

removeOnMapRotateListener

abstract fun removeOnMapRotateListener(listener: TomtomMapCallback.OnMapRotateListener!): Unit

Unregister the map rotate listener given as the parameter.

removeOnMapViewPortChangedListener

abstract fun removeOnMapViewPortChangedListener(listener: TomtomMapCallback.OnMapViewPortChanged!): Unit

Unregister the map view port changes listener. Use CameraCallbacksExtension#removeOnCameraChangedListener(TomtomMapCallback.OnCameraChangedListener)

removeOnMarkerClickListener

abstract fun removeOnMarkerClickListener(listener: TomtomMapCallback.OnMarkerClickListener!): Unit

Called to remove a listener for marker clicks.

removeOnMarkerClickListeners

abstract fun removeOnMarkerClickListeners(): Unit

Remove all registered marker click listeners.

removeOnMarkerDragListener

abstract fun removeOnMarkerDragListener(listener: TomtomMapCallback.OnMarkerDragListener!): Unit

Called to remove a listener for marker dragging.

removeOnMarkerDragListeners

abstract fun removeOnMarkerDragListeners(): Unit

Remove all registered marker drag listeners.

removeOnPolygonClickListener

abstract fun removeOnPolygonClickListener(listener: TomtomMapCallback.OnPolygonClickListener!): Unit

Called to remove a listener for polygon clicks.

removeOnPolygonClickListeners

abstract fun removeOnPolygonClickListeners(): Unit

Remove all registered polygon click listeners.

removeOnPolylineClickListener

abstract fun removeOnPolylineClickListener(listener: TomtomMapCallback.OnPolylineClickListener!): Unit

Called to remove a listener for polyline clicks.

removeOnPolylineClickListeners

abstract fun removeOnPolylineClickListeners(): Unit

Remove all registered polyline click listeners.

removeOnRouteClickListener

abstract fun removeOnRouteClickListener(listener: TomtomMapCallback.OnRouteClickListener!): Unit

Called to remove a listener for route clicks.

removeOnRouteClickListeners

abstract fun removeOnRouteClickListeners(): Unit

Remove all registered route click listeners.

set25DMode

abstract fun set25DMode(): Unit

Set 2.5 mode for map.

set2DMode

abstract fun set2DMode(): Unit

Set 2d mode for map.

set3DMode

abstract fun set3DMode(): Unit

Because our map don't support 3d mode yet, 2.5 mode is set.

setCurrentBounds

abstract fun setCurrentBounds(topLeft: LatLng, bottomRight: LatLng): Unit

Sets current region as the minimum region which contains both coordinates.

abstract fun setCurrentBounds(coordinates: MutableList<LatLng!>): Unit

Sets current region as the minimum region which contains the provided coordinates.

setLocationSource

abstract fun setLocationSource(locationSource: LocationSource): Unit

Set for map location source. Map take from location source information about location of chevron.

setPadding

abstract fun setPadding(top: Double, left: Double, bottom: Double, right: Double): Unit

Sets padding for the map in pixels. Changing map padding does not have an immediate effect on the map. It will be applied with the next map operation.

abstract fun setPadding(mapPadding: MapPadding!): Unit

Sets padding for the map in pixels using MapPadding class. Changing map padding does not have an immediate effect on the map. It will be applied with the next map operation.

tiles

abstract fun tiles(): MapTiles

Get settings that allow to manipulate map tiles options.

trafficFlow

abstract fun trafficFlow(): TrafficFlowStep

Get settings that allow to manipulate traffic options.

trafficFlowAndIncidents

abstract fun trafficFlowAndIncidents(): TrafficFlowAndIncidentStep

Get settings that allow to manipulate traffic incident and flow options simultaneously.

trafficIncidents

abstract fun trafficIncidents(): TrafficIncidentsStep

Get settings that allow to manipulate traffic incidents options.

trafficOff

abstract fun trafficOff(): Unit

Turn off traffic layer. Incidents and flow. (Vector and raster type)

updateRouteStyle

abstract fun updateRouteStyle(routeId: Long, routeStyle: RouteStyle!): Unit

Updates the style of the specific route in terms of route's properties like: width, fillColor and outlineColor.

zoomIn

abstract fun zoomIn(): Unit

Zoom map by one level

zoomOut

abstract fun zoomOut(): Unit

Zoom out by one level

zoomTo

abstract fun zoomTo(zoomLevel: Double): Unit

Zoom the map to a requested level. Zoom levels are in the range of [0, 20]. 0 is the whole world. 20 is the highest zoom level.

zoomToAllMarkers

abstract fun zoomToAllMarkers(): Unit

Zoom map to level where all markers are visible.