ArcGIS Runtime SDK for Qt

Viewshed (Camera)

Loading

Code

import QtQuick 2.6
import QtQuick.Controls 1.4
import Esri.ArcGISRuntime 100.3
import Esri.ArcGISExtras 1.1

Rectangle {
    id: rootRectangle
    clip: true
    width: 800
    height: 600

    property real scaleFactor: System.displayScaleFactor

    SceneView {
        id: sceneView
        anchors.fill: parent

        Scene {
            id: scene
            BasemapImagery {}

            // Set the Scene's Surface
            Surface {
                ArcGISTiledElevationSource {
                    url: "http://scene.arcgis.com/arcgis/rest/services/BREST_DTM_1M/ImageServer"
                }
            }

            // Add a Scene Layer
            ArcGISSceneLayer {
                url: "http://tiles.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/Buildings_Brest/SceneServer/layers/0"
            }

            // Set an initial viewpoint
            ViewpointCenter {
                Point {
                    id: centerPt
                    x: -4.49492
                    y: 48.3808
                    z: 48.2511
                    spatialReference: SpatialReference.createWgs84()
                }
                targetScale: 62.01

                Camera {
                    id: camera
                    location: centerPt
                    heading: 344.488
                    pitch: 74.1212
                    roll: 0
                }
            }
        }

        // Declare an Analysis Overlay
        AnalysisOverlay {
            // Create the Location Viewshed
            LocationViewshed {
                id: locationViewshed
                minDistance: 1
                maxDistance: 1000
                frustumOutlineVisible: true
            }
        }
    }

    // calculate the viewshed on clicked
    Button {
        anchors {
            left: parent.left
            top: parent.top
            margins: 10 * scaleFactor
        }
        text: "Calculate Viewshed"
        onClicked: locationViewshed.updateFromCamera(sceneView.currentViewpointCamera);
    }
}


In this topic
  1. Code