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. If MapOptions.mapStyle does 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]) .rotate being 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 .pinch is in progress. However after invocation of setExclusiveGestures(gesture: .pinch, blockedGestures: []) this restriction will be lifted off.

    Declaration

    Swift

    func setExclusiveGestures(gesture: GestureType, blockedGestures: [GestureType])

    Parameters

    gesture

    Gesture which configuration will be altered

    blockedGestures

    Array of gestures that will be ignored when gesture provided as first parameter is in progress.

  • OptionSet for disabling the given map interaction gestures.

    • Example: let mapView = MapView() mapView.map.disabledGestures = [.doubleTap, .tap]

    Declaration

    Swift

    var disabledGestures: [MapGestureDisableOption] { get set }
  • 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 the Layer.id property.

    • Example:

      let roads = NSRegularExpression(pattern: ".*[rR]oad.*", options: []))
      mapView.map.layersForRegexp(pattern: roads)
      

    Declaration

    Swift

    func layersForRegexp(pattern: NSRegularExpression) -> [Layer]

    Parameters

    pattern

    The 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 CGPoint to a CLLocationCoordinate2D object.

    Declaration

    Swift

    func coordinateForPoint(point: CGPoint) -> CLLocationCoordinate2D?

    Parameters

    point

    The point for transformation.

    Return Value

    The CLLocationCoordinate2D object that contains CLLocationCoordinate2D. If coordinate is incorrect, it returns nil.

  • Converts a given geographic location to a screen coordinate.

    Declaration

    Swift

    func pointForCoordinate(coordinate: CLLocationCoordinate2D) -> CGPoint?

    Parameters

    coordinate

    The geographic location represented by CLLocationCoordinate2D

    Return Value

    The CGPoint object that contains x and y in the screen coordinate system.

  • A method to generate a static UIImage image of the map view.

    Declaration

    Swift

    func snapshot() -> UIImage

    Return 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]) -> UIImage

    Parameters

    views

    Views 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 TrafficIncidentObserver that allow to notification when TrafficIncident was clicked.

    Declaration

    Swift

    func registerTrafficIncidentObserver(_ observer: TrafficIncidentObserver)