Skip to content
  • Camera
  • class Esri::ArcGISRuntime::Camera

    A camera represents an observer's location and their perspective of a Scene within a SceneView. More...

    Header: #include <Camera.h>
    Since: Esri::ArcGISRuntime 100.0

    Public Functions

    Camera()
    (since Esri::ArcGISRuntime 100.6) Camera(Esri::ArcGISRuntime::TransformationMatrix *transformationMatrix)
    Camera(const Esri::ArcGISRuntime::Point &locationPoint, double heading, double pitch, double roll)
    Camera(const Esri::ArcGISRuntime::Point &lookAtPoint, double distance, double heading, double pitch, double roll)
    Camera(double latitude, double longitude, double altitude, double heading, double pitch, double roll)
    Camera(const Esri::ArcGISRuntime::Camera &other)
    Camera(Esri::ArcGISRuntime::Camera &&other)
    ~Camera()
    Esri::ArcGISRuntime::Camera elevate(double deltaAltitude) const
    double heading() const
    bool isEmpty() const
    Esri::ArcGISRuntime::Point location() const
    Esri::ArcGISRuntime::Camera moveForward(double distance) const
    Esri::ArcGISRuntime::Camera moveTo(const Esri::ArcGISRuntime::Point &location) const
    Esri::ArcGISRuntime::Camera moveToward(const Esri::ArcGISRuntime::Point &targetPoint, double distance) const
    double pitch() const
    double roll() const
    Esri::ArcGISRuntime::Camera rotateAround(const Esri::ArcGISRuntime::Point &targetPoint, double deltaHeading, double deltaPitch, double deltaRoll) const
    Esri::ArcGISRuntime::Camera rotateTo(double heading, double pitch, double roll) const
    (since Esri::ArcGISRuntime 100.6) Esri::ArcGISRuntime::TransformationMatrix *transformationMatrix(QObject *parent = nullptr) const
    Esri::ArcGISRuntime::Camera zoomToward(const Esri::ArcGISRuntime::Point &targetPoint, double factor) const
    (since Esri::ArcGISRuntime 200.2) bool operator!=(const Esri::ArcGISRuntime::Camera &other) const
    Esri::ArcGISRuntime::Camera &operator=(Esri::ArcGISRuntime::Camera &&other)
    Esri::ArcGISRuntime::Camera &operator=(const Esri::ArcGISRuntime::Camera &other)
    bool operator==(const Esri::ArcGISRuntime::Camera &other) const

    Detailed Description

    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.

    The camera orientation uses a local right-handed XYZ coordinate system aligned to East, North, Up (ENU): X = East, Y = North, Z = Up.

    A camera has four main configurable properties:

    • Location - The 3D point in space where the camera is located. The camera will adopt the spatial reference of the point at the time of creation. If a spatial reference is not supplied, a spatial reference having a WGS84 horizontal coordinate system is assumed. When no vertical coordinate system is provided, a point's z value is inferred based on the horizontal coordinate system's unit, interpreted as a height-based value relative to the horizontal coordinate system's surface: - Projected coordinate systems use the unit of the horizontal coordinate system. - Geographic coordinate systems use meters.
    • Heading - The angle around the z-axis at which 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, where 0 is looking North and 90 is looking East.
    • Pitch - The angle around the x-axis at which the camera is rotated. The value is between 0 and 180, where 0 is looking straight down, 90 is looking towards the horizon, and 180 is looking straight up.
    • Roll - The angle around the y-axis (the direction of sight) at which the camera is rotated. Positive values rotate counterclockwise in view space (for example, when looking north, 90 means the top of the screen points west). The value is between 0 and 360, where 0 is horizontal and 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::currentViewpointCamera. 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:

    Example:

    Create a Camera to be used for setting the viewpoint on a SceneView:

    // create a camera
    const double latitude = 28.4;
    const double longitude = 83.9;
    const double altitude = 10010.0;
    const double heading = 10.0;
    const double pitch = 80.0;
    const double roll = 0.0;
    Camera camera(latitude, longitude, altitude, heading, pitch, roll);
    
    // set the viewpoint
    m_sceneView->setViewpointCameraAndWait(camera);

    Relevant samples:

    Member Function Documentation

    Camera::Camera()

    Default constructor. Creates an empty Camera.

    [explicit, since Esri::ArcGISRuntime 100.6] Camera::Camera(Esri::ArcGISRuntime::TransformationMatrix *transformationMatrix)

    Creates a camera from a transformation matrix whose pose is already expressed in the scene's world coordinate frame.

    This constructor assumes the input matrix already encodes a world-space camera pose. No additional origin mapping (for example, room-to-world anchoring) or translation scaling is applied by this constructor.

    Use this constructor when your pose source already matches the scene's coordinate frame and distance scale. If your source pose is in a local frame, first resolve that local frame to world coordinates and apply any required translation scaling before creating the Camera.

    This function was introduced in Esri::ArcGISRuntime 100.6.

    Camera::Camera(const Esri::ArcGISRuntime::Point &locationPoint, double heading, double pitch, double roll)

    Creates a camera with the specified location, heading, pitch, and roll. The camera's spatial reference is derived from the locationPoint.

    • locationPoint - A point geometry defining the 3D location at which to place the camera. If the point has a spatial reference, the camera will adopt it. Otherwise, a spatial reference of WGS84 is assumed. If the point's z value is below the Scene::baseSurface and the Surface::navigationConstraint is set to NavigationConstraint::StayAbove, the camera will be positioned at the Surface. Note that the default is NavigationConstraint::StayAbove.
    • heading - The angle around the z-axis at which 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, where 0 is looking North and 90 is looking East. Values are wrapped modulo 360 (for example, 370 becomes 10).
    • pitch - The angle around the x-axis at which the camera is rotated in the East, North, Up (ENU) ground reference frame. The value is between 0 and 180, where 0 is looking straight down, 90 is looking towards the horizon, and 180 is looking straight up. Pitch values are clamped to this range: 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 y-axis (the direction of sight) at which the camera is rotated in the East, North, Up (ENU) ground reference frame. Positive values rotate counterclockwise in view space (for example, when looking north, 90 means the top of the screen points west). The value is between 0 and 360, where 0 is horizontal and 180 is upside down. Values are wrapped modulo 360 (for example, 370 becomes 10).

    Camera::Camera(const Esri::ArcGISRuntime::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. The camera's spatial reference is derived from the lookAtPoint.

    • lookAtPoint - The point in space the camera will be pointing at. If the point has a spatial reference, the camera will adopt it. Otherwise, a spatial reference of WGS84 is assumed.
    • distance - The distance in meters between the lookAtPoint and the camera location.
    • heading - The angle around the z-axis at which 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, where 0 is looking North and 90 is looking East. Values are wrapped modulo 360 (for example, 370 becomes 10).
    • pitch - The angle around the x-axis at which the camera is rotated in the East, North, Up (ENU) ground reference frame. The value is between 0 and 180, where 0 is looking straight down, 90 is looking towards the horizon, and 180 is looking straight up. Pitch values are clamped to this range: 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 y-axis (the direction of sight) at which the camera is rotated in the East, North, Up (ENU) ground reference frame. Positive values rotate counterclockwise in view space (for example, when looking north, 90 means the top of the screen points west). The value is between 0 and 360, where 0 is horizontal and 180 is upside down. Values are wrapped modulo 360 (for example, 370 becomes 10).

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

    Camera::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. The Camera's spatial reference will be WGS84.

    • 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 Scene::baseSurface and the Surface::navigationConstraint is set to NavigationConstraint::StayAbove, the camera will be located at the Surface. Note: that the default is NavigationConstraint::StayAbove.
    • heading - The angle around the z-axis at which 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, where 0 is looking North and 90 is looking East. Values are wrapped modulo 360 (for example, 370 becomes 10).
    • pitch - The angle around the x-axis at which the camera is rotated in the East, North, Up (ENU) ground reference frame. The value is between 0 and 180, where 0 is looking straight down, 90 is looking towards the horizon, and 180 is looking straight up. Pitch values are clamped to this range: 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 y-axis (the direction of sight) at which the camera is rotated in the East, North, Up (ENU) ground reference frame. Positive values rotate counterclockwise in view space (for example, when looking north, 90 means the top of the screen points west). The value is between 0 and 360, where 0 is horizontal and 180 is upside down. Values are wrapped modulo 360 (for example, 370 becomes 10).

    Camera::Camera(const Esri::ArcGISRuntime::Camera &other)

    Copy constructor from other Camera.

    [noexcept] Camera::Camera(Esri::ArcGISRuntime::Camera &&other)

    Move constructor from other Camera.

    [noexcept] Camera::~Camera()

    Destructor.

    Esri::ArcGISRuntime::Camera Camera::elevate(double deltaAltitude) const

    Returns a copy of the camera with the specified change in altitude applied.

    • deltaAltitude - The altitude delta in meters to apply to the output camera.

    See also Camera.

    double Camera::heading() const

    Returns the heading of the camera.

    The angle around the z-axis at which 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, where 0 is looking North and 90 is looking East.

    See also Camera.

    bool Camera::isEmpty() const

    Returns whether this object is empty.

    Esri::ArcGISRuntime::Point Camera::location() const

    Returns the point geometry containing the location and altitude of the camera.

    See also Camera.

    Esri::ArcGISRuntime::Camera Camera::moveForward(double distance) const

    Returns a copy of the camera with its location moved by the specified distance in the direction it is facing.

    • distance - The distance in meters that the returned camera will move in the direction the camera is facing.

    Esri::ArcGISRuntime::Camera Camera::moveTo(const Esri::ArcGISRuntime::Point &location) const

    Returns a copy of the camera with a new location.

    • location - The location to move the output camera to. The returned camera is in the same spatial reference as the source camera. If the spatial reference of the point is not specified, it is assumed to be the spatial reference of the camera.

    See also Camera.

    Esri::ArcGISRuntime::Camera Camera::moveToward(const Esri::ArcGISRuntime::Point &targetPoint, double distance) const

    Returns a copy of the camera with the camera moved in the direction of a target point by the specified distance.

    • targetPoint - The point location towards which the camera will move. The returned camera is in the same spatial reference as the source camera. If the spatial reference of the point is not specified, it is assumed to be the spatial reference of the camera.
    • distance - The distance in meters the returned camera should move towards the target point.

    See also Camera.

    double Camera::pitch() const

    Returns the pitch of the camera.

    The angle around the x-axis at which the camera is rotated in the East, North, Up (ENU) ground reference frame. The value is between 0 and 180, where 0 is looking straight down, 90 is looking towards the horizon, and 180 is looking straight up.

    See also Camera.

    double Camera::roll() const

    Returns the roll of the camera.

    The angle around the y-axis (the direction of sight) at which the camera is rotated in the East, North, Up (ENU) ground reference frame. Positive values rotate counterclockwise in view space (for example, when looking north, 90 means the top of the screen points west). The value is between 0 and 360, where 0 is horizontal and 180 is upside down.

    See also Camera.

    Esri::ArcGISRuntime::Camera Camera::rotateAround(const Esri::ArcGISRuntime::Point &targetPoint, double deltaHeading, double deltaPitch, double deltaRoll) const

    Returns a copy of the camera with the heading and pitch rotated from a given target point by a given delta angles in degrees.

    • targetPoint - The point location around which the returned camera is placed. The returned camera is in the same spatial reference as the source camera. If the spatial reference of the point is not specified, it is assumed to be the spatial reference of the camera.
    • deltaHeading - The delta angle in degrees by which the output camera heading will be rotated around the targetPoint.
    • deltaPitch - The delta angle in degrees by which the output camera pitch will be rotated around the targetPoint.
    • deltaRoll - The delta angle in degrees by which the output camera roll will be rotated around the targetPoint.

    See also Camera.

    Esri::ArcGISRuntime::Camera Camera::rotateTo(double heading, double pitch, double roll) const

    Returns a copy of the camera with the specified heading, pitch and roll values.

    • heading - The angle around the z-axis at which 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, where 0 is looking North and 90 is looking East. Values are wrapped modulo 360 (for example, 370 becomes 10).
    • pitch - The angle around the x-axis at which the new camera is rotated in the East, North, Up (ENU) ground reference frame. The value is between 0 and 180, where 0 is looking straight down, 90 is looking towards the horizon, and 180 is looking straight up. Pitch values are clamped to this range: 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 y-axis (the direction of sight) at which the new camera is rotated in the East, North, Up (ENU) ground reference frame. Positive values rotate counterclockwise in view space (for example, when looking north, 90 means the top of the screen points west). The value is between 0 and 360, where 0 is horizontal and 180 is upside down. Values are wrapped modulo 360 (for example, 370 becomes 10).

    See also Camera.

    [since Esri::ArcGISRuntime 100.6] Esri::ArcGISRuntime::TransformationMatrix *Camera::transformationMatrix(QObject *parent = nullptr) const

    Returns the camera's TransformationMatrix.

    • parent - The parent QObject-derived object (optional).

    Regardless of how the camera is created, the camera's location and orientation can always be represented as a TransformationMatrix.

    This function was introduced in Esri::ArcGISRuntime 100.6.

    See also Camera.

    Esri::ArcGISRuntime::Camera Camera::zoomToward(const Esri::ArcGISRuntime::Point &targetPoint, double factor) const

    Returns a copy of the camera with its location moved in the direction of a target point by the specified zoom factor.

    • targetPoint - The 3D point the returned camera zooms towards. The returned camera is in the same spatial reference as the source camera. If the spatial reference of the point is not specified, it is assumed to be the spatial reference of the camera.
    • 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.

    See also Camera.

    [since Esri::ArcGISRuntime 200.2] bool Camera::operator!=(const Esri::ArcGISRuntime::Camera &other) const

    Inequality operator. Returns true if this object and other are not equal.

    This function was introduced in Esri::ArcGISRuntime 200.2.

    See also Camera::operator==.

    [noexcept] Esri::ArcGISRuntime::Camera &Camera::operator=(Esri::ArcGISRuntime::Camera &&other)

    Move operator from other Camera.

    Esri::ArcGISRuntime::Camera &Camera::operator=(const Esri::ArcGISRuntime::Camera &other)

    Assignment operator from other Camera.

    bool Camera::operator==(const Esri::ArcGISRuntime::Camera &other) const

    Tests and returns true if this object is equal to a second Camera object.

    • other - The other camera object.

    See also Camera.

    Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.