Skip To Content ArcGIS for Developers Sign In Dashboard

Viewpoint Class

(Esri::ArcGISRuntime::Viewpoint)

Base class for classes describing the user's viewpoint when viewing a map or scene. More...

Header: #include <Viewpoint>
Since: Esri::ArcGISRuntime 100.0
Inherits: JsonSerializable

Public Functions

Viewpoint()
Viewpoint(double latitude, double longitude, double scale)
Viewpoint(double latitude, double longitude, double scale, const Camera &camera)
Viewpoint(const Point &center, double scale)
Viewpoint(const Point &center, double scale, const Camera &camera)
Viewpoint(const Point &center, double scale, double rotation)
Viewpoint(const Point &center, double scale, double rotation, const Camera &camera)
Viewpoint(const Geometry &targetExtent)
Viewpoint(const Geometry &targetExtent, const Camera &camera)
Viewpoint(const Geometry &targetExtent, double rotation)
Viewpoint(const Geometry &targetExtent, double rotation, const Camera &camera)
Viewpoint(const Viewpoint &other)
Viewpoint(Viewpoint &&other)
~Viewpoint()
Camera camera() const
bool isEmpty() const
double rotation() const
Geometry targetGeometry() const
double targetScale() const
ViewpointType viewpointType() const
Viewpoint &operator=(const Viewpoint &other)
Viewpoint &operator=(Viewpoint &&other)

Reimplemented Public Functions

virtual QString toJson() const
virtual QJsonObject unknownJson() const
virtual QJsonObject unsupportedJson() const

Static Public Members

Viewpoint fromJson(const QString &json)

Detailed Description

Base class for classes describing the user's viewpoint when viewing a map or scene.

Use a Viewpoint to specify how a users sees a 2D Map or 3D Scene displayed in a MapView or SceneView. The Viewpoint controls multiple aspects of the view such as extent, rotation, and with 3D viewing angle and field of view.

A Viewpoint contains two views

A Viewpoint object contains two views - one 2D and one 3D. A Viewpoint object stores the 3D view in a Camera member object. The 2D and 3D views need not view the same location. Viewpoints also contain 2D view information like scale, extent, and rotation, even when Camera information is not present. When a Viewpoint is passed from one SceneView to another, only the 3D information (if present) and time are used. When a SceneView tries to use a Viewpoint that has no Camera (such as a Viewpoint retrieved from a MapView) the SceneView approximates the 3D viewpoint information from the 2D viewpoint information.

Example:

Create a Viewpoint on a MapView based on an extent and zoom to the extent with animation:

constexpr double xMin = -12338668.348591767;
constexpr double yMin = 5546908.424239618;
constexpr double xMax = -12338247.594362013;
constexpr double yMax = 5547223.989911933;
constexpr int wkid = 102100;
Viewpoint vpSpring(Envelope(xMin, yMin, xMax, yMax, SpatialReference(wkid)));
constexpr float duration = 4.0f;
m_mapView->setViewpointAnimated(vpSpring, duration, AnimationCurve::EaseInOutCubic);

See also Camera, MapView, and SceneView.

Member Function Documentation

Viewpoint::Viewpoint()

Default constructor.

Viewpoint::Viewpoint(double latitude, double longitude, double scale)

A constructor that creates a Viewpoint with latitude, longitude, and scale.

The spatial reference for the defined point is WGS84.

  • latitude - The latitude coordinate for the viewpoint. Negative values are south of the equator.
  • longitude - The longitude coordinate for the viewpoint. Negative values are west of the prime meridian.
  • scale - The ratio between a distance on the map and the corresponding distance on the ground.

Viewpoint::Viewpoint(double latitude, double longitude, double scale, const Camera &camera)

A constructor that creates a Viewpoint using a map center expressed as latitude and longitude, map scale, and camera.

The spatial reference for the defined point is WGS84.

  • latitude - The latitude coordinate for the viewpoint. Negative values are south of the equator.
  • longitude - The longitude coordinate for the viewpoint. Negative values are west of the prime meridian.
  • scale - The ratio between a distance on the map and the corresponding distance on the ground.
  • camera - A Camera object that defines the observer for the scene.

Viewpoint::Viewpoint(const Point &center, double scale)

A constructor that creates a Viewpoint with center point and scale.

The spatial reference of the center point cannot be null.

  • center - The center of the visible area.
  • scale - The ratio between a distance on the map and the corresponding distance on the ground.

Viewpoint::Viewpoint(const Point &center, double scale, const Camera &camera)

A constructor that creates a Viewpoint with center point, scale, and Camera.

The spatial reference of the center point cannot be null.

  • center - The center of the visible area.
  • scale - The ratio between a distance on the map and the corresponding distance on the ground.
  • camera - A Camera object that defines the observer for the scene.

Viewpoint::Viewpoint(const Point &center, double scale, double rotation)

A constructor that creates a Viewpoint with center point, scale, and rotation.

The spatial reference of the center point cannot be null.

  • center - The center of the visible area.
  • scale - The ratio between a distance on the map and the corresponding distance on the ground.
  • rotation - The rotation angle in degrees between 0 and 360.

Viewpoint::Viewpoint(const Point &center, double scale, double rotation, const Camera &camera)

A constructor that creates a Viewpoint with center point, scale, rotation, and Camera.

The spatial reference of the center point cannot be null.

  • center - The center of the visible area.
  • scale - The ratio between a distance on the map and the corresponding distance on the ground.
  • rotation - The rotation angle in degrees between0 and 360.
  • camera - A Camera object that defines the observer for the scene.

Viewpoint::Viewpoint(const Geometry &targetExtent)

A constructor that creates a Viewpoint with a bounding extent.

The spatial reference will be that same as the extent. The spatial reference of the target geometry cannot be null.

  • targetExtent - The geometry to use as the visible area.

Viewpoint::Viewpoint(const Geometry &targetExtent, const Camera &camera)

A constructor that creates a Viewpoint with a bounding extent and Camera.

The spatial reference will be that same as the extent. The spatial reference of the target geometry cannot be null.

  • targetExtent - The geometry to use as the visible area.
  • camera - A Camera object that defines the observer for the scene.

Viewpoint::Viewpoint(const Geometry &targetExtent, double rotation)

A constructor that creates a Viewpoint with a bounding extent and rotation.

The spatial reference of the target geometry cannot be null.

  • targetExtent - The geometry to use as the visible area.
  • rotation - The rotation angle in degrees between 0 and 360.

Viewpoint::Viewpoint(const Geometry &targetExtent, double rotation, const Camera &camera)

A constructor that creates a Viewpoint with a bounding extent, rotation, and Camera.

  • targetExtent - The geometry to use as the visible area.
  • rotation - The rotation angle in degrees between 0 and 360.
  • camera - A Camera object that defines the observer for the scene.

Viewpoint::Viewpoint(const Viewpoint &other)

Copy constructor from other Viewpoint.

Viewpoint::Viewpoint(Viewpoint &&other)

Move constructor from other Viewpoint.

Viewpoint::~Viewpoint()

Destructor.

Camera Viewpoint::camera() const

Gets the viewpoint's Camera.

[static] Viewpoint Viewpoint::fromJson(const QString &json)

Creates a Viewpoint from its JSON representation.

Returns a Viewpoint created using the data in the json parameter.

See also JsonSerializable.

bool Viewpoint::isEmpty() const

Returns true if this Viewpoint is empty.

double Viewpoint::rotation() const

Gets the viewpoint rotation angle in degrees between 0 and 360.

Geometry Viewpoint::targetGeometry() const

Gets the viewpoint target geometry.

The spatial reference of the target geometry cannot be null.

double Viewpoint::targetScale() const

Gets the viewpoint target scale.

[virtual] QString Viewpoint::toJson() const

Reimplemented from JsonSerializable::toJson().

Returns this Viewpoint as its JSON representation.

See also JsonSerializable.

[virtual] QJsonObject Viewpoint::unknownJson() const

Reimplemented from JsonSerializable::unknownJson().

Gets the unknown JSON of this object.

See also JsonSerializable.

[virtual] QJsonObject Viewpoint::unsupportedJson() const

Reimplemented from JsonSerializable::unsupportedJson().

Gets the unsupported JSON of this object.

See also JsonSerializable.

ViewpointType Viewpoint::viewpointType() const

Gets the type of this Viewpoint.

Viewpoint &Viewpoint::operator=(const Viewpoint &other)

Assignment operator from other Viewpoint.

Viewpoint &Viewpoint::operator=(Viewpoint &&other)

Move operator from other Viewpoint.


Feedback on this topic?