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

TomtomMap

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

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.

getGestureDetector

abstract fun getGestureDetector(): MapGestureDetector!

Get current gesture detector implementation.

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 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.

setGestureDetector

abstract fun setGestureDetector(mapGestureDetector: MapGestureDetector): Unit

Set custom gesture detector. Once the default implementation is overridden, the user can provide their own interpretation of gestures, like tilt, rotate etc.

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.

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.

addOnCircleClickListener

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

Called to add a listener for circle clicks.

addOnMapChangedListener

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

Set callback interface that is executed when the map status is changed.

addOnMapClickListener

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

Set callback interface that is executed when the user click 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

Set callback interface that is executed when the map panning is executed.

addOnMapRotateListener

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

Set callback interface that is executed when the user rotates the map.

addOnMapViewPortChangedListener

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

Set callback interface that is executed when the map view port is changed. It happens when e.g., a map is panned or zoomed.

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

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

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.

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.

getOnMapChangedListener

abstract fun getOnMapChangedListener(): CallbackContainer<TomtomMapCallback.OnMapChangedListener!>!

Returns a container of the assigned map changed listener. If no listener had been assigned then the returned container is empty.

getOnMapClickListener

abstract fun getOnMapClickListener(): CallbackContainer<TomtomMapCallback.OnMapClickListener!>!

Returns a container of the assigned map click listener. If no listener had been assigned then the returned container is empty.

getOnMapDoubleClickListener

abstract fun getOnMapDoubleClickListener(): CallbackContainer<TomtomMapCallback.OnMapDoubleClickListener!>!

Returns a container of the assigned map double-click listener. If no listener had been assigned then the returned container is empty.

getOnMapLongClickListener

abstract fun getOnMapLongClickListener(): CallbackContainer<TomtomMapCallback.OnMapLongClickListener!>!

Returns a container of the assigned map long click listener. If no listener had been assigned then the returned container is empty.

getOnMapPanningListener

abstract fun getOnMapPanningListener(): CallbackContainer<TomtomMapCallback.OnMapPanningListener!>!

Returns a container of the assigned map panning listener. If no listener had been assigned then the returned container is empty.

getOnMapRotateListener

abstract fun getOnMapRotateListener(): CallbackContainer<TomtomMapCallback.OnMapRotateListener!>!

Returns a container of the assigned map rotate listener. If no listener had been assigned then the returned container is empty.

getOnMapViewPortChangedListener

abstract fun getOnMapViewPortChangedListener(): CallbackContainer<TomtomMapCallback.OnMapViewPortChanged!>!

Returns a container of the assigned map ViewPort changes listener. If no listener had been assigned then the returned container is empty.

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.

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.

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.