TomTomMap

This is the main entry point for all methods related to the map. TomTomMap can be obtained via the MapFragment or the MapView, using getMapAsync() method.

You should call methods on TomTomMap from the main thread. Otherwise an exception can occur.

Important: This is a Public Preview API. It may be changed or removed at any time.

Functions

Link copied to clipboard
open override fun addCircle(options: CircleOptions): Circle

Adds a new Circle based on the given CircleOptions

Link copied to clipboard
open override fun addMarker(options: MarkerOptions): Marker

Adds a new Marker based on the given MarkerOptions.

Link copied to clipboard
open override fun addOnCameraChangeListener(listener: OnCameraChangeListener)

Registers the OnCameraChangeListener that will be notified about any change of the camera properties.

Link copied to clipboard
open override fun addOnCameraSteadyListener(listener: OnCameraSteadyListener)

Registers the OnCameraSteadyListener that will be notified when the camera becomes steady after applying changes on its properties.

Link copied to clipboard
open override fun addOnCircleClickListener(listener: OnCircleClickListener)

Registers the OnCircleClickListener that will be notified about any circle being clicked. The clicked Circle becomes a parameter of the OnCircleClickListener.onCircleClicked callback.

Link copied to clipboard
open override fun addOnLocationMarkerClickListener(listener: OnLocationMarkerClickListener)

Registers OnLocationMarkerClickListener that will be notified about the click (aka tap) gesture recognized on the location marker. Both, the clicked position on the screen and the underlying location on the map, become parameters of the OnLocationMarkerClickListener.onLocationMarkerClick callback.

Link copied to clipboard
open override fun addOnMapClickListener(listener: OnMapClickListener)

Registers OnMapClickListener which is notified when the map has been clicked (tapped).

Link copied to clipboard
open override fun addOnMapDoubleClickListener(listener: OnMapDoubleClickListener)

Registers OnMapDoubleClickListener which is notified when the map double click (double tap) gesture has been recognized.

Link copied to clipboard
open override fun addOnMapLongClickListener(listener: OnMapLongClickListener)

Registers OnMapLongClickListener which is notified when the map long click (long press) gesture has been recognized.

Link copied to clipboard
open override fun addOnMapPanningListener(listener: OnMapPanningListener)

Registers OnMapPanningListener which is notified when user performs the panning gesture on the map.

Link copied to clipboard
open override fun addOnMarkerClickListener(listener: OnMarkerClickListener)

Registers OnMarkerClickListener that will be notified about any Marker being clicked. The clicked Marker becomes a parameter of the OnMarkerClickListener.onMarkerClicked callback.

Link copied to clipboard
open override fun addOnMarkerLongClickListener(listener: OnMarkerLongClickListener)

Registers OnMarkerLongClickListener that will be notified about the long press gesture recognized on the Marker. The clicked Marker becomes a parameter of the OnMarkerLongClickListener.onMarkerLongClicked callback.

Link copied to clipboard
open override fun addOnMarkerSelectedListener(listener: OnMarkerSelectedListener)

Registers OnMarkerLongClickListener that will be notified when marker is selected or deselected. The selected Marker becomes a parameter of the OnMarkerSelectedListener.onMarkerSelectedStateChanged callback.

Link copied to clipboard
open override fun addOnPolygonClickListener(listener: OnPolygonClickListener)

Registers the OnPolygonClickListener that will be notified about any Polygon being clicked. The clicked Polygon becomes a parameter of the OnPolygonClickListener.onPolygonClicked callback.

Link copied to clipboard
open override fun addOnPolylineClickListener(listener: OnPolylineClickListener)

Registers the OnPolylineClickListener that will be notified about any Polyline being clicked. The clicked Polyline becomes a parameter of the OnPolylineClickListener.onPolylineClicked callback.

Link copied to clipboard
open override fun addOnRouteClickListener(listener: OnRouteClickListener)

Registers OnRouteClickListener that will be notified about any route being clicked. The clicked Route becomes a parameter of the OnRouteClickListener.onRouteClick callback.

Link copied to clipboard
open override fun addOnTrafficIncidentClickListener(listener: OnTrafficIncidentClickListener)

Add OnTrafficIncidentClickListener that will be notified when user taps on the traffic incident on the map.

Link copied to clipboard
open override fun addPolygon(options: PolygonOptions): Polygon

Adds a new Polygon based on the given PolygonOptions.

Link copied to clipboard
open override fun addPolygonOverlay(options: PolygonOverlayOptions): PolygonOverlay

Create new PolygonOverlay using provided options.

Link copied to clipboard
open override fun addPolyline(options: PolylineOptions): Polyline

Adds a new Polyline based on the given PolylineOptions.

Link copied to clipboard
open override fun addRoute(options: RouteOptions): Route

Adds a new Route based on the given RouteOptions

Link copied to clipboard
open override fun animateCamera(options: CameraOptions, animationDuration: AnimationDuration?)
open override fun animateCamera(    options: CameraOptions,     animationDuration: AnimationDuration?,     actionCallback: OnCancellableActionCallback)

Moves the camera according to the given CameraOptions and animates the transition.

Link copied to clipboard
open override fun cameraPosition(): CameraPosition

Provides the current CameraPosition.

Link copied to clipboard
open override fun cameraTrackingMode(): CameraTrackingMode

Provides the current CameraTrackingMode.

Link copied to clipboard
open override fun changeCameraTrackingMode(trackingMode: CameraTrackingMode)

Changes the CameraTrackingMode.

Link copied to clipboard
open override fun changeGestureExclusions(gesture: GestureType, exclusions: Set<GestureType>)

Allows to change the default gesture detection behaviour. For example invocation of this method with the following parameters: setExclusiveGestures(GestureType.ROTATION, setOf(GestureType.SCALE)) results in GestureType.ROTATION being ignored if its not already ongoing before GestureType.SCALE.

Link copied to clipboard
fun clear()

Removes all polylines, polygons, circles, routes and markers previously added to the map.

Link copied to clipboard
open override fun coordinateForPoint(point: Point): Result<GeoCoordinate, InvalidPointException>

Converts a Point on the MapView to a position on the map. Returns Result with GeoCoordinate or InvalidPointException when cannot obtain a coordinate from the given point. It can occur when the point is not on the map.

Link copied to clipboard
open override fun disableLocationMarker()

Disables the location marker so it becomes inactive and invisible.

Link copied to clipboard
open override fun enableLocationMarker(options: LocationMarkerOptions)

Enables the location marker based on the supplied LocationMarkerOptions, replacing any existing location marker already visible. The location marker visualizes the users location on the map and can be of three types: CHEVRON: A vehicle position indicator primarily for use in turn-by-turn guidance. POINTER: A user location pointer, primarily for use in browsing or pedestrian modes. CUSTOM: A customizable model supplied by the developer.

Link copied to clipboard
open override fun getCopyrights(): Result<String, CopyrightsFetchingFailure>

Gets the map copyright contents synchronously.

open override fun getCopyrights(callback: OnCopyrightsFetchedCallback): Cancellable

Gets the map copyright contents asynchronously.

Link copied to clipboard
open override fun getLocationEngine(): LocationEngine?

Gets the currently set LocationEngine or returns null if none is set.

Link copied to clipboard
open override fun hideTrafficFlow()

Hides all traffic flow

Link copied to clipboard
open override fun hideTrafficIncidents()

Hides all traffic incidents

Link copied to clipboard
open override fun loadStyle(style: StyleDescriptor, callback: OnStyleLoadedCallback): Cancellable

Loads new map style. Provided callback is called once operation finishes with either success or failure.

Link copied to clipboard
open override fun moveCamera(options: CameraOptions)

Immediately moves camera according to the given CameraOptions.

Link copied to clipboard
open override fun pointForCoordinate(coordinate: GeoCoordinate): Point

Converts a position on the map into the MapView point.

Link copied to clipboard
fun removeAllShapes()

Removes all polylines, polygons and circles from the map.

Link copied to clipboard
open override fun removeCircles()

Removes all Circle elements from the map.

Link copied to clipboard
open override fun removeMarkers()

Removes all Marker elements from the map.

Link copied to clipboard
open override fun removeOnCameraChangeListener(listener: OnCameraChangeListener)

Removes the OnCameraChangeListener.

Link copied to clipboard
open override fun removeOnCameraSteadyListener(listener: OnCameraSteadyListener)

Removes the OnCameraSteadyListener.

Link copied to clipboard
open override fun removeOnCircleClickListener(listener: OnCircleClickListener)

Removes the OnCircleClickListener.

Link copied to clipboard
open override fun removeOnLocationMarkerClickListener(listener: OnLocationMarkerClickListener)

Removes the OnLocationMarkerClickListener.

Link copied to clipboard
open override fun removeOnMapClickListener(listener: OnMapClickListener)

Removes the OnMapClickListener.

Link copied to clipboard
open override fun removeOnMapDoubleClickListener(listener: OnMapDoubleClickListener)

Removes the OnMapDoubleClickListener.

Link copied to clipboard
open override fun removeOnMapLongClickListener(listener: OnMapLongClickListener)

Removes the OnMapLongClickListener.

Link copied to clipboard
open override fun removeOnMapPanningListener(listener: OnMapPanningListener)

Removes the OnMapPanningListener.

Link copied to clipboard
open override fun removeOnMarkerClickListener(listener: OnMarkerClickListener)

Removes the OnMarkerClickListener.

Link copied to clipboard
open override fun removeOnMarkerLongClickListener(listener: OnMarkerLongClickListener)

Removes the OnMarkerLongClickListener.

Link copied to clipboard
open override fun removeOnMarkerSelectedListener(listener: OnMarkerSelectedListener)

Removes the OnMarkerSelectedListener.

Link copied to clipboard
open override fun removeOnPolygonClickListener(listener: OnPolygonClickListener)

Removes the OnPolygonClickListener.

Link copied to clipboard
open override fun removeOnPolylineClickListener(listener: OnPolylineClickListener)

Removes the OnPolylineClickListener.

Link copied to clipboard
open override fun removeOnRouteClickListener(listener: OnRouteClickListener)

Removes the OnRouteClickListener.

Link copied to clipboard
open override fun removeOnTrafficIncidentClickListener(listener: OnTrafficIncidentClickListener)

Remove OnTrafficIncidentClickListener.

Link copied to clipboard
open override fun removePolygonOverlays()

Removes all PolygonOverlay elements from the map.

Link copied to clipboard
open override fun removePolygons()

Removes all Polygon elements from the map.

Link copied to clipboard
open override fun removePolylines()

Removes all Polyline elements from the map.

Link copied to clipboard
open override fun removeRoutes()

Removes all previously added routes.

Link copied to clipboard
open override fun renderedFeatures(geoBoundingBox: GeoBoundingBox, options: RenderedFeatureQueryOptions): List<RenderedFeature>

Gets rendered features within a given bounding box.

open override fun renderedFeatures(geoCoordinate: GeoCoordinate, options: RenderedFeatureQueryOptions): List<RenderedFeature>

Gets rendered features at a given coordinate.

Link copied to clipboard
open override fun setFrameRate(frameRate: Int)

Applies a frame rate cap on the map renderer. It can be useful for scenarios where the map is not fully visible to the user hence there is no need to render it with its full performance.

Link copied to clipboard
open override fun setLanguage(language: String)

Sets map language as IETF language tag.

Link copied to clipboard
open override fun setLocationEngine(engine: LocationEngine)

Sets new LocationEngine. Location marker position is then set based on updates that are received from that engine.

Link copied to clipboard
open override fun setPadding(padding: Padding)

Sets padding on the map. For the map, the padding means a safe area of the MapView which does not receive any input from the user. The safe area can be useful for some sections of the user interface displaying UI components like buttons, sliders etc.

Link copied to clipboard
open override fun setStyleMode(mode: StyleMode)

Configures style mode. See StyleMode for more info.

Link copied to clipboard
open override fun showTrafficFlow()

Shows all traffic flow

Link copied to clipboard
open override fun showTrafficIncidents()

Shows all traffic incidents

Link copied to clipboard
open override fun zoomToMarkers()

Zooms the map to display all markers added to the map.

open override fun zoomToMarkers(markers: List<Marker>)

Zooms the map do display markers from the given list.

Link copied to clipboard
open override fun zoomToRoutes()

Updates camera view to fit all route points.

open override fun zoomToRoutes(padding: Int)

Updates camera view to fit all route points, plus additional padding.

Properties

Link copied to clipboard
open override val circles: List<Circle>
Link copied to clipboard
open override val currentLocation: GeoLocation?

Describes the latest available (last known) GeoLocation of the device. The value may be null when the LocationEngine has never updated the current location. For example, it may be be caused by invalid GPS Fix being deliver to the device.

Link copied to clipboard
open override val isCurrentLocationInMapBoundingBox: Boolean

Flag determining whether the current location marker is located within the visible area of the screen.

Link copied to clipboard
open override var isMarkersFadingEnabled: Boolean

Flag determining whether markers fade with increased distance. True by default.

Link copied to clipboard
open override var isMarkersShrinkingEnabled: Boolean

Flag determining whether markers shrink with increased distance. True by default.

Link copied to clipboard
open override var isMultiPointerPanEnabled: Boolean

Flag determining whether the map panning with two or more fingers is enabled. True by default.

Link copied to clipboard
open override var isRotationEnabled: Boolean

Flag determining whether the rotation is enabled. True by default.

Link copied to clipboard
open override var isScrollEnabled: Boolean

Flag determining whether the scroll gesture is enabled. True by default.

Link copied to clipboard
open override var isTiltEnabled: Boolean

Flag determining whether the tilt (aka shove) gesture is enabled. True by default.

Link copied to clipboard
open override var isZoomEnabled: Boolean

Flag determining whether the zoom gesture is enabled. True by default.

Link copied to clipboard
open override val layers: List<Layer>

Returns all currently added Layer elements.

Link copied to clipboard
open override var locationAccuracyPolicy: LocationAccuracyPolicy

Determines if the location is accurate enough for the user to rely on. The default is for locations with an accuracy of more then 50 meters to be treated as unreliable.

Link copied to clipboard
open override val markers: List<Marker>
Link copied to clipboard
open override var markersFadingRange: IntRange

Defines the range of marker fading in meters. In the range 0, markersFadingRange.first markers don't fade. In the range markersFadingRange.first, markersFadingRange.last marker transparency gradually changes from fully opaque to fully transparent.

Link copied to clipboard
open override var markersShrinkingRange: IntRange

Defines the range of marker shrinking in meters. In the range 0, markersFadingRange.first markers are normal size. In the range markersFadingRange.first, markersFadingRange.last marker size gradually changes from normal to minimum possible size.

Link copied to clipboard
open override val maxZoom: Double

Provides a maximum available value for the CameraOptions.zoom attribute.

Link copied to clipboard
open override val minZoom: Double

Provides a minimum available value for the CameraOptions.zoom attribute.

Link copied to clipboard
open override val polygonOverlays: List<PolygonOverlay>

Returns all currently added PolygonOverlay elements.

Link copied to clipboard
open override val polygons: List<Polygon>

Returns all currently added Polygon elements.

Link copied to clipboard
open override val polylines: List<Polyline>

Returns all currently added Polyline elements.

Link copied to clipboard
open override val routes: List<Route>

List of added Routes.

Link copied to clipboard
open override val visibleRegion: Result<VisibleRegion, InvalidRegionException>

Provides the Result that contains VisibleRegion or InvalidRegionException, where VisibleRegion is currently visible region. If the map is completely zoomed out, this property will return four GeoCoordinates, which are combination of min/max latitude and longitude ranges. InvalidRegionException is returned if some of four coordinates is invalid and it is not possible to obtain a coordinate.