public final class

Camera

extends Object
java.lang.Object
   ↳ com.esri.arcgisruntime.mapping.view.Camera

Class Overview

Represents an immutable camera object. A Camera has a location, heading and pitch.

  • Location - the 3D point in space where the Camera is located. The Camera cannot be located at heights below the BaseSurface.
  • Heading - a value from 0 to 360. Represents the angle clockwise from north in a ENU (East, North, Up Ground reference frames). Negative headings are allowed and heading can wrap around (i.e 361 wraps to a value of 1).
  • Pitch - a value from 0 to 180. Represents the angle applied to the camera when rotating around its Y axis in a ENU. 0 is looking straight down towards the center of the earth, 180 looking straight up (sky). Negative pitches are not allowed and values do not wrap around.
A Camera can be created based on location, heading and pitch values. For example:
 Camera camera = new Camera(new Point(0, 0, 2000000, SpatialReferences.getWgs84()), 90, 45, 0);
 

A Camera can be created from an existing Camera by using methods such as elevate(double), moveToward(Point, double) and rotateAround(Point, double, double, double). A Camera has no direct 2D concepts like scale and rotation. However, scale is approximated and is accurate when looking straight down at the ArcGISScene.

Summary

Public Constructors
Camera(double latitude, double longitude, double altitude, double heading, double pitch, double roll)
Creates a camera with the given arguments.
Camera(Point location, double heading, double pitch, double roll)
Creates a camera with the given arguments.
Camera(Point lookAtPoint, double distance, double heading, double pitch, double roll)
Creates a camera based on a point to look at.
Public Methods
Camera elevate(double deltaAltitude)
Creates a copy of the camera with the altitude adjusted.
double getHeading()
Gets the camera's heading.
Point getLocation()
Gets the camera's location.
double getPitch()
Gets the camera's pitch.
double getRoll()
Gets the camera's roll.
Camera moveForward(double distance)
Creates a copy of the camera with the location moved by a given distance in the direction the camera is facing.
Camera moveTo(Point location)
Creates a copy of the camera with the location changed.
Camera moveToward(Point targetPoint, double distance)
Creates a copy of the camera with the location moved in the direction of a target point by a given distance.
Camera rotateAround(Point targetPoint, double deltaHeading, double deltaPitch, double deltaRoll)
Creates a copy of the camera rotated around the given target point by the given delta angles in degrees.
Camera rotateTo(double heading, double pitch, double roll)
Creates a copy of the camera with the heading, pitch and roll changed to the absolute given angles in degrees.
Camera zoomToward(Point targetPoint, double factor)
Creates a copy of the camera with the location moved in the direction of a target point by a given zoom factor.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Camera (double latitude, double longitude, double altitude, double heading, double pitch, double roll)

Creates a camera with the given arguments.

Parameters
latitude the latitude; may be negative
longitude the longitude; may be negative
altitude the height in meters; may be negative
heading the heading in degrees; may be negative
pitch the pitch in degrees; may not be negative
roll the roll in degrees

public Camera (Point location, double heading, double pitch, double roll)

Creates a camera with the given arguments.

Parameters
location the position
heading the heading in degrees; may be negative
pitch the pitch in degrees; may not be negative
roll the roll in degrees
Throws
IllegalArgumentException if location is null

public Camera (Point lookAtPoint, double distance, double heading, double pitch, double roll)

Creates a camera based on a point to look at. Note: the given values may mean that the point is not visible on screen; you can check its visibility using SceneView.locationToScreen.

Parameters
lookAtPoint A point geometry containing the location for the camera to look at
distance The distance of the camera from the look at point, in meters; may not be negative
heading the absolute heading, i.e. not relative to the lookAtPoint, in degrees; may be negative
pitch the pitch in degrees; may not be negative
roll the roll in degrees
Throws
IllegalArgumentException if lookAtPoint is null

Public Methods

public Camera elevate (double deltaAltitude)

Creates a copy of the camera with the altitude adjusted.

Parameters
deltaAltitude in meters; can be positive or negative, however the Camera will only move as low as the BaseSurface allows.
Returns
  • a new camera

public double getHeading ()

Gets the camera's heading.

Returns
  • the heading

public Point getLocation ()

Gets the camera's location.

Returns
  • the location of the camera

public double getPitch ()

Gets the camera's pitch.

Returns
  • the pitch in degrees

public double getRoll ()

Gets the camera's roll.

Returns
  • the roll

public Camera moveForward (double distance)

Creates a copy of the camera with the location moved by a given distance in the direction the camera is facing.

Parameters
distance in meters; may not be negative
Returns
  • a new Camera

public Camera moveTo (Point location)

Creates a copy of the camera with the location changed.

Parameters
location the new location
Returns
  • a new camera
Throws
IllegalArgumentException if location is null

public Camera moveToward (Point targetPoint, double distance)

Creates a copy of the camera with the location moved in the direction of a target point by a given distance.

Parameters
targetPoint location to move towards
distance distance to move (in meters); may not be negative
Returns
  • a new camera

public Camera rotateAround (Point targetPoint, double deltaHeading, double deltaPitch, double deltaRoll)

Creates a copy of the camera rotated around the given target point by the given delta angles in degrees. The targetPoint will not change on the screen if it was on the screen to begin with. The distance between the previous Camera location the targetPoint will be the same as between the new Camera Location and the targetPoint.

Parameters
targetPoint the point to rotate around
deltaHeading the heading change; may be negative
deltaPitch the pitch change; may be negative
deltaRoll the roll change
Returns
  • a new camera
Throws
IllegalArgumentException if targetPoint is null

public Camera rotateTo (double heading, double pitch, double roll)

Creates a copy of the camera with the heading, pitch and roll changed to the absolute given angles in degrees.

Parameters
heading the new heading; may be negative
pitch the new pitch; may be negative
roll the new roll
Returns
  • a new camera

public Camera zoomToward (Point targetPoint, double factor)

Creates a copy of the camera with the location moved in the direction of a target point by a given zoom factor.

Parameters
targetPoint the target point to zoom towards
factor a factor of the distance between the current Camera Location and the targetPoint. E.g. a factor of 2 will divide that distance in half. Negative values will have no effect.
Returns
  • a new camera
Throws
IllegalArgumentException if target point is null