Interface MapView.ViewPin

Enclosing class:
MapView

public static interface MapView.ViewPin
A ViewPin is used to display Android views at a fixed location on the map.

The pinned view will automatically be repositioned on the screen as the map moves. There is more performance overhead involved in positioning a pinned view as compared to a map marker, so for use cases which only require static images, markers should be used.

  • Method Details

    • unpin

      void unpin()
      Removes the view from the MapView it was pinned to.
    • getGeoCoordinates

      GeoCoordinates getGeoCoordinates()
      Returns the current GeoCoordinates on the map.
      Returns:
      The current GeoCoordinates.
    • setGeoCoordinates

      void setGeoCoordinates(@NonNull GeoCoordinates geoCoordinates)
      Sets the GeoCoordinates on the map.

      The altitude component of the coordinates, if set, is interpreted as above sea level. When not set, the coordinates are interpreted as at ground level.

      Parameters:
      geoCoordinates - Desired GeoCoordinates for this view pin.
    • setAnchorPoint

      void setAnchorPoint(@NonNull Anchor2D anchorPoint)
      Sets an anchor point for this instance.

      The anchor value has valid range from 0 to 1. Zero (0) for x and y means the view pin's upper left corner is located at the geographical location, whereas one (1) for x and y means that the pin will have its right bottom corner attached to the geographical location instead. The default value used is 0.5, 0.5, causing the view to be centered.

      Parameters:
      anchorPoint - A Anchor2D relative to the top-left corner of the ViewPin.
    • getAnchorPoint

      Anchor2D getAnchorPoint()
      Gets anchor point for this instance.
      Returns:
      anchorPoint A Anchor2D relative to the top-left corner of the ViewPin.