GroundOverlay

class GroundOverlay(image: BitmapDescriptor, position: LatLng? = null, width: Float? = null, height: Float? = null, bounds: LatLngBounds? = null, val anchor: Pair<Float, Float> = Pair(0.5f, 0.5f), bearing: Float = 0.0f, transparency: Float = 0.0f, visible: Boolean = true, zIndex: Float = 0.0f, clickable: Boolean = false, tag: Any? = null)(source)

An image placed on the map, e.g. a historic map or a floor plan, that scales with the map.

It is placed either at a position with a width (and optional height) in meters, or stretched over bounds.

The overlay is a live handle, as returned by OpenMapView.addGroundOverlay: setting a property, e.g. overlay.bearing = 45f, redraws the map right away, setPosition, setDimensions and setPositionFromBounds move it, and remove takes it off the map. Java code uses the getters and setters, e.g. overlay.setTransparency(0.5f).

Parameters

image

The image to draw

position

The location of the anchor, used with width; null when placed by bounds

width

The width in meters, used with position

height

The height in meters; null keeps the image's aspect ratio

bounds

The area the image is stretched over; null when placed by position

anchor

The point of the image at position, from (0, 0) top left to (1, 1) bottom right

bearing

The clockwise rotation in degrees around the anchor

transparency

From 0 (opaque) to 1 (invisible)

visible

Whether the overlay is drawn

zIndex

Draw order: overlays with a higher zIndex are drawn on top

clickable

Whether a tap on the overlay is reported to its click listener

tag

Optional user data

Constructors

Link copied to clipboard
constructor(image: BitmapDescriptor, position: LatLng? = null, width: Float? = null, height: Float? = null, bounds: LatLngBounds? = null, anchor: Pair<Float, Float> = Pair(0.5f, 0.5f), bearing: Float = 0.0f, transparency: Float = 0.0f, visible: Boolean = true, zIndex: Float = 0.0f, clickable: Boolean = false, tag: Any? = null)

Properties

Link copied to clipboard

The point of the image at position, from (0, 0) top left to (1, 1) bottom right

Link copied to clipboard

The clockwise rotation in degrees around the anchor

Link copied to clipboard

The area the image is stretched over, or null when it is placed by position

Link copied to clipboard

Whether a tap on the overlay is reported to its click listener

Link copied to clipboard

The height in meters, or null to keep the image's aspect ratio

Link copied to clipboard
val id: String

The unique id of this ground overlay, e.g. "go0", which stays the same for its lifetime. copy returns a ground overlay with a new id.

Link copied to clipboard

The image to draw

Link copied to clipboard

The location of the anchor, or null when the overlay is placed by bounds

Link copied to clipboard
var tag: Any?

Optional user data

Link copied to clipboard

From 0 (opaque) to 1 (invisible)

Link copied to clipboard

Whether the overlay is drawn

Link copied to clipboard
var width: Float?

The width in meters, or null when the overlay is placed by bounds

Link copied to clipboard

Draw order: overlays with a higher zIndex are drawn on top

Functions

Link copied to clipboard
fun copy(image: BitmapDescriptor = this.image, position: LatLng? = this.position, width: Float? = this.width, height: Float? = this.height, bounds: LatLngBounds? = this.bounds, anchor: Pair<Float, Float> = this.anchor, bearing: Float = this.bearing, transparency: Float = this.transparency, visible: Boolean = this.visible, zIndex: Float = this.zIndex, clickable: Boolean = this.clickable, tag: Any? = this.tag): GroundOverlay

Returns a new overlay with the given properties changed, not added to any map.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun remove()

Removes the overlay from the map that shows it.

Link copied to clipboard
fun setDimensions(width: Float)

Sets the width in meters and keeps the image's aspect ratio.

fun setDimensions(width: Float, height: Float?)

Sets the size in meters, or keeps the image's aspect ratio for a null height. An overlay placed by bounds is placed at their center instead.

Link copied to clipboard
fun setPosition(position: LatLng)

Moves the overlay, so its anchor is at position. An overlay placed by bounds keeps the width of those bounds, measured at their center.

Link copied to clipboard

Stretches the image over bounds, replacing the position and size.