GroundOverlayOptions

public final class GroundOverlayOptions extends Object
implements Parcelable

Defines options for a ground overlay.

Constant Summary

float NO_DIMENSION Flag for when no dimension is specified for the height.

Inherited Constant Summary

Public Constructor Summary

GroundOverlayOptions()
Creates a new set of ground overlay options.

Public Method Summary

GroundOverlayOptions
anchor(float u, float v)
Specifies the anchor.
GroundOverlayOptions
bearing(float bearing)
Specifies the bearing of the ground overlay in degrees clockwise from north.
GroundOverlayOptions
clickable(boolean clickable)
Specifies whether the ground overlay is clickable.
float
getAnchorU()
Horizontal relative anchor; 0.0 and 1.0 denote left and right edges respectively.
float
getAnchorV()
Vertical relative anchor; 0.0 and 1.0 denote top and bottom edges respectively.
float
getBearing()
Gets the bearing set for this GroundOverlayOptions object.
LatLngBounds
getBounds()
Gets the bounds set for this GroundOverlayOptions object.
float
getHeight()
Gets the height set for this GroundOverlayOptions object.
BitmapDescriptor
getImage()
Gets the image descriptor set for this GroundOverlayOptions object.
LatLng
getLocation()
Gets the location set for this GroundOverlayOptions object.
float
getTransparency()
Gets the transparency set for this GroundOverlayOptions object.
float
getWidth()
Gets the width set for this GroundOverlayOptions object.
float
getZIndex()
Gets the zIndex set for this GroundOverlayOptions object.
GroundOverlayOptions
image(BitmapDescriptor imageDescriptor)
Specifies the image for this ground overlay.
boolean
isClickable()
Gets the clickability setting for this GroundOverlayOptions object.
boolean
isVisible()
Gets the visibility setting for this GroundOverlayOptions object.
GroundOverlayOptions
position(LatLng location, float width)
Specifies the position for this ground overlay using an anchor point (a LatLng) and the width (in meters).
GroundOverlayOptions
position(LatLng location, float width, float height)
Specifies the position for this ground overlay using an anchor point (a LatLng), width and height (both in meters).
GroundOverlayOptions
positionFromBounds(LatLngBounds bounds)
Specifies the position for this ground overlay.
GroundOverlayOptions
transparency(float transparency)
Specifies the transparency of the ground overlay.
GroundOverlayOptions
visible(boolean visible)
Specifies the visibility for the ground overlay.
void
writeToParcel(Parcel out, int flags)
GroundOverlayOptions
zIndex(float zIndex)
Specifies the ground overlay's zIndex, i.e., the order in which it will be drawn.

Inherited Method Summary

Constants

public static final float NO_DIMENSION

Flag for when no dimension is specified for the height.

Constant Value: -1.0

Public Constructors

public GroundOverlayOptions ()

Creates a new set of ground overlay options.

Public Methods

public GroundOverlayOptions anchor (float u, float v)

Specifies the anchor.

The anchor aligns with the ground overlay's location.

The anchor point is specified in 2D continuous space where (0,0), (1,0), (0,1) and (1,1) denote the top-left, top-right, bottom-left and bottom-right corners respectively.

 *-----+-----+-----+-----*
 |     |     |     |     |
 |     |     |     |     |
 +-----+-----+-----+-----+
 |     |     |   X |     |   (U, V) = (0.7, 0.6)
 |     |     |     |     |
 *-----+-----+-----+-----*
 
Parameters
u u-coordinate of the anchor
v v-coordinate of the anchor
Returns

public GroundOverlayOptions bearing (float bearing)

Specifies the bearing of the ground overlay in degrees clockwise from north. The rotation is performed about the anchor point. If not specified, the default is 0 (i.e., up on the image points north).

Note that latitude-longitude bound applies before the rotation.

Parameters
bearing the bearing in degrees clockwise from north. Values outside the range [0, 360) will be normalized.
Returns

public GroundOverlayOptions clickable (boolean clickable)

Specifies whether the ground overlay is clickable. The default clickability is false.

Parameters
clickable The new clickability setting.
Returns

public float getAnchorU ()

Horizontal relative anchor; 0.0 and 1.0 denote left and right edges respectively. Other anchor values are interpolated accordingly.

Returns
  • the horizontal edge-relative anchor location.

public float getAnchorV ()

Vertical relative anchor; 0.0 and 1.0 denote top and bottom edges respectively. Other anchor values are interpolated accordingly.

Returns
  • the vertical edge-relative anchor location.

public float getBearing ()

Gets the bearing set for this GroundOverlayOptions object.

Returns
  • the bearing of the ground overlay.

public LatLngBounds getBounds ()

Gets the bounds set for this GroundOverlayOptions object.

Returns

public float getHeight ()

Gets the height set for this GroundOverlayOptions object.

Returns
  • the height of the ground overlay.

public BitmapDescriptor getImage ()

Gets the image descriptor set for this GroundOverlayOptions object.

Returns

public LatLng getLocation ()

Gets the location set for this GroundOverlayOptions object.

Returns

public float getTransparency ()

Gets the transparency set for this GroundOverlayOptions object.

Returns
  • the transparency of the ground overlay.

public float getWidth ()

Gets the width set for this GroundOverlayOptions object.

Returns
  • the width of the ground overlay.

public float getZIndex ()

Gets the zIndex set for this GroundOverlayOptions object.

Returns
  • the zIndex of the ground overlay.

public GroundOverlayOptions image (BitmapDescriptor imageDescriptor)

Specifies the image for this ground overlay.

To load an image as a texture (which is used to draw the image on a map), it must be converted into an image with sides that are powers of two. This is so that a mipmap can be created in order to render the texture at various zoom levels - see Mipmap (Wikipedia) for details. Hence, to conserve memory by avoiding this conversion, it is advised that the dimensions of the image are powers of two.

Parameters
imageDescriptor the BitmapDescriptor to use for this ground overlay
Returns

public boolean isClickable ()

Gets the clickability setting for this GroundOverlayOptions object.

Returns
  • true if the ground overlay is clickable; false if it is not.

public boolean isVisible ()

Gets the visibility setting for this GroundOverlayOptions object.

Returns
  • true if this ground overlay is visible; false if it is not.

public GroundOverlayOptions position (LatLng location, float width)

Specifies the position for this ground overlay using an anchor point (a LatLng) and the width (in meters). The height will be adapted accordingly to preserve aspect ratio.

Parameters
location the location on the map LatLng to which the anchor point in the given image will remain fixed. The anchor will remain fixed to the position on the ground when transformations are applied (e.g., setDimensions, setBearing, etc.).
width the width of the overlay (in meters). The height will be determined automatically based on the image aspect ratio.
Returns
Throws
IllegalArgumentException if anchor is null
IllegalArgumentException if width is negative
IllegalStateException if the position was already set using positionFromBounds(LatLngBounds)

public GroundOverlayOptions position (LatLng location, float width, float height)

Specifies the position for this ground overlay using an anchor point (a LatLng), width and height (both in meters). When rendered, the image will be scaled to fit the dimensions specified.

Parameters
location the location on the map LatLng to which the anchor point in the given image will remain fixed. The anchor will remain fixed to the position on the ground when transformations are applied (e.g., setDimensions, setBearing, etc.).
width the width of the overlay (in meters)
height the height of the overlay (in meters)
Returns
Throws
IllegalArgumentException if anchor is null
IllegalArgumentException if width or height are negative
IllegalStateException if the position was already set using positionFromBounds(LatLngBounds)

public GroundOverlayOptions positionFromBounds (LatLngBounds bounds)

Specifies the position for this ground overlay.

Parameters
bounds a LatLngBounds in which to place the ground overlay
Returns

public GroundOverlayOptions transparency (float transparency)

Specifies the transparency of the ground overlay. The default transparency is 0 (opaque).

Parameters
transparency a float in the range [0..1] where 0 means that the ground overlay is opaque and 1 means that the ground overlay is transparent.
Returns
Throws
IllegalArgumentException if the transparency is outside the range [0..1].

public GroundOverlayOptions visible (boolean visible)

Specifies the visibility for the ground overlay. The default visibility is true.

Returns

public void writeToParcel (Parcel out, int flags)

public GroundOverlayOptions zIndex (float zIndex)

Specifies the ground overlay's zIndex, i.e., the order in which it will be drawn. See the documentation at the top of this class for more information about zIndex.

Returns