Interface UserLocationLayer

com.yandex.mapkit.user_location

public interface UserLocationLayer

Use the UserLocationLayer interface to manage the location icon: its appearance, following mode, data source and so on.

Methods

CameraPosition cameraPosition()

Calculates the camera position that projects the current location into view.

boolean isAnchorEnabled()

Returns true if anchor mode is set, and false otherwise.

boolean isAutoZoomEnabled()

Enables/disables auto zoom.

boolean isEnabled()

Enables/disables layer functionality.

boolean isHeadingEnabled()

Enables/disables heading mode.

boolean isValid()

Tells if this UserLocationLayer is valid or no.

void resetAnchor()

Resets anchor mode.

void setAnchor(@NonNull PointF anchorNormal, @NonNull PointF anchorCourse)

Sets the anchor to the specified position in pixels and enables Anchor mode.

void setAutoZoomEnabled(boolean autoZoomEnabled)
void setEnabled(boolean enabled)
void setHeadingEnabled(boolean headingEnabled)
void setObjectListener(@Nullable UserLocationObjectListener objectListener)

Sets/resets the object listener.

void setSource(@NonNull LocationViewSource source)

Sets/gets the data source.

void setTapListener(@Nullable UserLocationTapListener tapListener)

Sets/resets the tap listener.

Method Detail

cameraPosition

public CameraPosition cameraPosition ()

Calculates the camera position that projects the current location into view.

If the current location is unknown, returns none. If the current location is known, returns the camera position that displays the location position.

isAnchorEnabled

public boolean isAnchorEnabled ()

Returns true if anchor mode is set, and false otherwise.

isAutoZoomEnabled

public boolean isAutoZoomEnabled ()

Enables/disables auto zoom.

isEnabled

public boolean isEnabled ()

Enables/disables layer functionality.

isHeadingEnabled

public boolean isHeadingEnabled ()

Enables/disables heading mode.

If heading mode is enabled, the map is rotated. If heading mode is disabled, the location icon is rotated.

isValid

public boolean isValid ()

Tells if this UserLocationLayer is valid or no.

Any other method (except for this one) called on an invalid UserLocationLayer 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.

resetAnchor

public void resetAnchor ()

Resets anchor mode.

setAnchor

public void setAnchor (@NonNull PointF anchorNormal, @NonNull PointF anchorCourse)

Sets the anchor to the specified position in pixels and enables Anchor mode.

(0, 0) denotes the top-left corner of the screen.
Parameters:
anchorNormal

The anchor position when the app is not on a steady course; usually, the center of the screen.

anchorCourse

An anchor position near the bottom line for steady course mode.

setAutoZoomEnabled

public void setAutoZoomEnabled (boolean autoZoomEnabled)

setEnabled

public void setEnabled (boolean enabled)

setHeadingEnabled

public void setHeadingEnabled (boolean headingEnabled)

setObjectListener

public void setObjectListener (@Nullable UserLocationObjectListener objectListener)

Sets/resets the object listener.

Remark:
Parameters:
objectListener

has optional type, it may be uninitialized.

setSource

public void setSource (@NonNull LocationViewSource source)

Sets/gets the data source.

setTapListener

public void setTapListener (@Nullable UserLocationTapListener tapListener)

Sets/resets the tap listener.

Remark:
Parameters:
tapListener

has optional type, it may be uninitialized.