ImageOverlay

public class ImageOverlay : Element

A ImageOverlay will overlay a UIImage on top of a Map. An Overlay is always on top of other elements, it will always be rotated in such a way that it is facing the MapView camera. The Overlay scales keeping the size consistent regardless of how far away the MapView Camera is.

Note: an ImageOverlay will respect the alpha channel of the UIImage, so it can be used to do more sophisticated graphics on some areas.

The ImageOverlay always tries to be a 1:1 pixel scale with the device’s screen. Meaning a high resolution image will end up much larger then an image that is a low resolution. Care should be taken in selecting the correctly scaled images.

  • The position vector of the Overlay

    Declaration

    Swift

    public var vector: Vector3 { get }
  • map

    Which Map this Overlay belongs to, this will only exist if the ImageOverlay’s position was set using a Coordinate

    Declaration

    Swift

    public var map: Map? { get }
  • Only exists if the Overlay position was set with a Coordinate

    Declaration

    Swift

    public var coordinate: Coordinate? { get }
  • Create a new ImageOverlay

    Note: If you are using the minimumTouchSize the box will always pad in all directions around the rendered element.

    Declaration

    Swift

    public init<PositionType: Position>(position: PositionType,
                                        image: UIImage,
                                        size: CGSize? = nil,
                                        anchorPoint: AnchorPoint = .center,
                                        minimumTouchSize: CGSize? = nil)

    Parameters

    position

    The location in a Map or Venue where this overlay is. This may be a Vector3 or a Coordinate

    image

    An image you wish to display on top of the map.

    size

    The size of the image in unscaled pixels. If a scaling factor is applied, it is applied to this size automatically. If not size is provided, the size will always default to the size of the image provided. The size will always respect the scale parameter of the image in this case.

    anchorPoint

    Where in the image’s 2D position space the position passed above will be associated with. The images is always projected onto the screen such that a ray passing from the camera would pass through the anchorPoint & the position.

    minimumTouchSize

    creates a larger invisible anchor that is only used for determine if a user has touched the overlay. The touch target will always be the size of the minimumTouchSize or the image size. Which ever is greater in both axis. The unit is in content scaled pixels. Defaults to (0, 0)

  • Set one or more of the ImageOverlay parameter’s The parameter’s will be set in a single animationInterval

    Declaration

    Swift

    public func set(position: Vector3, over animationInterval: TimeInterval = 0)

    Parameters

    position

    The desired position of the ImageOverlay in map space This will exist in every map. Use a Coordinate for the position to make this show up on only one specific map.

    over

    The time interval used to animate between the current look of the ImageOverlay to the one set here

  • Set one or more of the ImageOverlay parameter’s The parameter’s will be set in a single animationInterval

    Declaration

    Swift

    public func set(position: Coordinate, over animationInterval: TimeInterval = 0)

    Parameters

    position

    The desired position of the ImageOverlay This makes it appear in this spot only on the map associated with the Coordinate.

    over

    The time interval used to animate between the current position of the ImageOverlay to the one set here