SceneView Class

  • SceneView
  • class Esri::ArcGISRuntime::SceneView

    The base class for a 3D scene. More...

    Header: #include <SceneView.h>
    Since: Esri::ArcGISRuntime 100.0
    Inherits: Esri::ArcGISRuntime::GeoView
    Inherited By:

    Esri::ArcGISRuntime::SceneGraphicsView and Esri::ArcGISRuntime::SceneQuickView

    This class was introduced in Esri::ArcGISRuntime 100.0.

    Public Functions

    virtual ~SceneView() override
    QColor ambientLightColor() const
    Esri::ArcGISRuntime::AnalysisOverlayListModel *analysisOverlays() const
    Esri::ArcGISRuntime::Scene *arcGISScene() const
    Esri::ArcGISRuntime::AtmosphereEffect atmosphereEffect() const
    Esri::ArcGISRuntime::CameraController *cameraController() const
    Esri::ArcGISRuntime::Camera currentViewpointCamera() const
    double fieldOfView() const
    double fieldOfViewDistortionRatio() const
    Esri::ArcGISRuntime::ImageOverlayListModel *imageOverlays() const
    bool isManualRendering() const
    Esri::ArcGISRuntime::LocationToScreenResult locationToScreen(const Esri::ArcGISRuntime::Point &scenePoint) const
    void renderFrame()
    Esri::ArcGISRuntime::Point screenToBaseSurface(double screenX, double screenY) const
    Esri::ArcGISRuntime::TaskWatcher screenToLocation(double screenX, double screenY)
    void setAmbientLightColor(const QColor &color)
    void setArcGISScene(Esri::ArcGISRuntime::Scene *scene)
    void setAtmosphereEffect(Esri::ArcGISRuntime::AtmosphereEffect atmosphereEffect)
    void setCameraController(Esri::ArcGISRuntime::CameraController *cameraController)
    void setFieldOfView(double angle)
    void setFieldOfViewAndDistortionRatio(double angle, double distortionRatio)
    void setFieldOfViewFromLensIntrinsics(double xFocalLength, double yFocalLength, double xPrincipal, double yPrincipal, double xImageSize, double yImageSize, Esri::ArcGISRuntime::DeviceOrientation deviceOrientation)
    virtual void setManualRendering(bool manualRendering)
    void setSpaceEffect(Esri::ArcGISRuntime::SpaceEffect spaceEffect)
    void setSunLighting(Esri::ArcGISRuntime::LightingMode lightingMode)
    void setSunTime(const QDateTime &sunTime)
    Esri::ArcGISRuntime::TaskWatcher setViewpointCamera(const Esri::ArcGISRuntime::Camera &camera)
    Esri::ArcGISRuntime::TaskWatcher setViewpointCamera(const Esri::ArcGISRuntime::Camera &camera, float durationSeconds)
    void setViewpointCameraAndWait(const Esri::ArcGISRuntime::Camera &camera)
    Esri::ArcGISRuntime::SpaceEffect spaceEffect() const
    Esri::ArcGISRuntime::LightingMode sunLighting() const
    QDateTime sunTime() const

    Static Public Members

    quint64 memoryLimit()
    void setMemoryLimit(quint64 memoryLimitBytes)

    Protected Functions

    SceneView(int width, int height)
    virtual void screenToLocationCompletedEvent(QUuid taskId, const Esri::ArcGISRuntime::Point &location)
    virtual void setViewpointCameraCompletedEvent(bool success)

    Detailed Description

    A SceneView renders data in a 3D scene and allows users to interact with the scene. In an MVC architecture, a SceneView represents the view and a Scene represents the model.

    SceneView is a virtual class that can be reimplemented to a desired Qt type. For example, SceneQuickView implements the scene view as a QQuickItem, and SceneGraphicsView implements the scene view as a QGraphicsView. Beyond this, one could implement the scene view as another desired type, such as QGraphicsWidget.

    See also Scene, GeoView, SceneGraphicsView, and SceneQuickView.

    Member Function Documentation

    [protected] SceneView::SceneView(int width, int height)

    Constructs a SceneView with a specified size.

    • width - The width in physical pixels.
    • height - The height in physical pixels.

    [override virtual] SceneView::~SceneView()

    Destructor.

    QColor SceneView::ambientLightColor() const

    Returns the ambient light color.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    See also setAmbientLightColor().

    Esri::ArcGISRuntime::AnalysisOverlayListModel *SceneView::analysisOverlays() const

    Gets the list of analysis overlays as a model.

    This function was introduced in Esri::ArcGISRuntime 100.2.

    Esri::ArcGISRuntime::Scene *SceneView::arcGISScene() const

    Gets the scene associated with this SceneView.

    Returns the scene.

    See also setArcGISScene().

    Esri::ArcGISRuntime::AtmosphereEffect SceneView::atmosphereEffect() const

    Gets the atmosphere display effect. Returns the atmosphere effect.

    See also setAtmosphereEffect().

    Esri::ArcGISRuntime::CameraController *SceneView::cameraController() const

    Returns the CameraController for the sceneview.

    The camera controller determines the camera interaction and navigation model. The default is GlobeCameraController.

    See also setCameraController().

    Esri::ArcGISRuntime::Camera SceneView::currentViewpointCamera() const

    Gets the Camera. Returns the camera for the sceneview.

    double SceneView::fieldOfView() const

    Gets the field of view on the scene view in degrees.

    The default value is 45.0.

    This function was introduced in Esri::ArcGISRuntime 100.6.

    See also setFieldOfView().

    double SceneView::fieldOfViewDistortionRatio() const

    Gets the distortion factor.

    The distortion factor determines how much the vertical field of view is distorted. A distortion factor less than 1.0 will cause the visuals to be stretched taller in comparison to their width. A distortion factor greater than 1.0 will cause the visuals to be shrunk shorter in comparison to their width.

    The default value is 1.0.

    This function was introduced in Esri::ArcGISRuntime 100.6.

    Esri::ArcGISRuntime::ImageOverlayListModel *SceneView::imageOverlays() const

    Returns a collection of overlays for displaying images in the scene view. An image overlay collection cannot belong to more that one SceneView. If the collection contains multiple image overlays, they display in the order in which they were added to the collection.

    So the first overlay in the collection (at index 0) displays at the bottom and each one that follows displays on top of the previous ones.

    If the SceneView also has a GraphicsOverlay, it displays on top of the ImageOverlay.

    This function was introduced in Esri::ArcGISRuntime 100.8.

    bool SceneView::isManualRendering() const

    Returns whether the SceneView is under manual rendering control.

    Note: manual rendering is only supported on iOS and Android platforms.

    This property determines whether the SceneView will use manual rendering updates rather than the using the ArcGIS Runtime internal rendering mechanism.

    When this property is true, you must call renderFrame for any updates to be drawn on the screen. Calling renderFrame isn't necessary when this property is false. The default value is false.

    This function was introduced in Esri::ArcGISRuntime 100.6.

    See also renderFrame.

    Esri::ArcGISRuntime::LocationToScreenResult SceneView::locationToScreen(const Esri::ArcGISRuntime::Point &scenePoint) const

    Returns a LocationToScreenResult from the provided scenePoint.

    [static] quint64 SceneView::memoryLimit()

    Gets the total memory (in bytes) that a process can use for rendering scene data (Android only).

    Note, the default value is determined upon initialization of the first SceneView instance that is being created by the process. Before any SceneView instance has been created, zero is returned. For some use cases you might want to choose to set a custom limit. See setMemoryLimit for details.

    The default value is determined as follows:

    • If ActivityManager.getLargeMemoryClass() is greater than 1 gigabyte, then that value is used as the default value.
    • Otherwise, check whether 45% of total system memory android.app.ActivityManager.MemoryInfo.totalMem is less than 1 gigabyte. If so, then that value is used as the default value.
    • Otherwise, the default value is 1 gigabyte.

    This function was introduced in Esri::ArcGISRuntime 100.3.

    See also setMemoryLimit().

    void SceneView::renderFrame()

    Manually render the current frame.

    Note: manual rendering (along with this method) is only supported on iOS and Android platforms.

    This call will block the caller until the latest changes have been rendered to the screen.

    This method may be called from the main/GUI thread or a sub-thread. Do not mix calls from the main thread and a sub-thread to this method in the same application session.

    If calling this method from a timer event, be sure to stop the timer before shutting down the application.

    In certain situations you may be able to achieve better rendering performance by utilizing the single-threaded renderer. This is already the default setting on some platforms.

    // use the environment variable to use the "basic" rendering loop
    // for the Qt Quick Scene Graph
    qputenv("QSG_RENDER_LOOP", "basic");

    For more information, see here https://links.esri.com/qtquick-visualcanvas-scenegraph-rendering

    This function was introduced in Esri::ArcGISRuntime 100.6.

    See also isManualRendering.

    Esri::ArcGISRuntime::Point SceneView::screenToBaseSurface(double screenX, double screenY) const

    Returns the x/y location on the map that corresponds to the provided screen coordinates.

    • screenX - The x screen coordinate.
    • screenY - The y screen coordinate.

    This method gets the x/y coordinates on the base surface that would be seen at the screen coordinates without regard for any features in the scene. Any features in the line of sight from the camera to the base surface are ignored. To convert this result into a 3D scene location, use the returned x/y coordinates with the z-value at that x/y location on the base surface.

    Esri::ArcGISRuntime::TaskWatcher SceneView::screenToLocation(double screenX, double screenY)

    Asynchronously converts screenX and screenY screen coordinate to a location in the spatial reference of the scene view.

    This is a high performance calculation executed on the GPU using a triangular mesh. Note that elevation values are approximated, and as the distance between the camera and the surface increases, the precision of the elevation value decreases.

    This method will wait for the next drawing cycle to get the exact point from the graphics card that is at the screen coordinate supplied. This location could be on the surface, a building, or a feature.

    Note: This operation could return an empty point (clicked outside the earth).

    [virtual protected] void SceneView::screenToLocationCompletedEvent(QUuid taskId, const Esri::ArcGISRuntime::Point &location)

    Override this method to perform custom logic when a screenToLocation operation completes.

    • taskId - The task ID of the operation.
    • location - The location in scene coordinates.

    void SceneView::setAmbientLightColor(const QColor &color)

    Sets the ambient light color.

    • color - The ambient light color to set.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    See also ambientLightColor().

    void SceneView::setArcGISScene(Esri::ArcGISRuntime::Scene *scene)

    Sets the scene associated with this SceneView.

    Setting a non-loaded scene to a view starts the load process of the scene so the scene can be displayed once loaded.

    • scene - The scene to associate with this sceneview.

    See also arcGISScene().

    void SceneView::setAtmosphereEffect(Esri::ArcGISRuntime::AtmosphereEffect atmosphereEffect)

    Sets the atmosphere display effect.

    See also atmosphereEffect().

    void SceneView::setCameraController(Esri::ArcGISRuntime::CameraController *cameraController)

    Sets the sceneview's camera controller.

    The camera controller determines the camera interaction and navigation model.

    • cameraController - The Camera controller to set for the sceneview.

    The default is GlobeCameraController.

    See also cameraController().

    void SceneView::setFieldOfView(double angle)

    Sets the field of view on the scene view in degrees to angle.

    This value must be between 0 and 120. If the value is outside the range, the field of view is not changed and an error "Invalid argument" is emitted.

    This function was introduced in Esri::ArcGISRuntime 100.6.

    See also fieldOfView().

    void SceneView::setFieldOfViewAndDistortionRatio(double angle, double distortionRatio)

    Sets the angle and the distortion factor.

    Set the field of view on the scene view in degrees and determines how much the vertical field of view is distorted. A distortion factor of 1.0 is default. A distortion factor less than 1.0 will cause the visuals to be stretched taller in comparison to their width. A distortion factor greater than 1.0 will cause the visuals to be shrunk shorter in comparison to their width.

    • angle - The field of view on the scene view in degrees. This value must be between 0 and 120.
    • distortionRatio - The field of view vertical distortion ratio. This value must be between 0.1 and 10.

    If the values are outside the range, the field of view and the field of view vertical distortion ratio are not changed and an error "Invalid argument" is emitted.

    This function was introduced in Esri::ArcGISRuntime 100.6.

    void SceneView::setFieldOfViewFromLensIntrinsics(double xFocalLength, double yFocalLength, double xPrincipal, double yPrincipal, double xImageSize, double yImageSize, Esri::ArcGISRuntime::DeviceOrientation deviceOrientation)

    Sets the field of view of a camera lens using the lens characteristics.

    Allows for matching the field of view of the scene view to the field of view of a camera lens using the lens characteristics.

    • xFocalLength - The pixel focal length along the x axis. The units are in pixels. xFocal and yFocal should be identical for square pixels.
    • yFocalLength - The pixel focal length along the y axis. The units are in pixels. xFocal and yFocal should be identical for square pixels.
    • xPrincipal - The distance along the x axis between the principal point and the top-left corner of the image frame. The units are in pixels.
    • yPrincipal - The distance along the y axis between the principal point and the top-left corner of the image frame. The units are in pixels.
    • xImageSize - The x value of the image size captured by the camera. The units are in pixels.
    • yImageSize - The y value of the image size captured by the camera. The units are in pixels.
    • deviceOrientation - Describes the orientation of the device.

    This function was introduced in Esri::ArcGISRuntime 100.6.

    [virtual] void SceneView::setManualRendering(bool manualRendering)

    Sets the SceneView rendering mode manualRendering.

    Note: manual rendering is only supported on iOS and Android platforms.

    When the SceneView is using manual rendering, you must call renderFrame on a regular interval for the view to update.

    Note: this can only be set once, and must be set as early as possible. This setting cannot be changed once rendering has started.

    This function was introduced in Esri::ArcGISRuntime 100.6.

    See also isManualRendering() and renderFrame.

    [static] void SceneView::setMemoryLimit(quint64 memoryLimitBytes)

    Sets the total memory (in bytes) that a process can use for rendering scene data to memoryLimitBytes (Android only).

    The memory limit is set by default and this should be sufficient for most use cases. For more details of how the default limit is determined see memoryLimit. For some use cases you might want to choose to override the default to increase or reduce the limit. In those cases, set this property before instantiating any SceneView objects. If you choose to override this limit, consider the device's recommended memory limits. You can get that value from ActivityManager.getLargeMemoryClass().

    This function was introduced in Esri::ArcGISRuntime 100.3.

    See also memoryLimit().

    void SceneView::setSpaceEffect(Esri::ArcGISRuntime::SpaceEffect spaceEffect)

    Sets the space effect for the scene view.

    This function was introduced in Esri::ArcGISRuntime 100.6.

    See also spaceEffect().

    void SceneView::setSunLighting(Esri::ArcGISRuntime::LightingMode lightingMode)

    Sets the lighting mode for the sceneview.

    The lighting mode determines whether the Earth appears to be illuminated by the Sun, and whether to simulate shadows. For example, this can be used to control whether the shadows of terrain and 3D models are cast.

    • lightingMode - The lighting mode to set.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    See also sunLighting().

    void SceneView::setSunTime(const QDateTime &sunTime)

    Sets the Sun's position to simulate a specific time.

    You can simulate the Sun's position relative to the Earth to be as it would at a specific date and time.

    The default time of the simulation is September 22, 2000 at noon GMT.

    • sunTime - The time to be used.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    See also sunTime().

    Esri::ArcGISRuntime::TaskWatcher SceneView::setViewpointCamera(const Esri::ArcGISRuntime::Camera &camera)

    Sets the Camera for the scene view asynchronously.

    The Camera determines at what position and angle the scene is viewed.

    • camera - The Camera to set for the scene view.

    Esri::ArcGISRuntime::TaskWatcher SceneView::setViewpointCamera(const Esri::ArcGISRuntime::Camera &camera, float durationSeconds)

    Sets the Camera for the scene view asynchronously with animation duration.

    The Camera determines at what position and angle the scene is viewed.

    • camera - The Camera to set for the scene view.
    • durationSeconds - The number of seconds for the animation to run from beginning to end.

    void SceneView::setViewpointCameraAndWait(const Esri::ArcGISRuntime::Camera &camera)

    Sets the Camera for the scene view synchronously. This call runs in the same thread as the caller and will block until it finishes.

    The Camera determines at what position and angle the scene is viewed.

    • camera - The Camera to set for the sceneview.

    [virtual protected] void SceneView::setViewpointCameraCompletedEvent(bool success)

    Override this method to perform custom logic when a setViewpointCamera operation completes.

    • success True if setting the viewport camera completed successfully.

    Esri::ArcGISRuntime::SpaceEffect SceneView::spaceEffect() const

    Gets the space effect for the scene view.

    Determines whether outer space is black with stars or transparent in the scene view.

    The default value is SpaceEffect::Stars.

    This function was introduced in Esri::ArcGISRuntime 100.6.

    See also setSpaceEffect().

    Esri::ArcGISRuntime::LightingMode SceneView::sunLighting() const

    Returns the lighting mode.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    See also setSunLighting().

    QDateTime SceneView::sunTime() const

    Gets the time used to simulate the Sun's position.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    See also setSunTime().

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