TomTomMap
public class TomTomMap : AnnotationsActions, RouteActions, MapActions
extension TomTomMap: CameraActions
extension TomTomMap: RenderedFeatureActions
extension TomTomMap: VehicleActions, LocationActions
TomTomMap aggregates core map functionalities
-
The object that acts as the delegate of the
TomTomMap
.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public weak var delegate: MapDelegate?
-
The object that acts as the data source of the
TomTomMap
.Declaration
Swift
public weak var dataSource: MapDataSource?
-
The language to be used for labels returned in the response. It should be one of the supported IETF language code tags described here or one of the custom language tags. When data in a specified language is not available for a specific label, the default language is used. Default value: NGT (Neutral Ground Truth)
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public var language: Locale { get set }
-
Defines the map styles available to the user.
main
: By default this is the TomTom light style.dark
: By default this is the TomTom dark style. WhenMapOptions.mapStyle.darkStyle
is not set, settingmap.styleMode = .dark
will have no effect.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public var styleMode: StyleMode { get set }
-
An
Array
defining the map gestures to be disabled.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public var disabledGestures: [MapGestureDisableOption] { get set }
-
A container for main and dark version of the
StyleDefinition
. IfdarkStyle
is not provided, settingTomTomMap.styleMode
todark
has no effect.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public var styleContainer: StyleContainer { get set }
-
A
Bool
value indicating whether marker fading is allowed or not. By default this value isfalse
.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public var isMarkersFadingEnabled: Bool { get set }
-
A
Bool
value indicating whether marker shrinking is allowed or not. By default this value isfalse
.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public var isMarkersShrinkingEnabled: Bool { get set }
-
Sets the exclusive gestures on the map by specifying the
gesture
that has a higher priority than theblockedGestures
.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func setExclusiveGestures(gesture: GestureType, blockedGestures: [GestureType])
Parameters
gesture
An instance of
GestureType
defining the gesture type to be set.blockedGestures
Instances of
GestureType
defining the gestures with lower priority than thegesture
. -
Adds a marker to the map using the provided
MarkerOptions
.Throws
An error of typeAnnotationServiceError
if the marker could not be added.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func addMarker(options: MarkerOptions) throws -> Marker
Parameters
options
An instance of
MarkerOptions
defining the attributes of the marker to be added.Return Value
An instance of
Marker
representing the marker that was added. -
Adds a line to the map using the given
LineOptions
.Throws
An error of typeAnnotationServiceError
if the line could not be added.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func addLine(options: LineOptions) throws -> Line
Parameters
options
An instance of
LineOptions
defining the attributes of the line to be added.Return Value
An instance of
Line
representing the line that was added. -
Adds a polygon to the map using the given
PolygonOptions
.Throws
An error of typeAnnotationServiceError
if the polygon could not be added.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func addPolygon(options: PolygonOptions) throws -> Polygon
Parameters
options
An instance of
PolygonOptions
defining the attributes of the polygon to be added.Return Value
An instance of
Polygon
representing the polygon that was added. -
Adds a polygon overlay to the map using the given
PolygonOverlayOptions
.Throws
An error of typeAnnotationServiceError
if the polygon overlay could not be added.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func addPolygonOverlay(options: PolygonOverlayOptions) throws -> PolygonOverlay
Parameters
options
An instance of
PolygonOverlayOptions
defining the attributes of the polygon overlay to be added.Return Value
An instance of
PolygonOverlay
representing the polygon overlay that was added. -
Removes an annotation from the map with the given
Annotation
.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func remove(annotation: Annotation)
Parameters
annotation
An instance of
Annotation
defining the annotation to be removed. -
Adds a route to the map using the given
RouteOptions
.Throws
An error of typeRouteError
if the route could not be added.Declaration
Swift
public func addRoute(_ options: RouteOptions) throws -> Route
Parameters
options
An instance of
RouteOptions
defining the attributes of the route to be added.Return Value
An instance of
Route
representing the route that was added. -
Removes annotations from the map with the given tag.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func removeAnnotations(tag: String)
Parameters
tag
An instance of
String
defining the annotation to be removed. -
Zooms to the current markers on the map with the given tag to fit them all on the screen with the given margin.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func zoomToMarkers(marginPx: UInt, tag: String)
Parameters
marginPx
Padding between coordinates and camera borders.
tag
Tag to find current markers.
-
Zooms to the current markers on the map with the given tag to fit them all on the screen with a 0px margin.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func zoomToMarkers(tag: String)
Parameters
tag
Tag to find current markers.
-
Remove all route objects from the map.
Declaration
Swift
public func removeRoutes()
-
Adds a circle to the map using the given
CircleOptions
.Throws
An error of typeAnnotationServiceError
if the circle could not be added.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func addCircle(options: CircleOptions) throws -> Circle
Parameters
options
An instance of
CircleOptions
defining the attributes of the circle to be added.Return Value
An instance of
Circle
representing the circle that was added. -
Remove all annotations from the map regardless of tags.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func removeAnnotations()
-
Zooms to the all markers on the map regardless of tag to fit them all on the screen with a 0px margin.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func zoomToMarkers()
-
Zooms to the all markers on the map regardless of tag to fit them all on the screen with the given margin.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func zoomToMarkers(marginPx: UInt)
Parameters
marginPx
Padding between coordinates and camera borders.
-
Sets the marker distance fading range.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func setMarkerDistanceFadingRange(range: ClosedRange<Measurement<UnitLength>>)
Parameters
range
Marker distance fading range.
-
Sets the marker distance shrinking range.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func setMarkerDistanceShrinkingRange(range: ClosedRange<Measurement<UnitLength>>)
Parameters
range
Marker distance shrinking range.
-
Returns an instance of
CLLocationCoordinate2D
from the givenCGPoint
.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func coordinateForPoint(point: CGPoint) -> CLLocationCoordinate2D?
Parameters
point
An instance of
CGPoint
representing the point on the map.Return Value
An instance of
CLLocationCoordinate2D
representing the location on the map. -
Returns an instance of
CGPoint
from the givenCLLocationCoordinate2D
.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func pointForCoordinate(coordinate: CLLocationCoordinate2D) -> CGPoint?
Parameters
coordinate
An instance of
CLLocationCoordinate2D
representing the location on the map.Return Value
An instance of
CGPoint
representing the point on the map. -
Zooms to all current
Route
s with the given padding.Declaration
Swift
public func zoomToRoutes(padding: UInt)
Parameters
padding
Padding between coordinates and camera borders.
-
Selects an annotation identified by the given
Annotation
. Selecting an annotation delegates a call toMapDelegate
andMapDataSource
.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func select(annotation: Annotation)
Parameters
annotation
An instance of
Annotation
defining the annotation to be selected. -
Deselects an annotation identified by the given
Annotation
.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func deselect(annotation: Annotation)
Parameters
annotation
An instance of
Annotation
defining the annotation to be deselected. -
Takes a snapshot of the map and return a
UIImage
.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func snapshot() -> UIImage
Return Value
An instance of
UIImage
representing the snapshot of the map. -
Takes a snapshot of the map without the given
UIView
s and return aUIImage
.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func snapshotWithoutViews(views: [UIView]) -> UIImage
Parameters
views
Instances of
UIView
to be excluded.Return Value
An instance of
UIImage
representing the snapshot of the map. -
Fetches an
Array
ofLayer
s based on the given regex pattern. The regex is applied to theLayer.id
property.- Example:
let roads = NSRegularExpression(pattern: ".*[rR]oad.*", options: [])) mapView.map.layersForRegexp(pattern: roads)
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func layersForRegexp(pattern: NSRegularExpression) -> [Layer]
Parameters
pattern
Regex pattern.
Return Value
Instances of fetched
Layer
. - Example:
-
Show traffic layers on the map.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func showTraffic()
-
Hide traffic layers from the map.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func hideTraffic()
-
Show traffic incidents layers on the map.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func showTrafficIncidents()
-
Hide traffic incidents layers from the map.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func hideTrafficIncidents()
-
Register a
TrafficIncidentObserver
to be notified about traffic incidents clicks.Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func registerTrafficIncidentObserver(_ observer: TrafficIncidentObserver)
Parameters
observer
An instances of
TrafficIncidentObserver
to be notified. -
Show hillshading layers on the map.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func showHillshading()
-
Hide hillshading layers from the map.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func hideHillshading()
-
Returns visible region of the map.
Declaration
Swift
public var visibleRegion: VisibleRegion { get }
-
Returns current camera properties.
Declaration
Swift
public var cameraProperties: CameraProperties { get }
-
Represents how the camera follows the current position. There are five available tracking modes:
- none: No camera tracking.
- follow: Camera follows the current position.
- followRoute: Camera follows the current position and heading, while adjusting tilt and scale to best present the route and its guidance instructions.
- followDirection: Camera follows the current position and heading.
- routeOverview: The operator tries to fit the routes in the current view, by changing the camera zoom and look-at parameters. It constantly adjusts these parameters to keep the remaining part of the route(s) in view. Tilt and heading parameters are set to 0 in this camera mode.
Declaration
Swift
public var cameraTrackingMode: CameraTrackingMode { get set }
-
Applies a
CameraUpdate
with with the givenduration
for the animation.Declaration
Swift
public func applyCamera( _ update: CameraUpdate, animationDuration: TimeInterval, completion: ((Bool) -> ())? )
-
Applies a
CameraUpdate
with no animation.Declaration
Swift
public func moveCamera(_ update: CameraUpdate)
-
Stops the current ongoing
CameraUpdate
animation.Declaration
Swift
public func stopAnimation()
-
Fetches all map features, such as annotations and map layers at the given
CLLocationCoordinate2D
.Declaration
Swift
public func mapFeatures(coordinate: CLLocationCoordinate2D) -> [RenderedFeature]
-
Fetches all map features, such as annotations and map layers at the given
CLLocationCoordinate2D
filtered by the givenRenderedFeatureQueryOptions
.Declaration
Swift
public func mapFeatures(coordinate: CLLocationCoordinate2D, options: RenderedFeatureQueryOptions) -> [RenderedFeature]
Parameters
coordinate
The given
CLLocationCoordinate2D
to fetch the map features from.options
The
RenderedFeatureQueryOptions
filter to return specific rendered features at the given coordinate.Return Value
An
Array
ofRenderedFeature
that was found at the given coordinate filtered by the givenRenderedFeatureQueryOptions
. -
Fetches all map features, such as annotations and map layers within the given
CoordinateBounds
.Declaration
Swift
public func mapFeatures(coordinateBounds: CoordinateBounds) -> [RenderedFeature]
-
Fetches all map features, such as annotations and map layers within the given
CoordinateBounds
filtered by the givenRenderedFeatureQueryOptions
.Declaration
Swift
public func mapFeatures(coordinateBounds: CoordinateBounds, options: RenderedFeatureQueryOptions) -> [RenderedFeature]
Parameters
coordinateBounds
The given
CoordinateBounds
to fetch the map features from.options
The
RenderedFeatureQueryOptions
filter to return specific rendered features within the given coordinate bounds.Return Value
An
Array
ofRenderedFeature
that was found within the given coordinate bounds filtered by the givenRenderedFeatureQueryOptions
.
-
Provides location services, such as:
start()
: Starts the location engine. It might be called from a private queue.stop()
: Stops the location engine. It might be called from a private queue.location
: The last location received. It will be nil until a location has been received.addObserver
: Add an observer to the location engine.removeObserver
: Remove an observer from the location engine.Declaration
Swift
public var locationProvider: LocationProvider { get set }
-
Validates the location and the source that provides the location.
Declaration
Swift
public var locationValidator: LocationValidator { get set }
-
Type of the location marker’s visualization. Can be used to change the location marker’s scale and or image.
Declaration
Swift
public var locationIndicatorType: LocationIndicator { get set }
-
Starts the location engine. Might be called from a private queue.
Declaration
Swift
public func activateLocationProvider()
-
Stops the location engine. Might be called from a private queue.
Declaration
Swift
public func deactivateLocationProvider()
-
Show vehicle restrictions layers on the map respective to the given
Vehicle
.Declaration
Swift
public func showVehicleRestrictions(vehicle: Vehicle) throws
-
Show vehicle restrictions layers on the map respective to the current
Vehicle
. If aVehicle
wasn’t set, it is imperative to set theVehicle
before calling this function, and reload the style after calling function to see the vehicle restrictions layers on the map.Throws
An error of typeVehicleRestrictionsError
if the vehicle restrictions could not be shown.Declaration
Swift
public func showVehicleRestrictions() throws
-
Hide vehicle restrictions layers from the map.
Declaration
Swift
public func hideVehicleRestrictions()
-
Updates the current
Vehicle
information.Declaration
Swift
public func updateVehicle(_ vehicle: Vehicle)