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

public final class Camera extends Object
A camera represents an observer's location and their perspective of an ArcGISScene within a SceneView.

A Camera object can be thought of as a camera that you look through to see a viewable area of a scene. What you see depends on how you orientate the camera and how far it is above the Surface. A camera has four main configurable properties:

  • Location - The 3D point in space where the camera is located.
  • Heading - The angle around the z-axis the camera is rotated. The angle is clockwise from north in the East, North, Up (ENU) ground reference frame. The value is between 0 and 360. 0 is looking North and 90 is looking East.
  • Pitch - The angle around the y-axis the camera is rotated. The value is between 0 to 180. 0 is looking straight down, 180 is looking straight up.
  • Roll - The angle around the x-axis the camera is rotated. The value is between 0 and 360. 0 is horizontal, 180 is upside down.

You can construct a Camera based on these values or you can obtain it from the scene view's current viewpoint using SceneView.getCurrentViewpointCamera(). The Camera is immutable which means that once it is created it you cannot modify it.

You can define the user's camera interactions using the scene view's camera controller. The default camera controller (GlobeCameraController) allows users to freely move and focus the camera anywhere in the scene. Other camera controllers provide specialized behavior, such as:

Since:
100.0.0
  • Constructor Summary

    Constructors
    Constructor
    Description
    Camera(double latitude, double longitude, double altitude, double heading, double pitch, double roll)
    Creates a camera with the specified latitude, longitude, altitude, heading, pitch, and roll.
    Camera(Point location, double heading, double pitch, double roll)
    Creates a camera with the specified location, heading, pitch, and roll.
    Camera(Point lookAtPoint, double distance, double heading, double pitch, double roll)
    Creates a camera based on a point to look at, the distance to this point, heading, pitch, and roll.
    Camera(TransformationMatrix transformationMatrix)
    Creates a camera from a transformation matrix.
  • Method Summary

    Modifier and Type
    Method
    Description
    elevate(double deltaAltitude)
    Creates a copy of the camera with the change in altitude applied.
    double
    Gets the heading of the camera.
    Gets the point geometry containing the location and altitude of the camera.
    double
    Gets the pitch of the camera.
    double
    Gets the roll of the camera.
    Gets the camera's TransformationMatrix.
    moveForward(double distance)
    Creates a copy of the camera with its location moved by the specified distance in the direction the camera is facing.
    moveTo(Point location)
    Creates a copy of the camera with a new location.
    moveToward(Point targetPoint, double distance)
    Creates a copy of the camera with the camera moved in the direction of a target point by the specified distance.
    rotateAround(Point targetPoint, double deltaHeading, double deltaPitch, double deltaRoll)
    Creates a copy of the camera with the heading and pitch rotated from a specified target point by the delta angles in degrees.
    rotateTo(double heading, double pitch, double roll)
    Creates a copy of the camera with the specified heading, pitch and roll values.
    zoomToward(Point targetPoint, double factor)
    Creates a copy of the camera with its location moved in the direction of a target point by the specified zoom factor.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Camera

      public Camera(double latitude, double longitude, double altitude, double heading, double pitch, double roll)
      Creates a camera with the specified latitude, longitude, altitude, heading, pitch, and roll.
      Parameters:
      latitude - the latitude of the camera position in degrees
      longitude - the longitude of the camera position in degrees
      altitude - the altitude of the camera position in meters. If the altitude is below the ArcGISScene.getBaseSurface() and the Surface.getNavigationConstraint() is set to NavigationConstraint.STAY_ABOVE, the camera will be located at the Surface. Note: that the default is NavigationConstraint.STAY_ABOVE.
      heading - the angle around the z-axis the camera is rotated. The angle is clockwise from north in the East, North, Up (ENU) ground reference frame. The value is between 0 and 360. 0 is looking North and 90 is looking East. Values are wrapped around so that they fall within 0 to 360.
      pitch - the angle around the y-axis the camera is rotated in the East, North, Up (ENU) ground reference frame. The value is between 0 and 180. 0 is looking straight down and 180 is looking straight up. A negative value defaults to 0 and a value greater than 180 defaults to 180. If the behavior of a negative pitch is required, then the corresponding transformation with positive pitch can be set instead. For example, if heading:0 pitch:-20 roll:0 is required then heading:180 pitch:20 roll:180 can be used instead.
      roll - the angle around the x-axis the camera is rotated in the East, North, Up (ENU) ground reference frame. The value is between 0 and 360. 0 is horizontal, 180 is upside down. Values are wrapped so that they fall within 0 to 360.
      Since:
      100.0.0
    • Camera

      public Camera(Point location, double heading, double pitch, double roll)
      Creates a camera with the specified location, heading, pitch, and roll.
      Parameters:
      location - a point geometry containing the location and altitude at which to place the camera. If the altitude is below the ArcGISScene.getBaseSurface() and the Surface.getNavigationConstraint() is set to NavigationConstraint.STAY_ABOVE, the camera will be located at the Surface. Note: that the default is NavigationConstraint.STAY_ABOVE. If the point has a spatial reference, the point projects to WGS84. Otherwise, a point spatial reference of WGS84 is assumed.
      heading - the angle around the z-axis the camera is rotated. The angle is clockwise from north in the East, North, Up (ENU) ground reference frame. The value is between 0 and 360. 0 is looking North and 90 is looking East. Values are wrapped around so that they fall within 0 to 360.
      pitch - the angle around the y-axis the camera is rotated in the East, North, Up (ENU) ground reference frame. The value is between 0 and 180. 0 is looking straight down and 180 is looking straight up. A negative value defaults to 0 and a value greater than 180 defaults to 180. If the behavior of a negative pitch is required, then the corresponding transformation with positive pitch can be set instead. For example, if heading:0 pitch:-20 roll:0 is required then heading:180 pitch:20 roll:180 can be used instead.
      roll - the angle around the x-axis the camera is rotated in the East, North, Up (ENU) ground reference frame. The value is between 0 and 360. 0 is horizontal, 180 is upside down. Values are wrapped so that they fall within 0 to 360.
      Throws:
      IllegalArgumentException - if location is null
      Since:
      100.0.0
    • Camera

      public Camera(Point lookAtPoint, double distance, double heading, double pitch, double roll)
      Creates a camera based on a point to look at, the distance to this point, heading, pitch, and roll.

      Note: the given values may mean that the point is not visible on screen. You can check its visibility using SceneView.locationToScreen(Point).

      Parameters:
      lookAtPoint - the point in space the camera will be pointing at
      distance - the distance in meters between the lookAtPoint and the camera location
      heading - the angle around the z-axis the camera is rotated. The angle is clockwise from north in the East, North, Up (ENU) ground reference frame. The value is between 0 and 360. 0 is looking North and 90 is looking East. Values are wrapped around so that they fall within 0 to 360.
      pitch - the angle around the y-axis the camera is rotated in the East, North, Up (ENU) ground reference frame. The value is between 0 and 180. 0 is looking straight down and 180 is looking straight up. A negative value defaults to 0 and a value greater than 180 defaults to 180. If the behavior of a negative pitch is required, then the corresponding transformation with positive pitch can be set instead. For example, if heading:0 pitch:-20 roll:0 is required then heading:180 pitch:20 roll:180 can be used instead.
      roll - the angle around the x-axis the camera is rotated in the East, North, Up (ENU) ground reference frame. The value is between 0 and 360. 0 is horizontal, 180 is upside down. Values are wrapped so that they fall within 0 to 360.
      Since:
      100.0.0
    • Camera

      public Camera(TransformationMatrix transformationMatrix)
      Creates a camera from a transformation matrix. The TransformationMatrix describes the camera's location and direction it is looking.
      Parameters:
      transformationMatrix - the TransformationMatrix used to create the camera. The TransformationMatrix describes the camera's location and the direction it is looking. Using this constructor with the location provided by ARKit/ARCore is necessary for enabling augmented reality.
      Throws:
      NullPointerException - if transformationMatrix is null
      Since:
      100.6.0
  • Method Details

    • getLocation

      public Point getLocation()
      Gets the point geometry containing the location and altitude of the camera.
      Returns:
      the location of the camera
      Since:
      100.0.0
    • getPitch

      public double getPitch()
      Gets the pitch of the camera.

      The angle around the y-axis the camera is rotated in the East, North, Up (ENU) ground reference frame. The value is between 0 and 180. 0 is looking straight down and 180 is looking straight up.

      Returns:
      the pitch in degrees
      Since:
      100.0.0
    • getHeading

      public double getHeading()
      Gets the heading of the camera.

      The angle around the z-axis the camera is rotated. The angle is clockwise from north in the East, North, Up (ENU) ground reference frame. The value is between 0 and 360. 0 is looking North and 90 is looking East.

      Returns:
      the heading
      Since:
      100.0.0
    • getRoll

      public double getRoll()
      Gets the roll of the camera.

      The angle around the x-axis the camera is rotated in the East, North, Up (ENU) ground reference frame. The value is between 0 and 360. 0 is horizontal, 180 is upside down.

      Returns:
      the roll
      Since:
      100.0.0
    • getTransformationMatrix

      public TransformationMatrix getTransformationMatrix()
      Gets the camera's TransformationMatrix. It does not matter if the camera was created with a TransformationMatrix, the camera's location and orientation will always be converted into a TransformationMatrix.
      Returns:
      the TransformationMatrix representation of the camera's location and rotation
      Since:
      100.6.0
    • elevate

      public Camera elevate(double deltaAltitude)
      Creates a copy of the camera with the change in altitude applied.
      Parameters:
      deltaAltitude - the altitude delta to apply to the output camera
      Returns:
      a copy of the camera with an elevation delta adjusted by the parameter deltaAltitude
      Since:
      100.0.0
      See Also:
    • moveForward

      public Camera moveForward(double distance)
      Creates a copy of the camera with its location moved by the specified distance in the direction the camera is facing.
      Parameters:
      distance - the distance in meters
      Returns:
      a new Camera
      Since:
      100.0.0
    • moveToward

      public Camera moveToward(Point targetPoint, double distance)
      Creates a copy of the camera with the camera moved in the direction of a target point by the specified distance.
      Parameters:
      targetPoint - the point location towards which the camera will move
      distance - the distance in meters the output camera will be moved
      Returns:
      a copy of the camera with the position moved
      Throws:
      IllegalArgumentException - if targetPoint is null
      Since:
      100.0.0
      See Also:
    • rotateAround

      public Camera rotateAround(Point targetPoint, double deltaHeading, double deltaPitch, double deltaRoll)
      Creates a copy of the camera with the heading and pitch rotated from a specified target point by the delta angles in degrees.
      Parameters:
      targetPoint - the point location around which the camera will move
      deltaHeading - the delta angle in degrees by which the output camera heading will be rotated around the target point
      deltaPitch - the delta angle in degrees by which the output camera pitch will be rotated around the target point
      deltaRoll - the delta angle in degrees by which the output camera roll will be rotated around the target point
      Returns:
      a copy of the camera with the position moved
      Throws:
      IllegalArgumentException - if targetPoint is null
      Since:
      100.0.0
      See Also:
    • rotateTo

      public Camera rotateTo(double heading, double pitch, double roll)
      Creates a copy of the camera with the specified heading, pitch and roll values.
      Parameters:
      heading - the angle around the z-axis the new camera is rotated. The angle is clockwise from north in the East, North, Up (ENU) ground reference frame. The value is between 0 and 360. 0 is looking North and 90 is looking East. Values are wrapped around so that they fall within 0 to 360.
      pitch - the angle around the y-axis the camera is rotated in the East, North, Up (ENU) ground reference frame. The value is between 0 and 180. 0 is looking straight down and 180 is looking straight up. A negative value defaults to 0 and a value greater than 180 defaults to 180. If the behavior of a negative pitch is required, then the corresponding transformation with positive pitch can be set instead. For example, if heading:0 pitch:-20 roll:0 is required then heading:180 pitch:20 roll:180 can be used instead.
      roll - the angle around the x-axis the new camera is rotated in the East, North, Up (ENU) ground reference frame. The value is between 0 and 360. 0 is horizontal, 180 is upside down. Values are wrapped so that they fall within 0 to 360.
      Returns:
      a copy of the camera with the position moved
      Since:
      100.0.0
      See Also:
    • moveTo

      public Camera moveTo(Point location)
      Creates a copy of the camera with a new location.
      Parameters:
      location - the location to move the output camera to
      Returns:
      a copy of the camera with the location changed
      Throws:
      NullPointerException - if location is null
      Since:
      100.0.0
      See Also:
    • zoomToward

      public Camera zoomToward(Point targetPoint, double factor)
      Creates a copy of the camera with its location moved in the direction of a target point by the specified zoom factor.
      Parameters:
      targetPoint - the point location the new camera zooms towards
      factor - the zoom factor the camera will be moved by based on the distance between the current camera location and the target point. For example, a factor of 2 will divide the distance in half for the new camera. Negative values will have no effect.
      Returns:
      a copy of the camera with the position moved
      Throws:
      IllegalArgumentException - if targetPoint is null
      Since:
      100.0.0
      See Also: