You are on page 1of 18

CameraPosition.

Builder
public static final class CameraPosition.Builder extends Object

Builds camera position.

Public Constructor Summary

CameraPosition.Builder()
Creates an empty builder.
CameraPosition.Builder(CameraPosition previous)

Public Method Summary


CameraPosition. bearing(float bearing)
Builder Sets the direction that the camera is pointing in, in degrees clockwise
from north.
CameraPosition build()
Builds a CameraPosition.
CameraPosition. target(LatLng location)
Builder Sets the location that the camera is pointing at.
CameraPosition. tilt(float tilt)
Builder Sets the angle, in degrees, of the camera from the nadir (directly facing
the Earth).
CameraPosition. zoom(float zoom)
Builder Sets the zoom level of the camera.

CameraPosition
public final class CameraPosition extends AbstractSafeParcelable
implements ParcelableAn immutable class that aggregates all camera position
parameters such as location, zoom level, tilt angle, and bearing.
Use CameraPosition.Builder to construct a CameraPosition instance, which you
can then use in conjunction with CameraUpdateFactory

Nested Class Summary


class CameraPosition.Builder Builds camera position. 

Field Summary
public final float bearing Direction that the camera is pointing in, in degrees clockwise from
north.
public final LatLng target The location that the camera is pointing at.
public final float tilt The angle, in degrees, of the camera angle from the nadir (directly
facing the Earth).
public final float zoom Zoom level near the center of the screen.

Public Constructor Summary

CameraPosition(LatLng target, float zoom, float tilt, float bearing)


Constructs a CameraPosition.

Public Method Summary

static CameraPosition.Builder builder(CameraPosition camera)
Creates a builder for a camera position, initialized to a given
position.
static CameraPosition.Builder builder()
Creates a builder for a camera position.
static CameraPosition createFromAttributes(Context context, AttributeSet attrs)
Creates a CameraPosition from the AttributeSet.
boolean equals(Object o)
final static CameraPosition fromLatLngZoom(LatLng target, float zoom)
Constructs a CameraPosition pointed for a particular target and
zoom level.
int hashCode()
String toString()
void writeToParcel(Parcel out, int flags)

Circle
public final class Circle extends Object

A circle on the earth's surface (spherical cap).


A circle has the following properties.

Center

The center of the Circle is specified as a LatLng.

Radius

The radius of the circle, specified in meters. It should be zero or greater.

Stroke Width

The width of the circle's outline in screen pixels. The width is constant and
independent of the camera's zoom level. The default value is 10.

Stroke Color

The color of the circle outline in ARGB format, the same format used by Color.
The default value is black (0xff000000).

Stroke pattern

Solid (default, represented by null) or a sequence of PatternItem objects to be


repeated along the circle's outline. Available PatternItem types: Gap (defined by
gap length in pixels), Dash (defined by stroke width and dash length in pixels)
and Dot (circular, centered on the circle's outline, diameter defined by stroke
width in pixels).

Fill Color

The color of the circle fill in ARGB format, the same format used by Color. The
default value is transparent (0x00000000).

Z-Index

The order in which this tile overlay is drawn with respect to other overlays
(including GroundOverlays,TileOverlays, Polylines, and Polygons but
not Markers). An overlay with a larger z-index is drawn over overlays with
smaller z-indices. The order of overlays with the same z-index is arbitrary. The
default zIndex is 0.

Visibility
Indicates if the circle is visible or invisible, i.e., whether it is drawn on the map. An
invisible circle is not drawn, but retains all of its other properties. The default
is true, i.e., visible.

Tag

An Object associated with the circle. For example, the Object can contain data


about what the circle represents. This is easier than storing a
separate Map<Circle, Object>. As another example, you can associate
a String ID corresponding to the ID from a data set. Google Maps Android API
neither reads nor writes this property.

Methods in this class must be called on the Android UI thread. If not,


an IllegalStateException will be thrown at runtime.

Public Method Summary

LatLng getCenter()
Returns the center as a LatLng.
int getFillColor()
Returns the fill color of this Circle.
String getId()
Gets this circle's id.
double getRadius()
Returns the circle's radius, in meters.
int getStrokeColor()
Returns the stroke color.
List<PatternItem> getStrokePattern()
Returns the stroke pattern of this circle's outline.
float getStrokeWidth()
Returns the stroke width.
Object getTag()
Gets the tag for the circle.
float getZIndex()
Returns the zIndex.
boolean isClickable()
Gets the clickability of the circle.
boolean isVisible()
Checks whether the circle is visible.
void remove()
Removes this circle from the map.
void setCenter(LatLng center)
Sets the center using a LatLng.
void setClickable(boolean clickable)
Sets the clickability of the circle.
void setFillColor(int color)
Sets the fill color.
void setRadius(double radius)
Sets the radius in meters.
void setStrokeColor(int color)
Sets the stroke color.
void setStrokePattern(List<PatternItem> pattern)
Sets the stroke pattern of the circle's outline.
void setStrokeWidth(float width)
Sets the stroke width.
void setTag(Object tag)
Sets the tag for the circle.
void setVisible(boolean visible)
Sets the visibility of the circle.
void setZIndex(float zIndex)
Sets the zIndex.

CircleOptions
public final class CircleOptions extends AbstractSafeParcelable

Defines options for a Circle.

Public Method Summary

CircleOptions center(LatLng center)
Sets the center using a LatLng.
CircleOptions clickable(boolean clickable)
Specifies whether this circle is clickable.
CircleOptions fillColor(int color)
Sets the fill color.
LatLng getCenter()
Returns the center as a LatLng.
int getFillColor()
Returns the fill color.
double getRadius()
Returns the circle's radius, in meters.
int getStrokeColor()
Returns the stroke color.
List<PatternItem> getStrokePattern()
Returns the stroke pattern set in this CircleOptions object for the circle's
outline.
float getStrokeWidth()
Returns the stroke width.
float getZIndex()
Returns the zIndex.
boolean isClickable()
Gets the clickability setting for the circle.
boolean isVisible()
Checks whether the circle is visible.
CircleOptions radius(double radius)
Sets the radius in meters.
CircleOptions strokeColor(int color)
Sets the stroke color.
CircleOptions strokePattern(List<PatternItem> pattern)
Sets a stroke pattern for the circle's outline.
CircleOptions strokeWidth(float width)
Sets the stroke width.
CircleOptions visible(boolean visible)
Sets the visibility.
CircleOptions zIndex(float zIndex)
Sets the zIndex.

GroundOverlay
public final class GroundOverlay extends Object

A ground overlay is an image that is fixed to a map. A ground overlay has the following
properties:

Position

There are two ways to specify the position of the ground overlay:

 Using a location: You must provide an image of the ground overlay, a 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.
 Using a Bounds: You must provide a LatLngBounds which will contain the image.
You must specify the position of the ground overlay before it is added to the map,
otherwise an 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.

Image

The image (as an BitmapDescriptor) to be used for this overlay. The image will be
scaled to fit the position provided. 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.

Bearing

The amount that the image should be rotated in a clockwise direction. The center of the
rotation will be the image's anchor. This is optional and the default bearing is 0, i.e., the
image is aligned so that up is north.

zIndex

The order in which this ground overlay is drawn with respect to other overlays
(including Polylines and TileOverlays, but not Markers). 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.

Transparency

Transparency of the ground overlay in the range [0..1] where 0 means the overlay is


opaque and 1means the overlay is fully transparent. If the specified bitmap is already
partially transparent, the transparency of each pixel will be scaled accordingly (for
example, 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). Specification of this property is optional and the default
transparency is 0 (opaque).

Visibility

Indicates if the ground overlay is visible or invisible, i.e. whether it is drawn on the map.
An invisible ground overlay is not drawn, but retains all of its other properties. This is
optional and the default visibility is true, i.e., visible.

Clickability
If you want to handle events fired when the user clicks the ground overlay, set this
property to true. You can change this value at any time. The default is false. If this
property is set to true, your app will receive notifications to
the GoogleMap.OnGroundOverlayClickListener registered
through setOnGroundOverlayClickListener(GoogleMap.OnGroundOverlayCl
ickListener).

Tag

An Object associated with the ground overlay. For example, the Object can contain


data about what the ground overlay represents. This is easier than storing a
separate Map<GroundOverlay, Object>. As another example, you can associate
a String ID corresponding to the ID from a data set. Google Maps Android API neither
reads nor writes this property.

Methods in this class must be called on the Android UI thread. If not,


an IllegalStateException will be thrown at runtime.

Public Method Summary

boolean equals(Object other)
Tests if this GroundOverlay is equal to another.
float getBearing()
Gets the bearing of the ground overlay in degrees clockwise from north.
LatLngBounds getBounds()
Gets the bounds for the ground overlay.
float getHeight()
Gets the height of the ground overlay.
String getId()
Gets this ground overlay's id.
LatLng getPosition()
Gets the location of the anchor point.
Object getTag()
Gets the tag for the circle.
float getTransparency()
Gets the transparency of this ground overlay.
float getWidth()
Gets the width of the ground overlay.
float getZIndex()
Gets the zIndex of this ground overlay.
int hashCode()
boolean isClickable()
Gets the clickability of the ground overlay.
boolean isVisible()
Gets the visibility of this ground overlay.
void remove()
Removes this ground overlay from the map.
void setBearing(float bearing)
Sets the bearing of the ground overlay (the direction that the vertical axis of the
ground overlay points) in degrees clockwise from north.
void setClickable(boolean clickable)
Sets the clickability of the ground overlay.
void setDimensions(float width, float height)
Sets the dimensions of the ground overlay.
void setDimensions(float width)
Sets the width of the ground overlay.
void setImage(BitmapDescriptor imageDescriptor)
Sets the image for the Ground Overlay.
void setPosition(LatLng latLng)
Sets the position of the ground overlay by changing the location of the anchor
point.
void setPositionFromBounds(LatLngBounds bounds)
Sets the position of the ground overlay by fitting it to the given LatLngBounds.
void setTag(Object tag)
Sets the tag for the ground overlay.
void setTransparency(float transparency)
Sets the transparency of this ground overlay.
void setVisible(boolean visible)
Sets the visibility of this ground overlay.
void setZIndex(float zIndex)
Sets the zIndex of this ground overlay.

GroundOverlayOptions
public final class GroundOverlayOptions extends AbstractSafeParcelable

Defines options for a ground overlay.

Constant Summary

float NO_DIMENSION Flag for when no dimension is specified for the height.
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.

IndoorBuilding
public final class IndoorBuilding extends Object

Represents a building.

Two IndoorBuildings are .equal() if the physical building they represent is the same.
However, if a building's structural model changes, e.g., due to an update to Google's
building models, then an old IndoorBuilding object and a new IndoorBuilding object will
be .equal(), but might have different contents.

Public Method Summary

boolean equals(Object other)
Tests if this IndoorBuilding is equal to another.
int getActiveLevelIndex()
Gets the index in the list returned by getLevels() of the level that is
currently active in this building (default if no active level was previously set).
int getDefaultLevelIndex()
Gets the index in the list returned by getLevels() of the default level for
this building.
List<IndoorLevel> getLevels()
Gets the levels in the building.
int hashCode()
boolean isUnderground()
Returns true if the building is entirely underground.

IndoorLevel
public final class IndoorLevel extends Object

Represents a level in a building.

IndoorLevel objects are only equal by id. It is possible that may have different contents.

While a level is usually enclosed by a single building, a level might be enclosed by


several buildings (e.g., a carpark level might span multiple buildings).

Public Method Summary

void activate()
Sets this level as the visible level in its building.
boolean equals(Object other)
Tests if this IndoorLevel is equal to another.
String getName()
Localized display name for the level, e.g.
String getShortName()
Localized short display name for the level, e.g.
int hashCode()

LatLngBounds
public final class LatLngBounds extends AbstractSafeParcelable
implements Parcelable

An immutable class representing a latitude/longitude aligned rectangle.

Nested Class Summary

class LatLngBounds.Builder This is a builder that is able to create a minimum bound based on
a set of LatLng points. 
Field Summary

public final LatLng northeast Northeast corner of the bound.


public final LatLng southwest Southwest corner of the bound.

Public Constructor Summary

LatLngBounds(LatLng southwest, LatLng northeast)
Creates a new bounds based on a southwest and a northeast corner.

Public Method Summary

static LatLngBounds.Builder builder()
Creates a new builder.
boolean contains(LatLng point)
Returns whether this contains the given LatLng.
static LatLngBounds createFromAttributes(Context context, AttributeSet attrs)
Creates a LatLngBounds from the AttributeSet.
boolean equals(Object o)
LatLng getCenter()
Returns the center of this LatLngBounds.
int hashCode()
LatLngBounds including(LatLng point)
Returns a new LatLngBounds that extends this LatLngBounds to
include the given LatLng.
String toString()
void writeToParcel(Parcel out, int flags)

Marker
public final class Marker extends Object

An icon placed at a particular point on the map's surface. A marker icon is drawn
oriented against the device's screen rather than the map's surface; i.e., it will not
necessarily change orientation due to map rotations, tilting, or zooming.

A marker has the following properties:

Alpha
Sets the opacity of the marker. Defaults to 1.0.

Anchor

The point on the image that will be placed at the LatLng position of the marker.
This defaults to 50% from the left of the image and at the bottom of the image.

Position

The LatLng value for the marker's position on the map. You can change this
value at any time if you want to move the marker.

Title

A text string that's displayed in an info window when the user taps the marker.
You can change this value at any time.

Snippet

Additional text that's displayed below the title. You can change this value at any
time.

Icon

A bitmap that's displayed for the marker. If the icon is left unset, a default icon is
displayed. You can specify an alternative coloring of the default icon
using defaultMarker(float).

Drag Status

If you want to allow the user to drag the marker, set this property to true. You
can change this value at any time. The default is false.

Visibility

By default, the marker is visible. To make the marker invisible, set this property
to false. You can change this value at any time.

Flat or Billboard

If the marker is flat against the map, it will remain stuck to the map as the camera
rotates and tilts but will still remain the same size as the camera zooms, unlike
a GroundOverlay. If the marker is a billboard, it will always be drawn facing the
camera and will rotate and tilt with the camera. The default is a billboard ( false)

Rotation
The rotation of the marker in degrees clockwise about the marker's anchor point.
The axis of rotation is perpendicular to the marker. A rotation of 0 corresponds to
the default position of the marker. When the marker is flat on the map, the default
position is North aligned and the rotation is such that the marker always remains
flat on the map. When the marker is a billboard, the default position is pointing up
and the rotation is such that the marker is always facing the camera. The default
value is 0.

zIndex

The draw order for the marker. The markers are drawn in order of the zIndex,
with the highest zIndex marker drawn on top. By setting the zIndex property for
each marker, you can control which tap target your user is most likely to hit. The
default value is 0.

Tag

An Object associated with the marker. For example, the Object can contain


data about what the marker represents. This is easier than storing a
separate Map<Marker, Object>. As another example, you can associate
a String ID corresponding to the ID from a data set. Google Maps Android API
neither reads nor writes this property.

Methods in this class must be called on the Android UI thread. If not,


an IllegalStateException will be thrown at runtime.

Public Method Summary

boolean equals(Object other)
Tests if this Marker is equal to another.
float getAlpha()
Gets the alpha of the marker.
String getId()
Gets this marker's id.
LatLng getPosition()
Returns the position of the marker.
float getRotation()
Gets the rotation of the marker.
String getSnippet()
Gets the snippet of the marker.
Object getTag()
Gets the tag for the marker.
String getTitle()
Gets the title of the marker.
float getZIndex()
Returns the zIndex of the marker.
int hashCode()
void hideInfoWindow()
Hides the info window if it is shown from this marker.
boolean isDraggable()
Gets the draggability of the marker.
boolean isFlat()
Gets the flat setting of the Marker.
boolean isInfoWindowShown()
Returns whether the info window is currently shown above this marker.
boolean isVisible()
Gets the visibility setting of this marker.
void remove()
Removes this marker from the map.
void setAlpha(float alpha)
Sets the alpha (opacity) of the marker.
void setAnchor(float anchorU, float anchorV)
Sets the anchor point for the marker.
void setDraggable(boolean draggable)
Sets the draggability of the marker.
void setFlat(boolean flat)
Sets whether this marker should be flat against the map true or a billboard facing the
camera false.
void setIcon(BitmapDescriptor iconDescriptor)
Sets the icon for the marker.
void setInfoWindowAnchor(float anchorU, float anchorV)
Specifies the point in the marker image at which to anchor the info window when it is
displayed.
void setPosition(LatLng latlng)
Sets the location of the marker.
void setRotation(float rotation)
Sets the rotation of the marker in degrees clockwise about the marker's anchor point.
void setSnippet(String snippet)
Sets the snippet of the marker.
void setTag(Object tag)
Sets the tag for the marker.
void setTitle(String title)
Sets the title of the marker.
void setVisible(boolean visible)
Sets the visibility of this marker.
void setZIndex(float zIndex)
Sets the zIndex of the marker.
void showInfoWindow()
Shows the info window of this marker on the map, if this marker isVisible().

MarkerOptions
public final class MarkerOptions extends AbstractSafeParcelable

Defines MarkerOptions for a marker.

Public Method Summary

MarkerOptions alpha(float alpha)


Sets the alpha (opacity) of the marker.
MarkerOptions anchor(float u, float v)
Specifies the anchor to be at a particular point in the marker image.
MarkerOptions draggable(boolean draggable)
Sets the draggability for the marker.
MarkerOptions flat(boolean flat)
Sets whether this marker should be flat against the map true or a billboard
facing the camera false.
float getAlpha()
Gets the alpha set for this MarkerOptions object.
float getAnchorU()
Horizontal distance, normalized to [0, 1], of the anchor from the left edge.
float getAnchorV()
Vertical distance, normalized to [0, 1], of the anchor from the top edge.
BitmapDescriptor getIcon()
Gets the custom icon descriptor set for this MarkerOptions object.
float getInfoWindowAnchorU()
Horizontal distance, normalized to [0, 1], of the info window anchor from the
left edge.
float getInfoWindowAnchorV()
Vertical distance, normalized to [0, 1], of the info window anchor from the top
edge.
LatLng getPosition()
Returns the position set for this MarkerOptions object.
float getRotation()
Gets the rotation set for this MarkerOptions object.
String getSnippet()
Gets the snippet set for this MarkerOptions object.
String getTitle()
Gets the title set for this MarkerOptions object.
float getZIndex()
Gets the zIndex set for this MarkerOptions object.
MarkerOptions icon(BitmapDescriptor iconDescriptor)
Sets the icon for the marker.
MarkerOptions infoWindowAnchor(float u, float v)
Specifies the anchor point of the info window on the marker image.
boolean isDraggable()
Gets the draggability setting for this MarkerOptions object.
boolean isFlat()
Gets the flat setting for this MarkerOptions object.
boolean isVisible()
Gets the visibility setting for this MarkerOptions object.
MarkerOptions position(LatLng latlng)
Sets the location for the marker.
MarkerOptions rotation(float rotation)
Sets the rotation of the marker in degrees clockwise about the marker's anchor
point.
MarkerOptions snippet(String snippet)
Sets the snippet for the marker.
MarkerOptions title(String title)
Sets the title for the marker.
MarkerOptions visible(boolean visible)
Sets the visibility for the marker.
void writeToParcel(Parcel out, int flags)
MarkerOptions zIndex(float zIndex)
Sets the zIndex for the marker.

You might also like