java.lang.Object | |
↳ | com.google.android.gms.maps.model.GroundOverlay |
A ground overlay is an image that is fixed to a map. A ground overlay has the following properties:
LatLng
to which
the anchor will be fixed and the width of the overlay (in meters). The anchor is by default 50%
from the top of the image and 50% from the left of the image. This can be changed. You can
optionally provide the height of the overlay (in meters). If you do not provide the height of the
overlay, it will be automatically calculated to preserve the proportions of the image.LatLngBounds
which will contain the image.IllegalArgumentException
will be thrown when the ground overlay is added to the map.
Furthermore, you must only specify the position using one of these methods in the
GroundOverlayOptions
object; otherwise an IllegalStateException
will be thrown
when specifying using a second method.BitmapDescriptor
) to be used for this overlay. The image will be
scaled to fit the position provided. You cannot change the image used in the ground overlay once
it has been added to the map. You must specify an image before adding the ground overlay to the
map; if not an IllegalArgumentException
will be thrown when it is added to the map.Polyline
s and TileOverlay
s, but not Marker
s). An overlay with a larger
zIndex is drawn over overlays with smaller zIndexes. The order of overlays with the same zIndex
value is arbitrary. This is optional and the default zIndex is 0.[0..1]
where 0
means the
overlay is opaque and 1
means the overlay is fully transparent. If the specified bitmap
is already partially transparent, the transparency of each pixel will be scaled accordingly (e.g.
if a pixel in the bitmap has an alpha value of 200 and you specify the transparency of the ground
overlay as 0.25, then the pixel will be rendered on the screen with an alpha value of 150). This
is optional and the default transparency is 0 (opaque).true
, i.e., visible.IllegalStateException
will be thrown at runtime.
GoogleMap map = ...; // get a map.
BitmapDescriptor image = ...; // get an image.
LatLngBounds bounds = ...; // get a bounds
// Adds a ground overlay with 50% transparency.
GroundOverlay groundOverlay = map.addGroundOverlay(new GroundOverlayOptions()
.image(image)
.positionFromBounds(bounds)
.transparency(0.5));
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Gets the bearing of the ground overlay in degrees clockwise from north.
| |||||||||||
Gets the bounds for the ground overlay.
| |||||||||||
Gets the height of the ground overlay.
| |||||||||||
Gets this ground overlay's id.
| |||||||||||
Gets the location of the anchored point.
| |||||||||||
Gets the transparency of this ground overlay.
| |||||||||||
Gets the width of the ground overlay.
| |||||||||||
Gets the zIndex of this ground overlay.
| |||||||||||
Gets the visibility of this ground overlay.
| |||||||||||
Removes this ground overlay from the map.
| |||||||||||
Sets the bearing of the ground overlay (the direction that the vertical axis of the ground
overlay points) in degrees clockwise from north.
| |||||||||||
Sets the dimensions of the ground overlay.
| |||||||||||
Sets the dimensions of the ground overlay.
| |||||||||||
Sets the image for the Ground Overlay.
| |||||||||||
Sets the position of the ground overlay by changing the location of the anchored point.
| |||||||||||
Sets the position of the ground overlay by fitting it to the given
LatLngBounds . | |||||||||||
Sets the transparency of this ground overlay.
| |||||||||||
Sets the visibility of this ground overlay.
| |||||||||||
Sets the zIndex of this ground overlay.
|
[Expand]
Inherited Methods | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Gets the bearing of the ground overlay in degrees clockwise from north.
Gets the bounds for the ground overlay. This ignores the rotation of the ground overlay.
LatLngBounds
that contains the ground overlay, ignoring rotation.
Gets the height of the ground overlay.
Gets this ground overlay's id. The id will be unique amongst all GroundOverlays on a map.
Gets the location of the anchored point.
LatLng
).
Gets the transparency of this ground overlay.
Gets the width of the ground overlay.
Gets the zIndex of this ground overlay.
Gets the visibility of this ground overlay. Note that this does not return whether the ground overlay is actually on screen, but whether it will be drawn if it is contained in the camera's viewport.
Removes this ground overlay from the map. After a ground overlay has been removed, the behavior of all its methods is undefined.
Sets the bearing of the ground overlay (the direction that the vertical axis of the ground overlay points) in degrees clockwise from north. The rotation is performed about the anchor point.
bearing | bearing in degrees clockwise from north |
---|
Sets the dimensions of the ground overlay. The height of the ground overlay will be calculated to preserve the proportions inherited from the bitmap.
width | width in meters |
---|
Sets the dimensions of the ground overlay. The image will be stretched (and hence may not retain its proportions) to fit these dimensions.
width | width in meters |
---|---|
height | height in meters |
Sets the image for the Ground Overlay. The new image will occupy the same bounds as the old image.
Sets the position of the ground overlay by changing the location of the anchored point. Preserves all other properties of the image.
latLng | a LatLng that is the new location to place the anchor point.
|
---|
Sets the position of the ground overlay by fitting it to the given LatLngBounds
. This
method will ignore the rotation (bearing) of the ground overlay when positioning it, but the
bearing will still be used when drawing it.
bounds | a LatLngBounds in which to place the ground overlay
|
---|
Sets the transparency of this ground overlay. See the documentation at the top of this class for more information.
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
|
---|
Sets the visibility of this ground overlay. When not visible, a ground overlay is not drawn, but it keeps all of its other properties.
visible | if true , then the ground overlay is visible; if false , it is
not
|
---|
Sets the zIndex of this ground overlay. See the documentation at the top of this class for more information.
zIndex | the zIndex of this ground overlay |
---|