Package world.mappable.mapkit.map

Interface MapObject

All known Subinterfaces:

BaseMapObjectCollection, CircleMapObject, PlacemarkMapObject, PolygonMapObject, PolylineMapObject

interface MapObject

An object displayed on the map.

Summary

Methods

Type and modifiers

Method and Description

BaseMapObjectCollection

getParent()
Returns the collection of map objects that the current map object belongs to.

boolean

isVisible()
Manages visibility of the object on the map.

void

setVisible(boolean visible)

void

setVisible(boolean visible,
           @NonNull Animation animation,
           @Nullable Callback onFinished)

Manages visibility of the object.

float

getZIndex()
Gets the z-index, which affects:

  • Rendering order.
  • Dispatching of UI events (taps and drags are dispatched to objects with higher z-indexes first).
Z-index is relative to the parent.

void

setZIndex(float zIndex)

boolean

isDraggable()
If true, the map object can be dragged by the user.

void

setDraggable(boolean draggable)

java.lang.Object

getUserData()
Use this property to attach any object-related metadata.

void

setUserData(@Nullable java.lang.Object userData)

void

addTapListener(@NonNull MapObjectTapListener tapListener)
Adds a tap listener to the object.

void

removeTapListener(@NonNull MapObjectTapListener tapListener)
Removes the tap listener from the object.

void

setDragListener(@Nullable MapObjectDragListener dragListener)
Sets a drag listener for the object.

boolean

isValid()
Tells if this MapObject is valid or not.

Methods

getParent

@NonNull
BaseMapObjectCollection getParent()

Returns the collection of map objects that the current map object belongs to.


isVisible

boolean isVisible()

Manages visibility of the object on the map.

Default: true.


setVisible

void setVisible(boolean visible)


setVisible

void setVisible(boolean visible,
                @NonNull Animation animation,
                @Nullable Callback onFinished)

Manages visibility of the object.

Parameters

animation

Describes the transition between visible and not visible states.

onFinished

Called when the transition is finished.


getZIndex

float getZIndex()

Gets the z-index, which affects:

  • Rendering order.
  • Dispatching of UI events (taps and drags are dispatched to objects with higher z-indexes first).
Z-index is relative to the parent.


setZIndex

void setZIndex(float zIndex)


isDraggable

boolean isDraggable()

If true, the map object can be dragged by the user.

Default: false.


setDraggable

void setDraggable(boolean draggable)


getUserData

@Nullable
java.lang.Object getUserData()

Use this property to attach any object-related metadata.

Optional property, can be null.


setUserData

void setUserData(@Nullable java.lang.Object userData)


addTapListener

void addTapListener(@NonNull MapObjectTapListener tapListener)

Adds a tap listener to the object.

The class does not retain the object in the 'tapListener' parameter. It is your responsibility to maintain a strong reference to the target object while it is attached to a class.


removeTapListener

void removeTapListener(@NonNull MapObjectTapListener tapListener)

Removes the tap listener from the object.


setDragListener

void setDragListener(@Nullable MapObjectDragListener dragListener)

Sets a drag listener for the object.

Each object can only have one drag listener.

The class does not retain the object in the 'dragListener' parameter. It is your responsibility to maintain a strong reference to the target object while it is attached to a class.


isValid

boolean isValid()

Tells if this MapObject is valid or not.

Any other method (except for this one) called on an invalid MapObject will throw java.lang.RuntimeException. An instance becomes invalid only on UI thread, and only when its implementation depends on objects already destroyed by now. Please refer to general docs about the interface for details on its invalidation.