MapSurface

A MapSurface provides an embeddable map interface. You use this class to display map information and to manipulate the map contents from your application. You can center the map on a given coordinate, specify the size of the area you want to display, and style the features of the map to fit your application's use case.

Use of MapSurface requires a Mapbox API access token. Obtain an access token on the Mapbox account page.

<strong>Warning:</strong> Please note that you are responsible for getting permission to use the map data, and for ensuring your use adheres to the relevant terms of use.

class MapSurface(context: Context, surface: Surface, mapInitOptions: MapInitOptions) : MapPluginProviderDelegate, MapControllable

Parameters

context

the application context to init the default MapInitOptions

mapInitOptions

the init options to for map

surface

the surface that will display map

Constructors

MapSurface
Link copied to clipboard

the application context to init the default MapInitOptions

fun MapSurface(context: Context, surface: Surface, mapInitOptions: MapInitOptions)

Functions

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

Returns a MapboxMap object that can be used to interact with the map.

open override fun getMapboxMap(): MapboxMap
getPlugin
Link copied to clipboard

Get the plugin instance.

open override fun <T : MapPlugin> getPlugin(id: String): T?
hashCode
Link copied to clipboard
open override fun hashCode(): Int
onDestroy
Link copied to clipboard

Called to dispose the renderer

open override fun onDestroy()
onGenericMotionEvent
Link copied to clipboard

Called when a motion event has occurred.

open override fun onGenericMotionEvent(event: MotionEvent): Boolean
onLowMemory
Link copied to clipboard

Called to reduce memory use

open override fun onLowMemory()
onSizeChanged
Link copied to clipboard

Called when the size has changed.

open override fun onSizeChanged(w: Int, h: Int)
onStart
Link copied to clipboard

Called to resume rendering

open override fun onStart()
onStop
Link copied to clipboard

Called to stop rendering

open override fun onStop()
onTouchEvent
Link copied to clipboard

Called when a touch event has occurred.

open override fun onTouchEvent(event: MotionEvent): Boolean
queueEvent
Link copied to clipboard

Queue a runnable to be executed on the map renderer thread.

open override fun queueEvent(event: Runnable, needRender: Boolean)
setMaximumFps
Link copied to clipboard

Called to limit the maximum fps

open override fun setMaximumFps(fps: Int)
setOnFpsChangedListener
Link copied to clipboard

Set OnFpsChangedListener to get map rendering FPS.

open override fun setOnFpsChangedListener(listener: OnFpsChangedListener)
snapshot
Link copied to clipboard

Called to capture a snapshot synchronously.

open override fun snapshot(): Bitmap?

Called to capture a snapshot asynchronously.

open override fun snapshot(listener: MapView.OnSnapshotReady)
surfaceChanged
Link copied to clipboard

Called when the surface dimensions have changed.

fun surfaceChanged(width: Int, height: Int)
surfaceCreated
Link copied to clipboard

Called when the surface has been created.

fun surfaceCreated()
surfaceDestroyed
Link copied to clipboard

Called when the surface

fun surfaceDestroyed()
toString
Link copied to clipboard
open override fun toString(): String