SceneQuickView Class

QQuickItem component."> SceneQuickView Class | ArcGISQtCpp
  • SceneQuickView
  • class Esri::ArcGISRuntime::SceneQuickView

    A 3D scene implemented as a QQuickItem component. More...

    Header: #include <SceneQuickView.h>
    Since: Esri::ArcGISRuntime 100.0
    Inherits: Esri::ArcGISRuntime::NativeQuickItem and Esri::ArcGISRuntime::SceneView

    Properties

    Public Functions

    SceneQuickView(QQuickItem *parent = nullptr)
    SceneQuickView(Esri::ArcGISRuntime::Scene *scene, QQuickItem *parent = nullptr)
    virtual ~SceneQuickView() override
    QVariant attributionTop() const

    Reimplemented Public Functions

    virtual void setManualRendering(bool manualRendering) override

    Signals

    void attributionRectChanged()
    void attributionTextChanged()
    void attributionTopChanged()
    void drawStatusChanged(Esri::ArcGISRuntime::DrawStatus status)
    void errorOccurred(const Esri::ArcGISRuntime::Error &error)
    void hoverEntered(QHoverEvent &hoverEvent)
    void hoverLeft(QHoverEvent &hoverEvent)
    void hoverMoved(QHoverEvent &hoverEvent)
    void keyPressed(QKeyEvent &keyEvent)
    void keyReleased(QKeyEvent &keyEvent)
    void layerViewStateChanged(Esri::ArcGISRuntime::Layer *layer, const Esri::ArcGISRuntime::LayerViewState &layerViewState)
    void manualRenderingChanged()
    void mouseClicked(QMouseEvent &mouseEvent)
    void mouseDoubleClicked(QMouseEvent &mouseEvent)
    void mouseMoved(QMouseEvent &mouseEvent)
    void mousePressed(QMouseEvent &mouseEvent)
    void mousePressedAndHeld(QMouseEvent &mouseEvent)
    void mouseReleased(QMouseEvent &mouseEvent)
    void mouseWheelChanged(QWheelEvent &wheelEvent)
    void navigatingChanged()
    void rectChanged(const QRectF &rect)
    void sceneChanged()
    void spatialReferenceChanged()
    void touched(QTouchEvent &event)
    void viewpointChanged()

    Detailed Description

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

    A SceneQuickView implements a scene view as a QQuickItem component. This allows it to be used in a user interface coded in QML while being controlled by C++ code.

    Example:

    Register the SceneQuickView type as a QML type:

    qmlRegisterType<SceneQuickView>("Esri.Samples", 1, 0, "SceneView");

    Declare the SceneQuickView in QML, and assign an object name:

    SceneView {
        objectName: "sceneView"
        anchors.fill: parent
    
        Component.onCompleted: {
            // Set the focus on SceneView to initially enable keyboard navigation
            forceActiveFocus();
        }
    }
    
    Rectangle {
        anchors {
            top: parent.top
            left: parent.left
            margins: 5
        }
        width: childrenRect.width
        height: childrenRect.height
        color: "#000000"
        opacity: .8
        radius: 5
    
        MouseArea {
            anchors.fill: parent
            onClicked: mouse => mouse.accepted = true
            onWheel: wheel => wheel.accepted = true
        }
    
        ColumnLayout {
            Text {
                Layout.margins: 2
                Layout.alignment: Qt.AlignHCenter
                text: qsTr("Draped mode")
                color: "white"
            }
    
            Switch {
                id: surfacePlacementMode
                Layout.alignment: Qt.AlignHCenter
                Layout.margins: 2
    
                onCheckedChanged: changeDrapedVisibility();
            }
        }
    }
    
    Rectangle {
        anchors {
            top: parent.top
            right: parent.right
            margins: 5
        }
        width: childrenRect.width
        height: childrenRect.height
        color: "#000000"
        opacity: .8
        radius: 5
    
        MouseArea {
            anchors.fill: parent
            onClicked: mouse => mouse.accepted = true
            onWheel: wheel => wheel.accepted = true
        }
    
        ColumnLayout {
            Text {
                id: zValueSliderLabel
                text: qsTr("Z-Value")
                color: "white"
                Layout.margins: 2
                Layout.alignment: Qt.AlignHCenter
            }
    
            Slider {
                id: zValueSlider
                from: 0
                to: 140
                value: 70
                Layout.alignment: Qt.AlignHCenter
                Layout.margins: 2
                orientation: Qt.Vertical
    
                onMoved: changeZValue(value);
    
                // Custom slider handle that displays the current value
                handle: Item {
                    x: parent.leftPadding + parent.availableWidth / 2 - headingHandleNub.width / 2
                    y: parent.topPadding + parent.visualPosition * (parent.availableHeight - headingHandleNub.height)
    
                    Rectangle {
                        id: headingHandleNub
                        color: headingHandleRect.color
                        radius: width * 0.5
                        width: 20
                        height: width
                    }
                    Rectangle {
                        id: headingHandleRect
                        height: childrenRect.height
                        width: childrenRect.width
                        radius: 3
                        x: headingHandleNub.x - width
                        y: headingHandleNub.y - height / 2 + headingHandleNub.height / 2
    
                        Text {
                            id: headingValue
                            font.pixelSize: 14
                            padding: 3
                            horizontalAlignment: Qt.AlignHCenter
                            verticalAlignment: Qt.AlignVCenter
                            text: (zValueSlider.value).toFixed(0)
                            color: "white"
                        }
                    }
                }
            }
        }
    }

    Obtain the SceneQuickView from C++ and set a Scene to the SceneQuickView:

    // Create a scene with the imagery basemap and world elevation surface
    m_sceneView = findChild<SceneQuickView*>("sceneView");
    Scene* scene = new Scene(BasemapStyle::ArcGISImageryStandard, this);
    Surface* surface = new Surface(this);
    surface->elevationSources()->append(new ArcGISTiledElevationSource(QUrl("https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer"), this));
    scene->setBaseSurface(surface);
    
    // Create scene layer from the Brest, France scene server.
    ArcGISSceneLayer* sceneLayer = new ArcGISSceneLayer(QUrl("https://tiles.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/Buildings_Brest/SceneServer"), this);
    scene->operationalLayers()->append(sceneLayer);

    See also Scene, SceneView, and GeoView.

    Property Documentation

    [read-only, since Esri::ArcGISRuntime 100.3] attributionRect : const QRectF

    This property holds the bounding rectangle of the attribution text (read-only).

    This bounding rectangle can be used when calculating where items can be displayed on the screen so they are not overlapping the attribution text.

    This property was introduced in Esri::ArcGISRuntime 100.3.

    Notifier signal:

    [read-only, since Esri::ArcGISRuntime 100.1] attributionTop : const QVariant

    This property holds the top anchor line of the attribution bounding rectangle as an AnchorLine variant (read-only).

    Other QtQuick items can be anchored to this property so that they display above the attribution text.

    This property was introduced in Esri::ArcGISRuntime 100.1.

    Access functions:

    QVariant attributionTop() const

    Notifier signal:

    [since Esri::ArcGISRuntime 100.6] manualRendering : bool

    This property holds whether the SceneView is under manual rendering control.

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

    This property was introduced in Esri::ArcGISRuntime 100.6.

    Access functions:

    virtual void setManualRendering(bool manualRendering) override

    Notifier signal:

    See also isManualRendering.

    Member Function Documentation

    [explicit] SceneQuickView::SceneQuickView(QQuickItem *parent = nullptr)

    Default constructor that takes an optional parent.

    [explicit] SceneQuickView::SceneQuickView(Esri::ArcGISRuntime::Scene *scene, QQuickItem *parent = nullptr)

    Constructor that takes a scene and an optional parent.

    [override virtual] SceneQuickView::~SceneQuickView()

    Destructor.

    [signal, since Esri::ArcGISRuntime 100.1] void SceneQuickView::attributionRectChanged()

    Emitted when the attribution bounding rectangle changes.

    Note: Notifier signal for property attributionRect.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    [signal, since Esri::ArcGISRuntime 100.1] void SceneQuickView::attributionTextChanged()

    Emitted when the attribution text changes.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    [since Esri::ArcGISRuntime 100.1] QVariant SceneQuickView::attributionTop() const

    Gets the top anchor line of the attribution bounding rectangle as an AnchorLine variant.

    Other QtQuick items can be anchored to this property so that they display above the attribution text.

    Note: Getter function for property attributionTop.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    [signal, since Esri::ArcGISRuntime 100.1] void SceneQuickView::attributionTopChanged()

    Emitted when the attributionTop anchor line changes.

    Note: Notifier signal for property attributionTop.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    [signal] void SceneQuickView::drawStatusChanged(Esri::ArcGISRuntime::DrawStatus status)

    Signal emitted when the DrawStatus changes.

    [signal] void SceneQuickView::errorOccurred(const Esri::ArcGISRuntime::Error &error)

    Signal emitted when an error occurs.

    • error - Details about the error.

    [signal, since Esri::ArcGISRuntime 200.2] void SceneQuickView::hoverEntered(QHoverEvent &hoverEvent)

    Emitted when the cursor enters.

    • hoverEvent - The hover event.

    This function was introduced in Esri::ArcGISRuntime 200.2.

    [signal, since Esri::ArcGISRuntime 200.2] void SceneQuickView::hoverLeft(QHoverEvent &hoverEvent)

    Emitted when the cursor leaves.

    • hoverEvent - The hover event.

    This function was introduced in Esri::ArcGISRuntime 200.2.

    [signal, since Esri::ArcGISRuntime 200.2] void SceneQuickView::hoverMoved(QHoverEvent &hoverEvent)

    Emitted when the cursor moves.

    • hoverEvent - The hover event.

    This function was introduced in Esri::ArcGISRuntime 200.2.

    [signal] void SceneQuickView::keyPressed(QKeyEvent &keyEvent)

    Emitted when a key pressed has been detected.

    • keyEvent - The key event.

    [signal] void SceneQuickView::keyReleased(QKeyEvent &keyEvent)

    Emitted when a key release has been detected.

    • keyEvent - The key event.

    [signal] void SceneQuickView::layerViewStateChanged(Esri::ArcGISRuntime::Layer *layer, const Esri::ArcGISRuntime::LayerViewState &layerViewState)

    Signal emitted when the LayerViewState changes.

    • layer - The layer that had a state change.
    • layerViewState - The LayerViewState with the new state information.

    The returned Layer object has the SceneQuickView as its parent.

    See also Returned QObjects Parenting.

    [signal, since Esri::ArcGISRuntime 100.6] void SceneQuickView::manualRenderingChanged()

    Signal emitted when manualRendering changes.

    Note: Notifier signal for property manualRendering.

    This function was introduced in Esri::ArcGISRuntime 100.6.

    [signal] void SceneQuickView::mouseClicked(QMouseEvent &mouseEvent)

    Emitted when mouse is pressed and released over the same location.

    • mouseEvent - The mouse event.

    [signal] void SceneQuickView::mouseDoubleClicked(QMouseEvent &mouseEvent)

    Emitted when a double click even is detected.

    • mouseEvent - The mouse event.

    [signal] void SceneQuickView::mouseMoved(QMouseEvent &mouseEvent)

    Emitted when mouse is moved.

    • mouseEvent - The mouse event.

    [signal] void SceneQuickView::mousePressed(QMouseEvent &mouseEvent)

    Emitted when mouse is pressed.

    • mouseEvent - The mouse event.

    [signal] void SceneQuickView::mousePressedAndHeld(QMouseEvent &mouseEvent)

    Emitted when there is a long press and hold (currently 800ms) on the same point.

    • mouseEvent - The mouse event.

    [signal] void SceneQuickView::mouseReleased(QMouseEvent &mouseEvent)

    Emitted when mouse is release.

    • mouseEvent - The mouse event.

    [signal] void SceneQuickView::mouseWheelChanged(QWheelEvent &wheelEvent)

    Emitted when mouse wheel movement has been detected.

    • wheelEvent - The wheel event.

    Signal emitted when the view has started or completed navigating.

    [signal] void SceneQuickView::rectChanged(const QRectF &rect)

    Emitted when the visible area changes.

    • rect - The new rect representing the visible area.

    [signal, since Esri::ArcGISRuntime 100.3] void SceneQuickView::sceneChanged()

    Emitted when the scene changes.

    This function was introduced in Esri::ArcGISRuntime 100.3.

    [override virtual, since Esri::ArcGISRuntime 100.6] void SceneQuickView::setManualRendering(bool manualRendering)

    Reimplements: SceneView::setManualRendering(bool manualRendering).

    Sets whether manual rendering is enabled to manualRendering.

    This is a convenience property to allow access directly from QML.

    Note: Setter function for property manualRendering.

    This function was introduced in Esri::ArcGISRuntime 100.6.

    See also SceneView::isManualRendering.

    [signal] void SceneQuickView::spatialReferenceChanged()

    Signal emitted when the SpatialReference changed.

    [signal] void SceneQuickView::touched(QTouchEvent &event)

    Emitted when a touch event has been detected.

    Accept the event to prevent the SceneQuickView from performing its default gesture interaction behavior.

    • event - The touch event.

    [signal] void SceneQuickView::viewpointChanged()

    Emitted when the viewpoint changes.

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