MapActions
public protocol MapActions
MapActions defines a set of methods closely connected to the map.
-
Sets the map style mode based on the provided
StyleContainer. IfMapOptions.mapStyledoes not contain a style for the given mode, no action will be performed.Declaration
Swift
var styleMode: StyleMode { get set } -
Returns all currently added [Layer] elements.
Declaration
Swift
var layers: [Layer] { get } -
Allows to change the default gesture detection behavior. For example invocation of this method with the following parameters:
setExclusiveGestures(gesture: .pinch, blockedGestures: [.rotate]).rotatebeing ignored if its not already ongoing before.pinch. Passing an empty array will remove any restrictions for the given gesture type. For example default configuration does not allow for .rotate to occur when.pinchis in progress. However after invocation ofsetExclusiveGestures(gesture: .pinch, blockedGestures: [])this restriction will be lifted off.Declaration
Swift
func setExclusiveGestures(gesture: GestureType, blockedGestures: [GestureType]) -
OptionSet for disabling the given map interaction gestures.
- Example:
let mapView = MapView() mapView.map.disabledGestures = [.doubleTap, .tap]
Declaration
Swift
var disabledGestures: [MapGestureDisableOption] { get set } - Example:
-
Provides information about what main (usually light) and dark styles are defined. Each style is defined as a
StyleDefinition.Declaration
Swift
var styleContainer: StyleContainer { get set } -
Fetches an array of
Layer‘s based on a given regex pattern. The regex is applied to theLayer.idproperty.Example:
let roads = NSRegularExpression(pattern: ".*[rR]oad.*", options: [])) mapView.map.layersForRegexp(pattern: roads)
Declaration
Swift
func layersForRegexp(pattern: NSRegularExpression) -> [Layer]Parameters
patternThe regex pattern.
Return Value
An array of
Layer‘s whose IDs fulfill the given pattern. -
Changes the labels displayed on the map to a given language. List of supported languages.
Language string. Must be a supported language.
Example:
mapView.map.language = Locale(identifier: "en-GB") ```
Declaration
Swift
var language: Locale { get set } -
Transforms a given
CGPointto aCLLocationCoordinate2Dobject.Declaration
Swift
func coordinateForPoint(point: CGPoint) -> CLLocationCoordinate2D?Parameters
pointThe point for transformation.
Return Value
The
CLLocationCoordinate2Dobject that containsCLLocationCoordinate2D. If coordinate is incorrect, it returns nil. -
Converts a given geographic location to a screen coordinate.
Declaration
Swift
func pointForCoordinate(coordinate: CLLocationCoordinate2D) -> CGPoint?Parameters
coordinateThe geographic location represented by
CLLocationCoordinate2DReturn Value
The
CGPointobject that containsxandyin the screen coordinate system. -
A method to generate a static UIImage image of the map view.
Declaration
Swift
func snapshot() -> UIImageReturn Value
Static UIImage image of the map view.
-
This method generates a static UIImage image of the map view.
Declaration
Swift
func snapshotWithoutViews(views: [UIView]) -> UIImageParameters
viewsViews that are in the map hierarchy, but which should not be in the snapshot.
Return Value
Static UIImage image of the map view.
-
Displays traffic flow on the road.
Declaration
Swift
func showTraffic() -
Hides traffic flow on the road.
Declaration
Swift
func hideTraffic() -
Displays traffic incidents on the road.
Declaration
Swift
func showTrafficIncidents() -
Hides traffic incidents on the road.
Declaration
Swift
func hideTrafficIncidents() -
Shows hillshading layer on map.
Declaration
Swift
func showHillshading() -
Hides hillshading layer on map.
Declaration
Swift
func hideHillshading() -
Register
TrafficIncidentObserverthat allow to notification whenTrafficIncidentwas clicked.Declaration
Swift
func registerTrafficIncidentObserver(_ observer: TrafficIncidentObserver)
TomTom SDK for iOS (0.53.1)
MapActions