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 tried 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)

Constructor using a map center expressed as latitude and longitude, and map scale.

  • latitude - The latitude of the center of the target extent.
  • longitude - The longitude of the center of the target extent.
  • 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)

Constructor using a map center expressed as latitude and longitude, map scale, and camera.

  • latitude - The latitude of the center of the target extent.
  • longitude - The longitude of the center of the target extent.
  • scale - The ratio between a distance on the map and the corresponding distance on the ground.
  • camera - The parameters describing the camera position and orientation.

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

Constructor using a map center expressed as a Point, and map scale.

  • center - The center of the target extent as a Point.
  • 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)

Constructor using a map center expressed as a Point, and map scale.

  • center - The center of the target extent as a Point.
  • scale - The ratio between a distance on the map and the corresponding distance on the ground.
  • camera - The parameters describing the camera position and orientation.

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

Constructor using a map center, scale, and rotation.

  • center - The center of the target extent as a Point.
  • 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)

Constructor using a map center, scale, rotation, and camera.

  • center - The center of the target extent as a Point.
  • 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 - The parameters describing the camera position and orientation.

Viewpoint::Viewpoint(const Geometry &targetExtent)

Constructor using an extent.

  • targetExtent - The target extent as a Geometry.

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

Constructor using an extent and camera.

  • targetExtent - The target extent as a Geometry.
  • camera - The parameters describing the camera position and orientation.

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

Constructor using an extent and rotation.

  • targetExtent - The target extent as a Geometry.
  • rotation - The rotation angle in degrees between 0 and 360.

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

Constructor using an extent, rotation, and camera.

  • targetExtent - The target extent as a Geometry.
  • rotation - The rotation angle in degrees between 0 and 360.
  • camera - The parameters describing the camera position and orientation.

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 camera of this Viewpoint.

[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 rotation angle in degrees between 0 and 360.

Geometry Viewpoint::targetGeometry() const

Gets target geometry, which is either a Point (Viewpoint center) or an Envelope (Viewpoint extent).

double Viewpoint::targetScale() const

Gets the scale this view is requesting.

[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?