public final class CameraPosition
- Object
- CameraPosition
An immutable description of the map camera: where it looks (getTarget),
how far it is zoomed in (getZoom), the compass bearing in degrees
(getBearing) and the tilt away from nadir (getTilt).
Zoom uses the standard slippy-map scale where each whole increment
doubles the scale (zoom 0 shows the whole world in a single 256px tile).
Fractional zoom is supported by the vector engine; native providers may
round it. Bearing and tilt are honored by native providers that support
them and ignored by the pure-vector MapView.
Constructors
public CameraPosition(LatLng target, double zoom) | Creates a camera position that looks straight down (no bearing/tilt). |
public CameraPosition(LatLng target, double zoom, double bearing, double tilt) | Creates a fully specified camera position. |
Methods
public LatLng getTarget() | The geographic point at the center of the viewport. |
public double getZoom() | The slippy-map zoom level. |
public double getBearing() | The compass bearing in degrees (0 = north up). |
public double getTilt() | The viewing tilt in degrees (0 = straight down). |
public CameraPosition withTarget(LatLng newTarget) | Returns a copy of this position with a different target. |
public CameraPosition withZoom(double newZoom) | Returns a copy of this position with a different zoom level. |
public String toString() | Returns a string representation of the object. |
Inherited methods
Constructor details
CameraPosition
public CameraPosition(LatLng target, double zoom)Creates a camera position that looks straight down (no bearing/tilt).
CameraPosition
public CameraPosition(LatLng target, double zoom, double bearing, double tilt)Creates a fully specified camera position.
Parameters
targetLatLng- the geographic point at the center of the viewport
zoomdouble- the slippy-map zoom level
bearingdouble- the compass bearing in degrees (0 = north up)
tiltdouble- the viewing angle away from straight-down, in degrees
Method details
getTarget
public LatLng getTarget()The geographic point at the center of the viewport.
getZoom
public double getZoom()The slippy-map zoom level.
getBearing
public double getBearing()The compass bearing in degrees (0 = north up).
getTilt
public double getTilt()The viewing tilt in degrees (0 = straight down).
withTarget
public CameraPosition withTarget(LatLng newTarget)Returns a copy of this position with a different target.
withZoom
public CameraPosition withZoom(double newZoom)Returns a copy of this position with a different zoom level.
toString
public String toString()Returns a string representation of the object. In general, the toString method returns a string that “textually represents” this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.
The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@’, and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:
getClass().getName() + ‘@’ + Integer.toHexString(hashCode())