public class MapImageOverlay
extension MapImageOverlay: NativeBase
extension MapImageOverlay: Hashable

MapImageOverlay is used to draw images over the map, at a view coordinate inside the map viewport.

The image to be displayed is represented by a MapImage object. By default, the overlay is centered on the given view coordinate.

The resulting viewport area covered by the overlay is computed out of the overlay’s view coordinate, the anchor point and the image size. The overlay subareas that fall outside of the map viewport get clipped.

To display the map overlay, it needs to be added to the scene using MapScene.addMapImageOverlay(...). To stop displaying it, remove it from the scene using MapScene.removeMapImageOverlay(...).

  • Creates an instance of an overlay at given view coordinates, represented by specified image.

    Declaration

    Swift

    public init(at viewCoordinates: Point2D, image: MapImage)

    Parameters

    viewCoordinates

    The overlay’s view coordinates in pixels.

    image

    The image to draw on the map.

  • Creates an instance of an overlay at given view coordinates, represented by specified image, with anchor point specifying how the image is positioned relative to the overlay’s view coordinates.

    The anchor is a way of specifying position offset relative to image’s dimensions on the view. For example, (0, 0) places the top-left corner of the image at the overlay’s view coordinates. (1, 1) would place the bottom-right corner of the image at the overlay’s view coordinates. (0.5, 0.5) which is the default value would center the image at the overlay’s view coordinates.

    Values outside the 0..1 range are also allowed, for example (0.5, 2) would display the image centered horizontally with its bottom edge above the overlay’s view coordinates at the distance in pixels that is equal to the height of the image.

    Declaration

    Swift

    public init(at viewCoordinates: Point2D, image: MapImage, anchor: Anchor2D)

    Parameters

    viewCoordinates

    The overlay’s view coordinates in pixels.

    image

    The image to draw on the map.

    anchor

    The anchor point for the overlay image which specifies the position offset relative to the overlay’s view coordinates.

  • The view point in pixels on the map viewport where the map overlay is drawn.

    Declaration

    Swift

    public var viewCoordinates: Point2D { get set }
  • Draw order of this MapImageOverlay. Overlays with higher draw order value are drawn on top of overlays with lower draw order.

    In case multiple overlays have the same draw order value then the order in which they were added to the scene matters. Last added overlay is drawn on top.

    Allowed range is [0, 1023]. Values outside this range will be clamped. The default value is 0.

    Declaration

    Swift

    public var drawOrder: Int32 { get set }
  • Image overlayed on the map.

    Declaration

    Swift

    public var image: MapImage { get set }
  • The anchor point for the overlay image which specifies the position offset relative to the overlay’s view coordinates. For example, (0, 0) places the top-left corner of the image at the overlay’s view coordinates. (1, 1) would place the bottom-right corner of the image at the overlay’s view coordinates. (0.5, 0.5) which is the default value would center the image at the overlay’s view coordinates.

    Values outside the 0..1 range are also allowed, for example (0.5, 2) would display the image centered horizontally with its bottom edge above the overlay’s view coordinates at the distance in pixels that is equal to the height of the image.

    Declaration

    Swift

    public var anchor: Anchor2D { get set }