ViewAnnotationManager

interface ViewAnnotationManager

Manager API to control View Annotations.

View annotations are Android Views that are drawn on top of the MapView and bound to some Geometry (only Point is supported for now). In case some view annotations intersect on the screen Z-index is based on addition order.

View annotations are invariant to map camera transformations however such properties as size, visibility etc could be controlled by the user using update operation.

View annotations are not explicitly bound to any sources however ViewAnnotationOptions.associatedFeatureId could be used to bind given view annotation with some Feature by Feature.id meaning visibility of view annotation will be driven by visibility of given feature.

View annotation manager instance is destroyed automatically when MapView.onDestroy is called.

Types

Companion
Link copied to clipboard
object Companion

Static methods and variables.

Functions

addOnViewAnnotationUpdatedListener
Link copied to clipboard
abstract fun addOnViewAnnotationUpdatedListener(listener: OnViewAnnotationUpdatedListener)
addViewAnnotation
Link copied to clipboard
abstract fun addViewAnnotation(view: View, options: ViewAnnotationOptions)

Add annotation View which is already inflated. View dimensions will be taken as width / height from view's layout params unless they are not specified explicitly with ViewAnnotationOptions.Builder.width and ViewAnnotationOptions.Builder.height.

abstract fun addViewAnnotation(@LayoutRes resId: Int, options: ViewAnnotationOptions): View

Add view annotation inflated from resId synchronously.

abstract fun addViewAnnotation(@LayoutRes resId: Int, options: ViewAnnotationOptions, asyncInflater: AsyncLayoutInflater, asyncInflateCallback: (View) -> Unit)

Add view annotation inflated from resId asynchronously.

cameraForAnnotations
Link copied to clipboard
abstract fun cameraForAnnotations(annotations: List<View>, edgeInsets: EdgeInsets? = null, bearing: Double? = null, pitch: Double? = null): CameraOptions?

Return camera options bound to given view annotation list, padding, bearing and pitch values. Annotations with ViewAnnotationOptions.visible set to false will be excluded from the calculations of CameraOptions. Annotations with only View.VISIBLE will be included in the calculations for CameraOptions

getViewAnnotationByFeatureId
Link copied to clipboard
abstract fun getViewAnnotationByFeatureId(featureId: String): View?

Find View by feature id if it was specified as part of ViewAnnotationOptions.associatedFeatureId.

getViewAnnotationOptionsByFeatureId
Link copied to clipboard
abstract fun getViewAnnotationOptionsByFeatureId(featureId: String): ViewAnnotationOptions?

Find ViewAnnotationOptions of view annotation by feature id if it was specified as part of ViewAnnotationOptions.associatedFeatureId.

getViewAnnotationOptionsByView
Link copied to clipboard
abstract fun getViewAnnotationOptionsByView(view: View): ViewAnnotationOptions?

Get current ViewAnnotationOptions for given view.

getViewAnnotationUpdateMode
Link copied to clipboard
abstract fun getViewAnnotationUpdateMode(): ViewAnnotationUpdateMode

Get view annotation update mode.

removeAllViewAnnotations
Link copied to clipboard
abstract fun removeAllViewAnnotations()

Remove all view annotations.

removeOnViewAnnotationUpdatedListener
Link copied to clipboard
abstract fun removeOnViewAnnotationUpdatedListener(listener: OnViewAnnotationUpdatedListener)

Remove an instance of OnViewAnnotationUpdatedListener.

removeViewAnnotation
Link copied to clipboard
abstract fun removeViewAnnotation(view: View): Boolean

Remove given annotation view from the map if it was present.

setViewAnnotationUpdateMode
Link copied to clipboard
abstract fun setViewAnnotationUpdateMode(mode: ViewAnnotationUpdateMode)

Set view annotation update mode defined in ViewAnnotationUpdateMode.

updateViewAnnotation
Link copied to clipboard
abstract fun updateViewAnnotation(view: View, options: ViewAnnotationOptions): Boolean

Update given view annotation view with ViewAnnotationOptions. Important thing to keep in mind that only properties present in options will be updated, all other will remain the same as specified before.

Properties

annotations
Link copied to clipboard
abstract val annotations: Map<View, ViewAnnotationOptions>

Return Map of added View with their ViewAnnotationOptions. This method should be called every time to get all added Views and associated ViewAnnotationOptions.